[Cbc] change matrix coefficient at coin-cbc.
Stefan Vigerske
stefan at math.hu-berlin.de
Fri Sep 7 05:18:22 EDT 2012
Hi,
OsiCbc is a bad choice for accessing Cbc, because it gives only poor
performance and is not really maintained anymore.
A more efficient way that gives you performance close to the standalone
binary is to use the CbcSolver interface as shown in
Cbc/examples/driver4.cpp.
For that, you create your MIP in an OsiClpSolverInterface lp and then
solve it by Cbc via
const char* args[] = { "mybin", "-solver", "-quit" };
CbcModel* model = new CbcModel(lp);
CbcMain0(model);
CbcMain1(3, args, *model);
OsiClpSolverInterface implements getMutableMatrixByCol, which should be
sufficient.
Hope this helps,
Stefan
On 09/06/2012 07:56 PM, Ivan Meireles Costa wrote:
> oh, sry.
>
> the lp declaration is:
>
> OsiCbcSolverInterface *lp;
>
> On Thu, Sep 6, 2012 at 2:49 PM, Ivan Meireles Costa <ivan.costa at gapso.com.br
>> wrote:
>
>> Hi guys,
>>
>> I'm working on my first project with coin-or cbc and have one problem to
>> change a coefficient in the matrix in my OsiCbcSolverInterface.
>> I've tried:
>>
>> bool OPT_COIN::chgCoef( int row, int col, double newcoef )
>> {
>> bool ret = true;
>> CoinPackedMatrix *matrix = lp->getMutableMatrixByRow();
>>
>>
>>
>> if(matrix == NULL)
>> {
>> printf("\n\n\nNULL\n\n\n");
>> }
>> matrix->modifyCoefficient(row, col, newcoef);
>>
>>
>> return ret;
>> }
>>
>> but the method "getMutableMatrixByRow()" is not yet implemented, it return
>> NULL.
>>
>> thanks
>>
>>
>>
>>
>> --
>> *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
>>
>
>
>
>
>
> _______________________________________________
> Cbc mailing list
> Cbc at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/cbc
>
More information about the Cbc
mailing list