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

Working with models and accessing dynamic libraries in Mosel

Description
mmexlib.java: Working with models and accessing dynamic libraries in Mosel (requires burglari.bim, chess2.bim, trans.bim)
  • load and unload BIM models
  • run a model in Mosel
  • display information about loaded models
  • display information about additional libraries required by the loaded models
mmdispmod.java: Display the contents of a model; the information is read from a bim file
  • display run-time parameters, requirements, symbols, package/module dependencies, annotations
mmdispdso.java: Display the contents of a module
  • display constants, types, control paramters, subroutines, I/O drivers
Note that these examples require the provided mos files to be pre-compiled.

Further explanation of this example: 'Mosel Library Reference javadoc'


Source Files
By clicking on a file name, a preview is opened at the bottom of this page.
mmexlib.java[download]
mmdispmod.java[download]
mmdispdso.java[download]

Data Files





mmexlib.java

/********************************************************/
/*  Mosel Library Examples                              */
/*  ======================                              */
/*                                                      */
/*  file mmexlib.java                                   */
/*  `````````````````                                   */
/*  Example for the use of the Mosel libraries          */
/*  (working with models and accessing the dynamic      */
/*  libraries loaded by Mosel)                          */
/*                                                      */
/*  (c) 2008 Fair Isaac Corporation                     */
/*      author: S. Heipcke, 2004                        */
/********************************************************/

import com.dashoptimization.*;

public class mmexlib
{
public static void main(String[] args) throws Exception
{
 XPRM mosel;
 XPRMModel[] mod=new XPRMModel[3];

 mosel=new XPRM();                              // Initialize Mosel
 mod[0]=mosel.loadModel("Models/burglari.bim"); // Load the BIM files
 mod[1]=mosel.loadModel("Models/chess2.bim");
 mod[2]=mosel.loadModel("Models/trans.bim");

                                                // Enumerate all loaded models
                                                // and display information
 System.out.println("Models loaded:");
 for(int i=0;i<3;i++)
  System.out.println("   "+ mod[i].getNumber() +
                     ": " + mod[i].getName() +
                     " (" + mod[i].getSysComment() +
                     ", `"+ mod[i].getUserComment() +
                     "' size:"+ mod[i].getSize() +
                     ")" );

                                                // Enumerate all loaded modules
                                                // and display information
 System.out.println("Additional libraries loaded:");
 for(XPRMModules ms=mosel.modules(); ms.hasNext();)
 {
  XPRMModule m=(XPRMModule)ms.next();
  System.out.println("  "        + m.getName() +
                     " (version "+ m.getVersion() +
                     ") used by "+ m.getNumberOfReferences() +
                     " model(s)");
 }

}
}

Back to examples browserPrevious exampleNext example