FICO Xpress Optimization Examples Repository
FICO Optimization Community FICO Xpress Optimization Home
Back to examples browserPrevious exampleNext example

Output of expressions

Initializations with evaluation of expressions (solution values, function calls). Version 2: 'array' operator, 2s: string indices.

Further explanation of this example: 'Mosel User Guide', Section 10.2.4 Solution output with initializations to

Source Files


   Mosel User Guide Example Problems

   file initeval.mos 
   Initializations with evaluation.
   (c) 2008 Fair Isaac Corporation
       author: S. Heipcke, Sep. 2007

model "Evaluations"
 uses "mmxprs" 
  small,large: mpvar                 ! Decision variables: produced quantities

 Profit:=  5*small + 20*large        ! Objective function
 Lathe:=   3*small + 2*large <= 160  ! Lathe-hours
 Boxwood:=   small + 3*large <= 200  ! kg of boxwood
 small is_integer; large is_integer  ! Integrality constraints

 maximize(Profit)                    ! Solve the problem

 initializations to "chessout.txt"   ! Solution output to a file
  evaluation of getparam("XPRS_mipstatus") as "Status"
  evaluation of getobjval as "Objective"
  evaluation of small.sol as "small_sol"
  evaluation of large.sol as "large_sol"
  evaluation of Lathe.slack as "Spare time"
  evaluation of Boxwood.act as "Used wood"
  evaluation of Boxwood.act-200 as "Spare wood"
  evaluation of [ small.sol, large.sol ] as "x_sol"

 writeln("Solution: ", getobjval)    ! Display solution values
 writeln("Small: ", getsol(small), " large: ", getsol(large))
 writeln("Time: ", getact(Lathe), " ", getslack(Lathe))
 writeln("Wood: ", Boxwood.sol, "  ", Boxwood.act, "  ", Boxwood.slack)


Back to examples browserPrevious exampleNext example