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

Running Mosel models from MATLAB

Description
Simple models to illustrate the interface:
  • example_m1: trivial Mosel program to be executed from MATLAB
  • example_m2: Mosel program that uses the MATLAB I/O driver
  • example_m3: MATLAB script embedding a Mosel program
  • example_m4: pass data from MATLAB to Mosel via an 'initializations' block
  • example_m5: Mosel retrieving a MATLAB sparse matrix
  • example_m6: MATLAB using the Mosel Java interface


Source Files





example_m3.m

%*******************************************************
%  Mosel Matlab Example Problems
%  =============================
%
%  file example_m3.m
%  ``````````````````
%  Executing a Mosel program contained
%  in a MATLAB cell array of strings
%
% (c) 2014 Fair Isaac Corporation
%     author: L.Bertacco, Apr. 2014, rev. Sep. 2017
%*******************************************************

mos={
'model "example_m3"        '
' uses "mmxprs", "mmnl";   '
' declarations             '
'  a:mpvar                 '
' end-declarations         '
' minimize(a*a-5*a+10)     '
' writeln(getobjval)       '
'end-model                 '
};
moselexec('matlab.mws:mos')

Back to examples browserNext example