Connectivity_Import_Constraint: Import Connectivity Constraints' data from Excel file

Description Usage Arguments Details Value See Also Examples

View source: R/Connectivity.R

Description

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)

Usage

1
2
Connectivity_Import_Constraint(Address, Sheet= "Connectivity",
                                      Repetition= TRUE, Silence= FALSE, Env= .GlobalEnv)

Arguments

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 TRUE, the Condition parcels will create a new constraint for Target. If FALSE, the Condition parcels will be added to the first existing Connectivity constraint of Target, i.e. Connectivity[["Target"]][[1]]. (Default: TRUE)

Silence

A binary parameter: if FALSE, the function will report a summary message. If TRUE, the function will be silent. (Default: FALSE)

Env

the environment where the package should create or access variables. By default the package works in the R's Global environment. (Default: .GlobalEnv)

Details

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)

Value

NULL (creates some variables in the environment but returns nothing)

See Also

Other Connectivity Constraints: Connectivity_Add_Constraint()

Examples

1
2
3
4
5
6
## Not run: 

Connectivity_Import_Constraint("C:\\example.xlsx", Sheet= "Connectivity", Repetition= TRUE)


## End(Not run)

paymanghasemi/SiteOpt documentation built on April 8, 2021, 3:44 a.m.