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-modelFor clarity, the implementation of the loaddata, buildproblem and optimizeproblem procedures have been omitted from the example.
© 2001-2022 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.
