Disconnectivity_Import_Constraint: Import Disconnectivity Constraints' data from Excel file

Description Usage Arguments Details Value See Also Examples

View source: R/Disconnectivity.R

Description

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)

Usage

1
2
3
Disconnectivity_Import_Constraint(Address, Sheet= "Disconnectivity",
                                         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 disconnectivity constraints data. (Default: "Disconnectivity")

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 disconnectivity constraint of Target, i.e. Disconnectivity[["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 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)

Value

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

See Also

Other Disconnectivity Constraints: Disconnectivity_Add_Constraint()

Examples

1
2
3
4
5
6
7
## Not run: 

Disconnectivity_Import_Constraint("C:\\example.xlsx", Sheet= "Disconnectivity",
                                  Repetition= TRUE)


## End(Not run)

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