Viewing the solution
Always check the solution status of the problem before accessing any solution values.
if (getprobstat=XPRS_OPT) then writeln('optimal!') else writeln('not optimal!') exit(1) end-if
Alternatively, testing all problem states:
case getprobstat of XPRS_OPT: writeln('optimal') XPRS_INF: writeln('infeasible') XPRS_UNB: writeln('unbounded') XPRS_UNF: writeln('unfinished') else writeln('unexpected problem status!') end-case
Accessing the solution values within the model:
writeln('Maximum revenue: $', getobjval) writeln('x(1) = ', getsol(x(1)), ' x(2) = ', x(2).sol)
Solution values of constraints: activity value + slack value = RHS
-
MaxCap := 10*x + 20*y <= 30
- Activity value:
-
getsol(10*x + 20*y) getact(MaxCap)
- Slack value:
-
getsol(30 - (10*x + 20*y)) getslack(MaxCap)
Xpress Workbench: assuming that the model runs successfully, the logging pane at the bottom of the workspace reports that the run is complete. If a model has been run through the debugger, you can browse solution values of decision variables and constraints in the Debugger tab on the right side of the workspace.