Budget_Add_Constraint: Create a Budget Constraint

Description Usage Arguments Details Value See Also Examples

View source: R/Budget.R

Description

Budget_Add_Constraint creates a Budget Constraint in the optimization model of the form:

where B and S are respectively the set of initially protected and unprotected parcels, and C is the budget limit.

Usage

1
Budget_Add_Constraint(Parcels, Coefficients, Limit, Silence=FALSE, Env= .GlobalEnv)

Arguments

Parcels

A vector of strings: the name of the parcels appearing in the constraint. The package will automatically differentiate protected from unprotected parcels.

Coefficients

A vector of doubles: the respective coefficients of the parcels in Parcels.

Limit

A double: defining the budget limit (right-hand-side)

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

When used for the first time, Budget_Add_Constraint or Budget_Import_Constraint will create a list named Budget in the environment. Whenever a new budget constraint is added, a new member will be added to the list Budget.

Each member of the list Budget represents a budget constraint. Each budget constraint is stored as a list with three members: Parcels storing the names of the parcels in the constraint, Coefficients storing the respective coefficients of the parcels, and Limit storing the budget limit (right-hand-side).

In other words, the information of the i'th Budget constraint in Budget can be accessed by:
Budget[[i]][["Parcels"]],
Budget[[i]][["Coefficients"]],
and Budget[[i]][["Limit"]].

Removing a budget: Budget i can be removed using the following code:

Budget[[i]]<-NULL

Removing all budget constraints: All budget constraints can be removed using the following code:

remove(Budget)

Value

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

See Also

Other Budget Constraints: Budget_Import_Constraint()

Other Constraints: Add_Constraint(), Connectivity_Add_Constraint(), Disconnectivity_Add_Constraint()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 

## To create a budget constraint of the form
5*Parcel_1 + 10*Parcel_3 + 15*Parcel_4 <= 15 ##

Budget_Add_Constraint(Parcels= c("Parcel_1","Parcel_3","Parcel_4"),
                      Coefficients= c(5,10,15), Limit=15)


## End(Not run)

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