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

Writing packages: definition of constant symbols, subroutines, types, and parameters

Description
Packages are libraries written in the Mosel language that extend the language with
  • constant symbols (myconstants.mos)
  • subroutines (definition of several overloaded versions of a procedure in solarraypkg.mos, generic implementation using union types and iterator in solarrayanypkg.mos)
  • types (definition of a structure 'arc' to represent arcs in a network with a function to access information: arcpkg.mos)
  • parameters (definition of real/integer/string/boolean valued package parameters: parpkg.mos)
Further explanation of this example: 'Mosel User Guide', Chapter 16 Packages


Source Files

Data Files





params_test.mos

(!******************************************************
   Mosel User Guide Example Problems
   ================================= 

   file params_test.mos
   ````````````````````
   Working with package parameters.

   *** Compile parpkg.mos before running this model ****
   
   (c) 2018 Fair Isaac Corporation
       author: Y. Colombani, May 2018
*******************************************************!)
model "Packages with parameters"
 uses 'parpkg'

 ! Display default parameter values
 writeln("Default values:", 
   " p1=", getparam("parpkg.P1"), " p2=", getparam("P2"), 
   " p3=", getparam("parpkg.p3"), " p4=", getparam("p4"))

 ! Change values
 setparam("p1",133); setparam("parpkg.p2",-77)
 setparam("P3","tluafed"); setparam("parpkg.P4",not getparam("parpkg.P4"))

end-model

Back to examples browserPrevious exampleNext example