Skip to content

Constraints

afish edited this page Sep 11, 2015 · 1 revision

List

Currently there are implemented the following constraints:

  • Less or equal
  • Greater or equal
  • Equal
  • Multiple of
  • Less than
  • Greater than
  • Not equal

Less or equal

This is the basic constraint used to implement other base constraints.

Usage

IMilpManager manager;
IVariable variable;
IVariable bound;
...
variable.Set(ConstraintType.LessOrEqual, bound);
or
manager.Set(ConstraintType.LessOrEqual, variable, bound);

Details

Adds constraint that in the final solution variable is less or equal to bound. Works for every type of variable.


Greater or equal

Implemented as a Less or equal constraint with bounds swapped.

Usage

IMilpManager manager;
IVariable variable;
IVariable bound;
...
variable.Set(ConstraintType.GreaterOrEqual, bound);
or
manager.Set(ConstraintType.GreaterOrEqual, variable, bound);

Details

Adds constraint that in the final solution variable is greater or equal to bound. Works for every type of variable. Implemented as:

bound.Set(ConstraintType.LessOrEqual, variable);

Equal

Implemented as two Less or equal constraints.

Usage

IMilpManager manager;
IVariable variable;
IVariable bound;
...
variable.Set(ConstraintType.Equal, bound);
or
manager.Set(ConstraintType.Equal, variable, bound);

Details

Adds constraint that in the final solution variable is equal to bound. Works for every type of variable. Implemented as:

variable.Set(ConstraintType.LessOrEqual, bound);
bound.Set(ConstraintType.LessOrEqual, variable);

Multiple of

Makes sure that one variable is a multiple of second variable.

Usage

IMilpManager manager;
IVariable variable;
IVariable divider;
...
variable.Set(ConstraintType.MultipleOf, divider);
or
manager.Set(ConstraintType.MultipleOf, variable, divider);

Details

Adds constraint that in the final solution variable is a multiple of divider. Works for every type of variable even for non-integer variables.


Less than

Makes sure that variable is less than bound. Uses implementation of comparisons.

Usage

IMilpManager manager;
IVariable variable;
IVariable bound;
...
variable.Set(ConstraintType.LessThan, bound);
or
manager.Set(ConstraintType.LessThan, variable, bound);

Details

Adds constraint that in the final solution variable is less than bound. Depends on IsLessThan operation.


Greater than

Makes sure that variable is greater than bound. Uses implementation of comparisons.

Usage

IMilpManager manager;
IVariable variable;
IVariable bound;
...
variable.Set(ConstraintType.GreaterThan, bound);
or
manager.Set(ConstraintType.GreaterThan, variable, bound);

Details

Adds constraint that in the final solution variable is greater than bound. Depends on IsGreaterThan operation.


Not equal

Makes sure that variable is not equal to bound.

Usage

IMilpManager manager;
IVariable variable;
IVariable bound;
...
variable.Set(ConstraintType.NotEqual, bound);
or
manager.Set(ConstraintType.NotEqual, variable, bound);

Details

Adds constraint that in the final solution variable is greater than bound. Depends on IsNotEqual operation.