Login

Generate an MPS file (free MPS format) for cash flow matching problem

Here are an example for illustrating how the scripts generate_p.py and generate_mps.py can be used under *nix environment (requires Python 2.4 or 2.5). Problem formulation can be found here.

You may download data files descrbied in the paper here: c.dat/l.dat

The following commands assume that both the script and data are in the current directory.

To simulate bond prices data file for the problem:

$ python generate_p.py c.dat -T 60 -q 2 -a 0.24 -s 0.02 -A 0.08 -B 0.005 -C 0.3 -N 1000 > price.dat

To generate an MPS file for problem with confidence level of 0.95:

$ python generate_mps.py -T 60 -q 2 -c c.dat -l l.dat -p price.dat -e 0.05 -N 1000 > cashflow.mps

Now that we have generated cashflow.mps. We can solve the optimization problem with various solvers.

MOSEK

MOSEK is a commercial solver. It has a simple command line tool for solving LP problem in free MPS format:

$ mosek -min -d MSK_IPAR_READ_MPS_FORMAT MSK_MPS_FORMAT_FREE cashflow.mps

A file cashflow.sol is then written.

CPLEX

CPLEX is another commercial solver. It provides an interactive command line tool:

$ cplex

Then we are in CPLEX Interactive Optimizer:

CPLEX> read cashflow.mps

then

CPLEX> optimize

GLPK

GLPK is a free solver. To solve the problem with GLPK:

$ glpsol --freemps --min -o out.txt cashflow.mps

The output is then saved in out.txt.