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

Using the model return value for error handling

Description
The default return value of a Mosel model at the end of its execution is 0. Other values may be set with the procedure exit as shown in the file exitvalue.mos. The model return values can be used by the calling application (exitvalue.c, runexitvalue.mos) for the implementation of error handling routines.


Source Files
By clicking on a file name, a preview is opened at the bottom of this page.
exitvalue.mos[download]
exitvalue.c[download]
runexitvalue.mos[download]





runexitvalue.mos

(!*******************************************************
   Mosel Example Problems 
   ======================

   file runexitvalue.mos
   `````````````````````
   Example of the use of `exit' for error handling in
   Mosel applications.
       
   (c) 2017 Fair Isaac Corporation
       author: S. Heipcke, June 2017
*******************************************************!)

model "Run exitvalue"
 uses "mmjobs"

 parameters
  FILENAME = "exitvalue"
 end-parameters

 declarations
  submod: Model
 end-declarations
                                   
 if compile(FILENAME+".mos")<>0 then exit(1); end-if  ! Compile the model file
 load(submod, FILENAME+".bim")                        ! Load the bim file
 run(submod)                                          ! Run the model
 wait

 case getexitcode(submod) of
  0: writeln("Integer solution found")
  1: writeln("LP infeasible")
  2: writeln("No integer solution")
 end-case

end-model 

Back to examples browserPrevious exampleNext example