FICO
FICO Xpress Optimization Examples Repository
FICO Optimization Community FICO Xpress Optimization Home
Back to examples browserNext example

Dynamic package loading

Description
This example shows how to work with dynamic package loading in order to allow endusers to modify the definition of an optimization problem without disclosing the actual model source:
  1. Compile the package template in usrpkgtempl.mos into usrpkg.bim
  2. Compile the main model in foliomipusrpkg.mos
  3. Share the BIM files and the source of usrpkgtempl.mos with end users
  4. Compile the completed package in usrpkg.mos
  5. Run the compiled model (without recompilation) in foliomipusrpkg.bim with the new version of the package in usrpkg.bim


Source Files
By clicking on a file name, a preview is opened at the bottom of this page.
foliomipusrpkg.mos[download]
usrpkg.mos[download]
usrpkgtempl.mos[download]

Data Files





usrpkgtempl.mos

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

   file usrpkgtempl.mos
   ````````````````````
   Entry point template for user constraint definition  
   -- Defining entry points (subroutine called by main model)
      and usable entities from the main model (requirements) --

   Compile to file 'usrpkg.bim'   
   
  (c) 2021 Fair Isaac Corporation
      author: S.Heipcke, Apr. 2021
*******************************************************!)
package usrpkg
  uses "advmod"
    ! Any libraries loaded here also need to be loaded by the main model

 ! Entities from main model available to this package
 ! (this results in an implicit 'public' declaration of these entities)
  requirements
    Return,LimRisk: linctr
    SHARES: set of string
    frac: array(SHARES) of mpvar 
  end-requirements

  public procedure userctrdef
    writeln("Add user constraint definitions here")
  end-procedure
end-package

Back to examples browserNext example