Initializing help system before first use

Xpress Insight Model Requirements

Mosel model developers must implement several features in a model to use it in Xpress Insight.
  • Include the mminsight package which includes the mminsight.dso Mosel module and implements the necessary interactions between Xpress Insight and the model.
  • The model must implement the LOAD mode by writing model code to initialize all managed model entities. The execution of this loading code must be conditional on insightgetmode = INSIGHT_MODE_LOAD. Any calls to finalize must be included in the loading code.
  • The model must implement the RUN mode. The execution of this code must be conditional on insightgetmode = INSIGHT_MODE_RUN and begin with a call to insightpopulate. The RUN mode code will typically include statements to construct the model from the scenario data, optimize it and process results.
  • Replace any call to minimize and maximize with insightminimize and insightmaximize.
  • Use the public qualifier to declare any input or results data entities if the -s (strip private symbols) compiler option is used. Entities declared locally within a procedure or functions are not visible to Xpress Insight, they need to be declared globally to be made visible.
A typical model will have the following basic structure:
model mymodel
uses "mminsight"
uses "mmxprs"
forward procedure datainput
case insightgetmode of
  INSIGHT_MODE_LOAD: do  
    datainput
    exit(0) ! Stop after data initialization
  end-do
  INSIGHT_MODE_RUN:
    insightpopulate ! Inject scenario data and continue
else
  datainput ! Default (non-Xpress Insight): initialize data and continue
end-case

! load input data
procedure datainput
  writeln("loading data")
end-procedure

! create model constraints
! optimize
! post-process results

end-model

The case statement (equivalent to if .. else if .. else) implements the flow control for each mode. The RUN mode logic in the example above is implemented in the global scope of the model after the case statement. Larger models often encapsulate the RUN mode logic in one or more procedures called from the case statement.