Initializing help system before first use

Inter-Scenario Data Access

You can also initialize your data structures with values from external scenarios using the mminsight.scenariodata I/O driver with a standard Mosel initializations-from block. For example, the following model initializes the array "Distances" from an array called "CityDrivingDistances" in a scenario "USDrivingDistances" in an app named "DrivingDistancesModel"

model RoutePlanner
 uses "mmxprs"                     ! Load the Xpress Optimizer
 uses "mminsight"                  ! Load the Insight interface

 ! Input data - stored in Insight scenario
 !@insight.manage input
 public declarations
  Cities: set of string
  TrafficLevels: array(Cities,Cities) of real
 end-declarations

 ! Result data - stored in Insight scenario
 !@insight.manage result
 public declarations
  routetaken: array(Cities,Cities) of mpvar
 end-declarations

 ! Data structures used internally in the model
 !@insight.manage ignore
 declarations
  Distances: array(Cities,Cities) of real
 end-declarations

 ! Procedure to build and solve optimization problem
 procedure runproblem
  ! Populate 'Distances' array
  if insightgetmode <> INSIGHT_MODE_NONE then
   ! Populate 'Distances' array from the remote scenario
   initializations from "mminsight.scenariodata:/DrivingDistancesModel/USDrivingDistances"
    Distances as "CityDrivingDistances"
   end-initializations
  else
   ! Model is running outside of Insight, so populate driving distances from local file
   initializations from "/Users/me/myfiles/distances.dat"
    Distances
   end-initializations
  end-if

  ! Perform optimization
  buildproblem
  optimizeproblem
 end-procedure

 !@insight.execmodes.LOAD
 public procedure doload
  loaddata
 end-procedure

 !@insight.execmodes.RUN
 public procedure dorun
  insightpopulate
  runproblem
 end-procedure

 !@insight.execmodes.NONE
 public procedure doloadandrun
  loaddata
  runproblem
 end-procedure

 insightdispatch

end-model

For clarity, the implementation of the loaddata, buildproblem and optimizeproblem procedures have been omitted from the example.