View source: R/Disconnectivity.R
Disconnectivity_Import_Constraint | R Documentation |
Disconnectivity_Import_Constraint
imports the Disconnectivity Constraints' data from a sheet in an excel file.
Everytime used, it will update the list named Disconnectivity
which will store the disconnectivity constraints.
(For more information, refer to Disconnectivity_Add_Constraint)
Disconnectivity_Import_Constraint(Address, Sheet= "Disconnectivity",
Repetition= TRUE, Silence= FALSE,
Env= .GlobalEnv)
Address |
A string: the location and name of the excel file. |
Sheet |
A string: the name of the sheet holding the disconnectivity constraints data. (Default: "Disconnectivity") |
Repetition |
A binary parameter: If |
Silence |
A binary parameter: if |
Env |
the environment where the package should create or access variables. By default the package works in the R's Global environment. (Default: .GlobalEnv) |
The first row of the sheet will be ignored as captions, and in the remaining rows, each row includes a Disconnectivity Constraint.
The first column of the sheet should have names of Target
parcels,
and each cell in front of a Target
includes a parcel from the group of Condition
parcels.
Here is an example Disconnectivity constraint table:
If Repetition=TRUE
, function creates Disconnectivity[["Parcel_1"]][[1]]
and
Disconnectivity[["Parcel_1"]][[2]]
, and the following constraints will be added to the optimization model
Parcel_4 + Parcel_1 <= 1
,
Parcel_2 + Parcel_3 + 2*Parcel_1 <= 2
.
If Repetition=FALSE
, only Disconnectivity[["Parcel_1"]][[1]]
will be created, and only the following constraint will be added to the optimization model
Parcel_4 + Parcel_2 + Parcel_3 + 3*Parcel_1 <= 3
.
Removing a specific disconnectivity constraint of a Target
: Disconnectivity constraint i
of a parcel named "Parcel_j"
can be removed using the following code:
Disconnectivity[["Parcel_j"]][[i]]<-NULL
Removing all disconnectivity constraints of a Target
: Disconnectivity constraints of a parcel named "Parcel_j"
can be removed using the following code:
Disconnectivity[["Parcel_j"]]<-NULL
Remove all Disconnectivity Constraints: All of the Disconnectivity constraints can be removed using the following code:
remove(Disconnectivity)
NULL (creates some variables in the environment but returns nothing)
Other Disconnectivity Constraints:
Disconnectivity_Add_Constraint()
## Not run:
Disconnectivity_Import_Constraint("C:\\example.xlsx", Sheet= "Disconnectivity",
Repetition= TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.