[Clp] constant in MPS objective
William H. Patton
pattonwh at comcast.net
Sun Feb 15 10:40:41 EST 2009
CLP interprets a constant in the objective with the opposite sign compared
to lp_solve and glpsol. I think they got it right.
NAME ex1c
ROWS
N OBJROW
L C1
L R2
COLUMNS
x1 OBJROW 1. C1 2.
x1 R2 -4.
x2 OBJROW -2. C1 1.
x2 R2 4.
RHS
RHS OBJROW +10. C1 5.
RHS R2 5.
ENDATA
Or
NAME ex1b
ROWS
N OBJROW
L C1
L R2
COLUMNS
x1 OBJROW 1. C1 2.
x1 R2 -4.
x2 OBJROW -2. C1 1.
x2 R2 4.
RHS
RHS OBJROW -10. C1 5.
RHS R2 5.
ENDATA
Solve oppositely to lp_solve
Clp:import ex1b.MPS
At line 1 NAME ex1b
At line 2 ROWS
At line 6 COLUMNS
At line 11 RHS
At line 14 ENDATA
Problem ex1b has 2 rows, 2 columns and 4 elements
Model was imported from .\ex1b.MPS in 0 seconds
Clp:solve
0 Obj 10 Dual inf 2 (1)
2 Obj 6.25
Optimal - objective value 6.25
Optimal objective 6.25 - 2 iterations time 0.002
Clp:
Clp:import ex1c.MPS
At line 1 NAME ex1c
At line 2 ROWS
At line 6 COLUMNS
At line 11 RHS
At line 14 ENDATA
Problem ex1c has 2 rows, 2 columns and 4 elements
Model was imported from .\ex1c.MPS in 0 seconds
Clp:solve
0 Obj -10 Dual inf 2 (1)
2 Obj -13.75
Optimal - objective value -13.75
Optimal objective -13.75 - 2 iterations time 0.002
Clp:
==============================================
\Jun>lp_solve -mps ex1b.mps
Value of objective function: -13.75000000
Actual values of the variables:
x1 1.25
x2 2.5
\Jun>lp_solve -mps ex1c.mps
Value of objective function: 6.25000000
Actual values of the variables:
x1 1.25
x2 2.5
\Jun>
==============================================
\glpk\glpk-4.8>glpsol ex1b.mps
lpx_read_mps: reading problem data from `ex1b.mps'...
lpx_read_mps: problem ex1b
lpx_read_mps: 3 rows, 2 columns, 6 non-zeros
lpx_read_mps: 14 cards were read
lpx_simplex: original LP has 3 rows, 2 columns, 6 non-zeros
lpx_simplex: presolved LP has 2 rows, 2 columns, 4 non-zeros
lpx_adv_basis: size of triangular part = 2
* 0: objval = -1.000000000e+001 infeas = 0.000000000e+000 (0)
* 2: objval = -1.375000000e+001 infeas = 0.000000000e+000 (0)
OPTIMAL SOLUTION FOUND
Time used: 0.0 secs
Memory used: 0.1M (91756 bytes)
\glpk\glpk-4.8>
\glpk\glpk-4.8>glpsol ex1c.mps
lpx_read_mps: reading problem data from `ex1c.mps'...
lpx_read_mps: problem ex1c
lpx_read_mps: 3 rows, 2 columns, 6 non-zeros
lpx_read_mps: 14 cards were read
lpx_simplex: original LP has 3 rows, 2 columns, 6 non-zeros
lpx_simplex: presolved LP has 2 rows, 2 columns, 4 non-zeros
lpx_adv_basis: size of triangular part = 2
* 0: objval = 1.000000000e+001 infeas = 0.000000000e+000 (0)
* 2: objval = 6.250000000e+000 infeas = 0.000000000e+000 (0)
OPTIMAL SOLUTION FOUND
Time used: 0.0 secs
Memory used: 0.1M (91756 bytes)
\glpk\glpk-4.8>
William
More information about the Clp
mailing list