[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## [Help-glpk] Converting solutions between CPlex and GLPK

**From**: |
Timon ter Braak |

**Subject**: |
[Help-glpk] Converting solutions between CPlex and GLPK |

**Date**: |
Thu, 01 Sep 2011 00:27:29 +0200 |

**User-agent**: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:6.0) Gecko/20110812 Thunderbird/6.0 |

`I have a hard mixed integer problem. Due to the size of the problem, I
``like to specify it using Mathprog. But I have CPlex to do the number
``crunching, leading to the following setup:
`
1) Use GLPK to output the problem into LP format
2) Use CPlex to solve the problem
3) Use conversion script to translate the CPlex XML solution file into
a GLPK solution file format
4) Use GLPK to 'solve' the problem with a precomputed (by CPlex)
solution, and use the nice Mathprog features again.

`The problem is step 3. I though I had cooked up something, but GLPK is
``complaining. The following is the case.
`

`CPlex gives a list of constraints and variable values. The number of
``constraints is however 1 short of the amount of rows GLPK expects. The
``number of variables corresponds precisely with the amount of columns
``GLPK expects. When I add an extra line (i.e. a '0') to the converted
``solution file, then the whole setup works, but at times the 'solution'
`becomes inconsistent.
Note that currently I am only looking at mixed integer problems (mip).
In the GLPK source code 'glp_read_mip' and 'glp_write_mip' are of interest.
What am I missing in mapping the CPlex output to the GLPK solution format?
Best regards,
Timon
CPLEX SOLUTION FILE FORMAT:

`See
``http://www.ieor.berkeley.edu/Labs/ilog_docs/html/reffileformatscplex/reffileformatscplex23.html
`
GLPK SOLUTION FILE FORMAT:
* The file created by the routine glp_write_sol is a plain text file,
* which contains the following information:
*
* m n
* stat obj_val
* r_val[1]
* . . .
* r_val[m]
* c_val[1]
* . . .
* c_val[n]
*
* where:
* m is the number of rows (auxiliary variables);
* n is the number of columns (structural variables);
* stat is the solution status (GLP_UNDEF = 1, GLP_FEAS = 2,
* GLP_NOFEAS = 4, or GLP_OPT = 5);
* obj_val is the objective value;
* r_val[i], i = 1,...,m, is the value of i-th row;
* c_val[j], j = 1,...,n, is the value of j-th column. */

**[Help-glpk] Converting solutions between CPlex and GLPK**,
*Timon ter Braak* **<=**