Initializing help system before first use

General constraints

Certain nonlinear constraint relations (refered to as general constraints) are recognized by MIP solvers and they are treated as MIP modeling constructs. These include

  • piecewise linear expressions (see examples in Sections Price breaks and Non-linear functions above)
  • absolute value, minimum value, maximum value of discrete or continuous decision variables
  • logical constraints: 'and' and 'or' over binary variables (see Section Boolean variables )

The Mosel implementation of the numerical constraints abs, fmin and fmax makes it possible to use linear expressions as argument to these functions. Note that models using these general constraints need to load the mmxnlp module in addition to mmxprs although the problems will be solved by the Xpress MIP solver.

 uses "mmxnlp"

 public declarations
   R=1..3
   x: array(R) of mpvar
   y,z: mpvar
 end-declarations

 forall(i in R) x(i) <= 20
 abs(x(1)-2*x(2)) <= 10                     ! Absolute value constraint
 MinCtr:= fmin(union(i in R) [x(i)]) >= 5   ! Minimum value constraint
 y = fmax(x(3), 20, x(1)-z)                 ! Maximum value constraint

 maximize(sum(i in R) x(i))                 ! Solve as MIP problem
 if getprobstat=XPRS_OPT then               ! Solution reporting
   writeln("Solution: ", getobjval)
   forall(i in R) write("x", i, "=", x(i).sol, ", ")
   writeln("y=", y.sol, ", z=", z.sol)
   writeln("abs=", getsol(abs(x(1)-2*x(2))), ", Min of x(i)=", MinCtr.sol+5)
 else
   writeln("No solution")
 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.