Connectivity_Import_Constraint | R Documentation |
Connectivity_Import_Constraint
imports the Connectivity Constraints' data from a sheet in an excel file.
Everytime used, it will update the list named Connectivity
which will store the connectivity constraints.
(For more information, refer to Connectivity_Add_Constraint)
Connectivity_Import_Constraint(Address, Sheet= "Connectivity",
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 connectivity constraints data. (Default: "Connectivity") |
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 Connectivity 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 Connectivity constraint table:
If Repetition=TRUE
, function creates Connectivity[["Parcel_5"]][[1]]
and
Connectivity[["Parcel_5"]][[2]]
, and the following constraints will be added to the optimization model
Parcel__5 <= Parcel__1
,
Parcel__5 <= Parcel__4
.
If Repetition=FALSE
, only Connectivity[["Parcel_1"]][[1]]
will be created,
and only the following constraint will be added to the optimization model
Parcel_5 <= Parcel_1 + Parcel_4
.
Removing a specific connectivity constraint of a Target
: Connectivity constraint i
of a parcel named "Parcel_j"
can be removed using the following code:
Connectivity[["Parcel_j"]][[i]]<-NULL
Removing all connectivity constraints of a Target
: Connectivity constraints of a parcel named "Parcel_j"
can be removed using the following code:
Connectivity[["Parcel_j"]]<-NULL
Remove all Connectivity Constraints: All of the Connectivity constraints can be removed using the following code:
remove(Connectivity)
NULL (creates some variables in the environment but returns nothing)
Other Connectivity Constraints:
Connectivity_Add_Constraint()
## Not run:
Connectivity_Import_Constraint("C:\\example.xlsx", Sheet= "Connectivity", Repetition= TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.