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
public declarations
Cities: set of string
Distances: array(Cities,Cities) of real
TrafficLevels: array(Cities,Cities) of real
routetaken: array(Cities,Cities) of mpvar
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
case insightgetmode of
INSIGHT_MODE_LOAD: do
loaddata
end-do
INSIGHT_MODE_RUN: do
insightpopulate
runproblem
end-do
INSIGHT_MODE_NONE: do
loaddata
runproblem
end-do
else
writeln("Unknown execution mode")
end-case
end-model For clarity, the implementation of the loaddata, buildproblem and optimizeproblem procedures have been omitted from the example.
© 2001-2019 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.
