| |||||||||
Folio - Embedding examples from 'Getting started' Description Simple embedding tasks for a portfolio optimization problem:
Source Files By clicking on a file name, a preview is opened at the bottom of this page. Data Files foliomat.c /******************************************************** 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 */ /* Output the LP/MIP problem (or the portion of a problem that is specified * via mpvar+linctr only, ignoring solver-specific extensions such as * indicators or general constraints) */ XPRMexportprob(model, "p", "folio", obj); return 0; } | |||||||||
© Copyright 2024 Fair Isaac Corporation. |