Initializing help system before first use

implies

implies


Purpose
Create an implies expression.
Synopsis
function implies(c1:log_or_linctr,c2:log_or_linctr):logctr
Arguments
c1 
A linear constraint ( linctr) or logical expression ( logctr)
c2 
A linear constraint ( linctr) or logical expression ( logctr)
Return value
A new logctr representing the expression.
Example
The following example shows several ways of stating the logical relation 'if x1≥10 then x1+x2≥12 and not x2≤5'. The implied constraint L is itself a logical constraint, built up by using the operators and and not in combination with linear constraints.
declarations
 R=1..2
 C: array(range) of linctr        ! Linear constraints
 L: logctr                        ! Logical constraint
 x: array(R) of mpvar             ! Decision variables
end-declarations

C(1):= x(1)>=10                   ! Define (temporary) linear ctrs
C(2):= x(2)<=5
C(3):= x(1)+x(2)>=12

implies(C(1), C(3) and not C(2))  ! State the implication
forall(j in 1..3) C(j):=0         ! Delete the auxiliary ctrs

! The same implication constraint can be stated by:
implies(x(1)>=10, x(1)+x(2)>=12 and not x(2)<=5)

! Or also by:
L:= x(1)+x(2)>=12 and not x(2)<=5 ! Define (temporary) logical ctr
implies(x(1)>=10, L)              ! State the implication
L:= 0                             ! Delete the auxiliary ctr
Further information
1. This function creates a logctr constraint representing an implies condition: if c1 is valid then c2 is enforced.
2. The helper package 'advmod' must be loaded if this function is used:
uses 'advmod'

Related topics
Module