insightgetmode
insightgetmode |
Purpose
Synopsis
function insightgetmode:string
Return value
The Execution Mode, as specified in the Project. This can be a user-defined value, or can be one of these pre-defined standard values:
- INSIGHT_MODE_LOAD
- When an Xpress Insight scenario is being loaded
- INSIGHT_MODE_RUN
- When an Xpress Insight scenario is being run
- INSIGHT_MODE_NONE
- When the model is being executed outside of Xpress Insight
Example
case insightgetmode of INSIGHT_MODE_LOAD: do ! Scenario is being 'loaded' through Xpress Insight ! Call user function to initialize input data and then terminate loaddata exit(0) end-do INSIGHT_MODE_RUN: do ! Scenario is being 'run' through Xpress Insight ! Populate with Insight scenario data and continue model run insightpopulate end-do 'MY_CUSTOM_EXECUTION_MODE': do ! This would be an execution mode defined with an @insight.execmode ! annotation, to indicate some custom behavior insightpopulate ! Now take whatever custom action is appropriate... end-do else ! Model is being run outside of Xpress Insight ! Call user function to initialize input data and continue model run loaddata end-case
Example of the basic flow of an Insight model, calling
loaddata to populate the input data entities when the scenario is loaded or the model is run from outside of Insight, and
insightpopulate to populate them when scenario is run within Insight.
Further information
This function should be used as a conditional test to determine which parts of the model should be executed. In general, in
INSIGHT_MODE_LOAD (or other user-defined execution modes intended to denote that initial data is being loaded) your model should initialize its input data and then exit. In
INSIGHT_MODE_RUN (or user-defined execution modes intended to denote the model should be executed) it should call
insightpopulate to populate their data structures and then construct and solve the optimization model. And in
INSIGHT_MODE_NONE it should both initialize its input data and construct and solve the optimization, to allow the model developer to execute the model outside of Insight.