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

Declaring a static module

Description
Declaring a static module (the module is embedded in the program instead of being a dso file) and initializing an array from data stored in the C program.

The same functionality can be obtained by using I/O drivers instead of a static module (see second version of the program in file mmstatdsoio.c).

Further explanation of this example: 'Mosel Native Interface User Guide', Chapter 6 Defining a static module


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

Data Files





mmstatdsoio.c

/********************************************************
   Mosel Library Examples 
   ======================  
  
   file mmstatdsoio.c  
   ``````````````````  
   Example for the use of the Mosel libraries   
   (using I/O drivers instead of a static module for  
    initializing a Mosel array from data stored in C) 
                
   (c) 2008 Fair Isaac Corporation  
       author: S. Heipcke, 2005, rev. Feb. 2017 
********************************************************/

#include <stdio.h>
#include "xprm_mc.h"


/*****************/
/* Main function */
/*****************/
int main()
{
 XPRMmodel mod;
 int result;
 char params[80];
 static int tabinit[]= {23,78,45,90,234,111,900,68,110};


 if(XPRMinit())
  return 1;

 /* Compile the model source */
 if(XPRMcompmod("", "meminitio.mos", NULL, NULL))
  return 2;
 
 /* Load the BIM file */
 if((mod=XPRMloadmod("meminitio.bim", NULL))==NULL)
  return 3;

 /* Parameters: the address of the data table and its size */
 sprintf(params, "MEMDAT='noindex,mem:%p/%u'", tabinit,
         sizeof(tabinit));

 /* Run the model */
 if(XPRMrunmod(mod, &result, params))
  return 4;

 return result;
}


Back to examples browserPrevious exampleNext example