Getting Started examples
This directory contains the introductory examples described in the 'Getting Started with Xpress' manual and more advanced
examples referenced in the 'Advanced Evaluators Guide'.
|
|
|
Examples of using the Mosel language and the Mosel libraries.
|
| Getting Started |
|
|
| Folio - Modelling examples from 'Getting started': LP, MIP and QP models, data input/output, user graphs, heuristics
|
| |
|
| Type: |
Portfolio optimization |
| Rating: |
2 (easy-medium) |
| Description: |
- Chapter 3 Inputting and Solving a Linear Programming problem
- foliolp.mos: modeling and solving a small LP problem
- foliolperr.mos: LP model with syntax errors
- foliolps.mos: LP model using string indices
- Chapter 4 Working with data
- foliodata.mos (data file: folio.dat): data input from file, result
output to a file, model parameters
- folioodbc.mos (data files: folio.xls, folio.mdb, folio.sqlite): data input
from a spreadsheet or database, result output to a spreadsheet or database,
model parameters
- folioexcel.mos (data file: folio.xls): same as folioodbc.mos but
with Excel-specific data input and output (Windows only)
- foliosheet.mos (data file: folio.xls): same as folioodbc.mos but
with data input and output through generic spreadsheet access
- foliocsv.mos (data file: folio.csv): same as folioodbc.mos but
with data input and output through generic spreadsheet access in CSV format
- Chapter 5 Drawing user graphs
- folioloop.mos (data files: folio.dat, foliodev.dat): re-solving with
varied parameter settings
- folioloop_graph.mos (data files: folio.dat, foliodev.dat): re-solving with
varied parameter settings, graphical solution display
- foliolps_graph.mos: same as foliolps, adding graphical solution display
- Chapter 6 Mixed Integer Programming
- foliomip1.mos (data file: folio.dat): modeling and solving a small
MIP problem (binary variables)
- foliomip2.mos (data file: folio.dat): modeling and solving a small
MIP problem (semi-continuous variables)
- Chapter 7 Quadratic Programming
- folioqp.mos (data file: folioqp.dat): modeling and solving a QP and
a MIQP problem
- folioqp_graph.mos (data files: folioqp.dat, folioqpgraph.dat):
re-solving a QP problem with varied parameter settings, graphical solution
display
- folioqc.mos (data file: folioqp.dat): modeling and solving a QCQP and
- foliomiqc.mos (data file: folioqp.dat): modeling and solving a MIQCQP
- Chapter 8 Heuristics
- folioheur.mos (data file: folio.dat): heuristic solution of a MIP problem
|
| File(s): |
foliolp.mos, foliolperr.mos, foliolps.mos, foliolps_graph.mos, foliodata.mos, folioodbc.mos, folioexcel.mos, foliosheet.mos, foliocsv.mos, folioloop.mos, folioloop_graph.mos, foliomip1.mos, foliomip2.mos, folioqp.mos, folioqp_graph.mos, folioqc.mos, foliomiqc.mos, folioheur.mos |
| Data file(s): |
folio.dat, folio.csv, foliodev.dat, folioqp.dat, folioqpgraph.dat, folio.xls, folio.mdb, folio.sqlite |
|
|
| Folio - Embedding examples from 'Getting started': C, C#, Java and VBA programs, Insight apps
|
| |
|
| Type: |
Portfolio optimization |
| Rating: |
2 (easy-medium) |
| Description: |
- Chapter 9 Embedding a Mosel model in an application
- folioexec.bas, folioexec.c, folioexec.java, folioexec.cs
(requires foliodata.mos and folio.dat): executing a Mosel model
- foliorun.bas, foliorun.c, foliorun.java, foliorun.cs
(requires foliodata.bim and folio.dat): loading and running a BIM file
- folioparam.bas, folioparam.c, folioparam.java, folioparam.cs
(requires foliodata.mos and folio.dat): parameterized model execution
- foliomat.c, foliomat.java, foliomat.cs (requires foliodata.mos and folio.dat):
matrix output
- folioobj.c, folioobj.java, folioobj.cs (requires foliodata.mos and folio.dat):
accessing model results
- runfolio.xlsm (requires folioexcel.mos):
launching a Mosel model from Excel via VBA marcos (Windows only)
- folioinsight.zip (contains folioinsight.mos), folioinsightxml.zip (contains folioinsightxml.mos, folio.vdl, foliocompare.vdl,
folioinsightxml.xml):
Insight apps based on the 'foliodata' model (Windows only)
|
| File(s): |
foliorun.c, folioexec.c, folioparam.c, foliomat.c, folioobj.c, foliorun.cs, folioexec.cs, folioparam.cs, foliomat.cs, folioobj.cs, foliorun.java, folioexec.java, folioparam.java, foliomat.java, folioobj.java, foliorun.bas, folioexec.bas, folioparam.bas, foliodata.mos, folioexcel.mos, folioinsight.mos, folioinsightxml.mos, folio.vdl, foliocompare.vdl, folioinsightxml.xml |
| Data file(s): |
folio.dat, runfolio.xlsm, folioinsight.zip, folioinsightxml.zip |
|
|
|
| Advanced Topics (Evaluators Guide) |
|
|
| Folio - Advanced modelling and solving tasks: Multiple MIP solutions, infeasibility handling, data transfer in memory, remote execution, XML and JSON data formats, solver
tuning
|
| |
|
| Type: |
Portfolio optimization |
| Rating: |
3 (intermediate) |
| Description: |
Advanced modelling and solving tasks for a portfolio optimization problem:
- Automated solver tuning (foliolptune.mos)
- Defining an integer solution callback (foliocb.mos, callback specification by name: foliocbm.mos; using an 'mpsol' object:
foliocb_sol.mos)
- Using the solution enumerator for multiple MIP solutions (folioenumsol.mos)
- Handling infeasibility
- handling infeasibility through deviation variables (folioinfeas.mos)
- retrieving infeasible row/column from presolve (folioinfcause.mos)
- retrieving IIS - LP, MIP, NLP infeasible (folioiis.mos, foliomiis.mos, folionliis.mos)
- using the built-in infeasibility repair functionality (foliorep.mos)
- same as foliorep, using an 'mpsol' object (foliorep_sol.mos)
- Data transfer in memory
- running foliomemio.mos with data transfer in memory (runfolio.mos)
- same running foliomemio2.mos, grouping tables with identical
index sets in "initializations" blocks (runfolio2.mos)
- main model running several model instances in parallel (runfoliopar.mos)
- Remote models on a distributed architecture
- running foliomemio.mos on a remote instance of Mosel (runfoliodistr.mos)
- main model running several model instances in parallel,
each on a different (remote) instance of Mosel (runfoliopardistr.mos)
- Remote execution via XPRD
- See examples in the Mosel Whitepapers directory moselpar/XPRD
- XML and JSON data formats
- reading data from an XML file,
solution output in XML format on screen and to a new file (folioxml.mos, folioxmlqp.mos)
- generate HTML output file as an XML document (runfolioxml.mos)
- using JSON-format data files, reading data from a JSON file,
solution output in JSON format on screen and to a new file (foliojson.mos)
- HTTP
- starting an HTTP server managing requests from HTTP clients (foliohttpsrv.mos)
- HTTP client exchanging XML data
files with an HTTP server (foliohttpclient.mos)
|
| File(s): |
foliomip3.mos, foliomemio.mos, foliomemio2.mos, foliocbio.mos, foliocb.mos, foliocb_sol.mos, foliocbm.mos, folioenumsol.mos, folioinfeas.mos, folioinfcause.mos, folioiis.mos, foliomiis.mos, folionliis.mos, foliolptune.mos, foliorep.mos, foliorep_sol.mos, runfolio.mos, runfolio2.mos, runfoliopar.mos, runfoliodistr.mos, runfoliopardistr.mos, folioxml.mos, folioxmlqp.mos, runfolioxml.mos, foliojson.mos, foliohttpsrv.mos, foliohttpclient.mos |
| Data file(s): |
folio5.dat, folio10.dat, folio250.dat, folioqp.dat, folio.xml, folioqp.xml, folioqpvar.xml, folio.json |
|
|
| Dynamic package loading: dynamic package loading, model compilation, BIM file
|
| |
|
| Type: |
Portfolio optimization |
| Rating: |
3 (intermediate) |
| Description: |
This example shows how to work with dynamic package loading in order to allow endusers to modify the definition of an optimization
problem without disclosing the actual model source:
- Compile the package template in usrpkgtempl.mos into usrpkg.bim
- Compile the main model in foliomipusrpkg.mos
- Share the BIM files and the source of usrpkgtempl.mos with end users
- Compile the completed package in usrpkg.mos
- Run the compiled model (without recompilation) in foliomipusrpkg.bim with the new version of the package in usrpkg.bim
|
| File(s): |
foliomipusrpkg.mos, usrpkg.mos (library, compile separately), usrpkgtempl.mos (library, compile separately) |
| Data file(s): |
folio.dat |
|
|
| Folio - Advanced embedding tasks: Data exchange in memory
|
| |
|
| Type: |
Portfolio optimization |
| Rating: |
2 (easy-medium) |
| Description: |
Simple embedding tasks for a portfolio optimization problem:
- run foliomemio.mos (foliorun.c, runfolio.cs, runfolio.java)
- run foliomemio2.mos grouping tables with identical
index sets in "initializations" blocks (runfolio2.c, runfolio2.cs, runfolio2.java)
- run foliomemio.mos, passing data through
buffers (runfoliob.cs, runfoliob.java)
- application to run foliomemio.mos using data callbacks (runfoliod.c, runfoliod.java)
- retrieving solution output from Optimizer
callbacks in foliocbio.mos during optimization (runfoliocbio.c, runfoliocbio.cs, runfoliocbio.java)
|
| File(s): |
foliomemio.mos, foliomemio2.mos, foliocbio.mos, foliorun.c, runfolio2.c, runfoliod.c, runfoliocbio.c, runfolio.cs, runfolio2.cs, runfoliob.cs, runfoliocbio.cs, runfolio.java, runfolio2.java, runfoliob.java, runfoliod.java, runfoliocbio.java |
|
|
|
|
|
Introductory examples using the Python interface.
|
| Getting Started |
|
|
| Folio - Introductory examples from 'Getting Started': LP, MIP and QP models, explicit initialization, index sets, heuristic solution
|
| |
|
| Type: |
Portfolio optimization |
| Rating: |
2 (easy-medium) |
| Description: |
Simple tasks for formulating and solving a portfolio optimization problem:
- inputting an LP problem from data arrays (Folio.py)
- inputting a MIP problem - binary variables (FolioMIP1.py)
- inputting a MIP problem - semicontinuous variables (FolioMIP2.py)
- inputting a QC problem (FolioQC.py)
- inputting a QP problem (FolioQP.py)
- inputting a problem using heuristics (FolioHeuristic.py)
|
| File(s): |
Folio.py, FolioMIP1.py, FolioMIP2.py, FolioQC.py, FolioQP.py, FolioHeuristic.py |
| Data file(s): |
foliocppqp.csv |
|
|
| Folio - Insight example from 'Getting started': Python Insight app
|
| |
|
| Type: |
Portfolio optimization |
| Rating: |
2 (easy-medium) |
| Description: |
- The files application.py, folio.vdl, foliocompare.vdl, and folioinsightxml.xml need to form an archive folioinsightxml.zip
with the directory structure required by Insight in order to be loaded into Insight. This
Insight app is described in Chapter 14 Embedding a Python model in an application of the guide 'Getting started with Xpress'.
|
| File(s): |
application.py, folio.vdl, foliocompare.vdl, folioinsightxml.xml |
| Data file(s): |
shares.csv |
|
|
|
| Xpress Optimizer examples |
|
|
Introductory examples of using the Xpress Optimizer library.
|
| Getting Started |
|
|
| Folio - Examples from 'Getting started': LP, MIP and QP models, explicit initialization, index sets, heuristic solution
|
| |
|
| Type: |
Portfolio optimization |
| Rating: |
2 (easy-medium) |
| Description: |
- Chapter 19 Matrix input
- folioinput.c (requires Folio.mps): loading an LP problem via matrix input
- Chapter 20 Inputting and Solving a Linear Programming problem
- foliolp.c: loading a small LP problem via XPRSloadlp
- Chapter 21 Mixed Integer Programming
- foliomip1.c: loading a small MIP problem via XPRSloadmip (binary variables)
- foliomip2.c: loading a small MIP problem via XPRSloadmip (semi-continuous
variables)
- Chapter 22 Quadratic Programming
- folioqp.c: loading a small QP problem via XPRSloadqp
|
| File(s): |
folioinput.c, foliolp.c, foliomip1.c, foliomip2.c, folioqp.c |
| Data file(s): |
Folio.mps |
|
|
|
|
|