implies

implies is used to define implications between logic cases

Syntax

F = implies(A,B)

Examples

implies is used to define logic implications. As an example, the following code will ensure that a variable x satisfies a set of linear inequalities if a binary variable d is true. If d is false, the value of x is arbitrary the constraints could be satisfied, but they do not have to be)

d = binvar(1);
F = implies(d,A*x <= b);

implies is mainly intended for (BINARY -> BINARY) or (BINARY -> Linear constraint), although it can be used also for more general constructions such as (Linear Constraint -> Linear Constraint) (bearing in mind that these models typically are numerically sensitive and may require a lot of binary variables to be modeled).

The following code reverts the logic: if a set of linear inequalities are satisfied, the binary variable is forced to be true.

d = binvar(1);
F = implies(A*x <= b, d);

For more examples, check out the logic programming tutorial

Comments

Since implies is implemented using a big-M approach, it is crucial that all involved variables have explicit bound constraints.

Leave a Comment