[Cbc] writeLp and writeMps (OsiCbcSolverInterface)

Ivan Meireles Costa ivan.costa at gapso.com.br
Tue Sep 25 11:13:47 EDT 2012


Hi guys,

I'm using the following methods to print my model. (OsiCbcSolverInterface)

MPS:
getModel()->solver()->writeMps(filename);
LP:
getModel()->solver()->writeLp(filename);

but, after making a change in the coefficient matrix of the constraints and
make the new print file in LP format remains the same while the MPS suffers the
appropriate changes.

what do I do?

i'm using the following methods to chage the coefficient:

bool OPT_COIN::chgCoef( int row, int col, double newcoef )
> {
>     bool ret = true;
>     CbcModel *model = getModel();
>     CoinPackedMatrix *matrix = lp->getMutableMatrixByCol();
>     matrix->modifyCoefficient(row, col, newcoef);
>     model->synchronizeModel();
>     return ret;
> }
>

and this:

     /// Get pointer to mutable column-wise copy of matrix
>     inline CoinPackedMatrix * getMutableMatrixByCol() const {
>         return solver_->getMutableMatrixByCol();
>     }
>

*
first MPS:*

NAME          BLANK     FREE
ROWS
 N  OBJROW
 L  constraint0
 L  constraint1
COLUMNS
    x0 OBJROW 200.         constraint0 1.
    x0 constraint1  -100.
    x1 OBJROW  -20.        constraint0 12.
    x1 constraint1 1.
    x2 OBJROW  -5.         constraint0 9.
RHS
    RHS constraint0 100.
BOUNDS
 BV BOUND x0 1.
 UI BOUND x1 35.
 UP BOUND x2        1e+10
ENDATA

*second MPS (after change):*

NAME          BLANK     FREE
ROWS
 N  OBJROW
 L  constraint0
 L  constraint1
COLUMNS
    x0 OBJROW 200.         constraint0 15.
    x0 constraint1 15.
    x1 OBJROW  -20.        constraint0 15.
    x1 constraint1 15.
    x2 OBJROW  -5.         constraint0 15.
RHS
    RHS constraint0 100.
BOUNDS
 BV BOUND x0 1.
 UI BOUND x1 35.
 UP BOUND x2        1e+10
ENDATA

*File LP before and after change.:*

\Problem name:

Minimize
OBJROW: 200 x0 -20 x1 -5 x2
Subject To
constraint0:  x0 + 12 x1 + 9 x2 <= 100
constraint1:  -100 x0 + x1 <= 0
Bounds
 0 <= x0 <= 1
 0 <= x1 <= 35
 0 <= x2 <= 10000000000
Integers
x0 x1
End

-- 
*Ivan Meireles Costa*
*Estágiario em otimização*
 *Telefone:* 31 3508-1323
 *Celular:* 31 9869-6987
   A Gapso é a escolha das empresas que buscam se diferenciar pela gestão
da complexidade.
Desenvolvemos sistemas analíticos de planejamento, que auxiliam a definir
estratégias,
planejar operações, reduzir riscos e lidar melhor com as incertezas do
futuro.
www.gapso.com.br
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cbc/attachments/20120925/bcfce3d9/attachment.html>


More information about the Cbc mailing list