Initializing help system before first use

Integer Programming entities in Mosel

Definition: integer programming types are defined as unary constraints on previously declared decision variables of type mpvar; name the constraints if you want to be able to access/modify them.

declarations
  d: mpvar
  ifmake: array(PRODS,LINES) of mpvar
  x: mpvar
 end-declarations

 d is_binary                      ! Single binary variable
 forall(p in PRODS, l in LINES)
  ifmake(p,l) is_binary           ! An array of binaries

 ACtr:= x is_integer              ! An integer variable
 x >= MINVAL                      ! Lower bound on the variable
 x <= MAXVAL                      ! Upper bound on the variable
 ! MINVAL,MAXVAL: values between -MAX_REAL and MAX_REAL
 ...
 ACtr:= x is_partint 10           ! Change type to partial integer
 ...
 ACtr:= 0                         ! Delete constraint
! Equivalently:
 ACtr:= x is_continuous           ! Change type to continuous

Solving: with Xpress Optimizer (Mosel module mmxprs) any problem containing integer programming entities is automatically solved as a MIP problem, to solve just the LP relaxation use option XPRS_LPSTOP (if following up with MIP search) or XPRS_LIN (ignore all MIP information) for maximize / minimize.

Accessing the solution: for obtaining solution values of decision variables and linear expressions use getsol (alternative syntax: .sol); the MIP problem status is returned by the function getparam("XPRS_MIPSTATUS")

 case getparam("XPRS_MIPSTATUS") of
  XPRS_MIP_NOT_LOADED,
    XPRS_MIP_LP_NOT_OPTIMAL: writeln("Solving not started")
  XPRS_MIP_LP_OPTIMAL:       writeln("Root LP solved")
  XPRS_MIP_UNBOUNDED:        writeln("LP unbounded")
  XPRS_MIP_NO_SOL_FOUND,
    XPRS_MIP_INFEAS:         writeln("MIP search started, no solution")
  XPRS_MIP_SOLUTION,
    XPRS_MIP_OPTIMAL:        writeln("MIP solution: ", , getobjval)
 end-case

 writeln("x: ", getsol(x))
 writeln("d: ", d.sol)

© 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.