Description Usage Arguments Details Value See Also Examples

`Add_Constraint`

creates a Constraint in the optimization model of the form:

where *B* and *S* are respectively the set of initially protected and unprotected parcels, and `b`

is the right-hand-side of the constraint.

1 2 | ```
Add_Constraint(Parcels, Coefficients, RHS,
Silence=FALSE, Env= .GlobalEnv)
``` |

`Parcels` |
A vector of strings: the name of the parcels to appear in the constraint. The package will automatically differentiate protected from unprotected parcels. |

`Coefficients` |
A vector of doubles: the respective coefficients of the |

`RHS` |
A double: defining the right-hand-side value of the constraint. |

`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, `Add_Constraint`

will create a list named `Constraints`

.

Each member of the list `Constraints`

represents a linear constraint.
Each 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 `RHS`

storing the constraints right-hand-side value.

In other words, the information of the `i`

'th constraint in `Constraints`

can be accessed by

`Constraints[[i]][["Parcels"]]`

,

`Constraints[[i]][["Coefficients"]]`

,

and `Constraints[[i]][["RHS"]]`

.

This function enables adding any types of linear constraints to the optimization model.

**Removing a constraint:** Constraint `i`

can be removed using the following code:

`Constraints[[i]]<-NULL`

**Remove all Constraints:** All of the Constraints stored in `Constraints`

can be removed using the following code:

`remove(Constraints)`

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

Other Constraints:
`Budget_Add_Constraint()`

,
`Connectivity_Add_Constraint()`

,
`Disconnectivity_Add_Constraint()`

1 2 3 4 5 6 7 8 9 10 11 12 13 | ```
## Not run:
## The constraint {Parcel_1 + Parcel_3 + Parcel_5 >= 2}
is the same as {-Parcel_1 - Parcel_3 - Parcel_5 <= -2},
which can be created by using the following code: ##
Add_Constraint(Parcels= c("Parcel_1","Parcel_3","Parcel_5"),
Coefficients= c(-1,-1,-1),
RHS=-2,
Silence=FALSE)
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.