Budget_Add_Constraint | R Documentation |
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.
Budget_Add_Constraint(Parcels, Coefficients, Limit, Silence=FALSE, Env= .GlobalEnv)
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 |
Limit |
A double: defining the budget limit (right-hand-side) |
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) |
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)
NULL (creates some variables in the environment but returns nothing)
Other Budget Constraints:
Budget_Import_Constraint()
Other Constraints:
Add_Constraint()
,
Connectivity_Add_Constraint()
,
Disconnectivity_Add_Constraint()
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.