FICO
FICO Xpress Optimization Examples Repository
FICO Optimization Community FICO Xpress Optimization Home
Back to examples browserPrevious exampleNext example

Solving a non-fixed Mosel model using a REST webservice, from Mosel

Description
In this example, the Xpress Executor should first be configured with the runzippedsubmodel.mos model. Then, you run the blendxe.mos model locally; this uses REST webservice requests to send the blend3c model and blend.csv file to the Xpress Executor and remotely solve the model using this, then downloads and displays the results. This demonstrates how the Xpress Executor can be used to run many different models. This example requires a local installation of Xpress.

executor_rest_mosel_nonfixed.zip[download all files]

Source Files
By clicking on a file name, a preview is opened at the bottom of this page.
runzippedsubmodel.mos[download]
blendxe.mos[download]
blend3c.mos[download]

Data Files





runzippedsubmodel.mos

(!******************************************************
   Xpress Executor Example Model
   =============================

   file runzippedsubmodel.mos
   ``````````````````````````
   Unzip input to local directory, and run submodel.mos

   (c) 2017 Fair Isaac Corporation
       author: J.Farmer, Jul. 2017
*******************************************************!)

model "Zipped Model Runner"
 uses  "mmsystem","mmjobs"

 parameters
  SUBMODEL_PARAMS=''
 end-parameters

 declarations
  submodel: Model
 end-declarations

 ! Unzip input file
 writeln("Unzipping input file")
 unzip("input")
 if getsysstat<>0 then
  writeln("FAILED to unzip input file")
  exit(1)
 end-if

 ! Load submodel
 writeln("Loading submodel.bim")
 load(submodel, "submodel.bim")

 ! Execute submodel
 writeln("Starting submodel")
 run(submodel,SUBMODEL_PARAMS)

 ! Wait for submodel to complete
 wait
 evt := getnextevent
 if evt.class<>EVENT_END then
  writeln("Unexpected event ",evt.class)
  exit(2)
 end-if

 ! Check submodel completion
 writeln("Submodel completed")
 if getstatus(submodel)<>RT_OK then
  writeln("Error ",getstatus(submodel)," within submodel")
  exit(3)
 end-if

 exit(getexitcode(submodel))
end-model







end-model
Back to examples browserPrevious exampleNext example