Initializing help system before first use

Boolean variables

The Mosel module mmxprs defines the entity type boolvar for representing a pseudo boolean decision variable. This type supports the operators and, or and not for building logical expressions and can be combined with ordinary Boolean variables (type boolean). A logical constraint is specified either by associating a pseudo boolean variable to a logical expression or by forcing the truth value (i.e. true or false) of an expression as shown in the code example below. When a logical expression is used on its own as a statement it is implicitly turned into a constraint (forced to true) and added to the constraint store.

 uses "mmxprs"

 public declarations
   R=1..5
   bv: array(R) of boolvar
   LC1, LC2: logctr
 end-declarations

! Simple clause, same as:  bv(1) and not bv(5) = true
 bv(1) and not bv(5)

! Association of clauses
 bv(3)=(not bv(4))

! The opposite of 'bv(1) or bv(3)' must be false
 (not (bv(1) or bv(3)))=false

! Defining a logic expression (not recorded in the constraint store)
 LC1:= and(i in 1..3) bv(i) or and(i in 4..5) not bv(i)

! Turn expression into a constraint
 LC1:= LC1=true

! A named logic expression (this defines a constraint)
 LC2:= (or(i in 1..3) not bv(i)) = false

! Solve as feasibility (SAT) problem
 maximise(0)
 if getprobstat=XPRS_OPT then
   writeln("Problem is feasible")
 else
   writeln("Problem is unsatisfiable")
 end-if

© 2001-2020 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.