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

Folio - Embedding examples from 'Getting started'

Simple embedding tasks for a portfolio optimization problem:
  • loading and running a BIM file (foliorun.c)
  • executing a Mosel model (folioexec.c)
  • parameterized model execution (folioparam.c)
  • exporting a matrix (foliomat.c)
  • accessing model results (folioobj.c)
  • data exchange in memory (runfolio.c,runfoliod.c)
  • retrieving solution output from Optimizer callbacks in foliocbio.mos during optimization (runfoliocbio.c)[download all files]

Source Files

Data Files


  Mosel Library Example Problems

  file foliomat.c
  Exporting a matrix.

  (c) 2008 Fair Isaac Corporation
      author: S.Heipcke, Aug. 2003

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

int main(int argc, char *argv[])
  int result, type;
  XPRMmodel model;
  XPRMalltypes rvalue;
  XPRMlinctr obj;
  XPRMinit();                        /* Initialize Mosel */
                                     /* Execute = compile/load/run a model */
  XPRMexecmod(NULL, "foliodata.mos", NULL, &result, &model);

                                     /* Retrieve a model object by its name */
  type = XPRMfindident(model, "Return", &rvalue);
  if((XPRM_TYP(type)!=XPRM_TYP_LINCTR)||  /* Check the type: */
     (XPRM_STR(type)!=XPRM_STR_REF))      /* it must be a reference to a linear
                                             constraint */
   return 1;
  obj = rvalue.linctr;               /* Store the objective function reference */

  XPRMexportprob(model, "p", "folio", obj);

  return 0;

Back to examples browserNext example