[Cbc] Failure to satisfy an SOS2 constraint
John Forrest
john.forrest at fastercoin.com
Mon Mar 11 05:50:54 EDT 2013
Alexis,
I have (possibly) fixed preprocessing with SOS. Have you a realistic
problem I can test?
John Forrest
On 10/03/13 18:03, John Forrest wrote:
> Alexis,
>
> SOS seems to be a bit of a mess at present. It looks as if writeLP
> can't write SOS. writeMps can but only if they were added as part of
> an Osi object not directly into CbcModel!
>
> Was your code compiled optimized? It should work using CbcMain0 but
> a) there was a bug so you couldn't pass in options properly. I have
> fixed in stable. CbcMain1 does work.
> b) In debug mode SOS triggers an assert in preprocessing. Optimized
> there would not have been an assert but it probably failed - hence
> your result.
>
> As I said - a mess.
>
> I will look at preprocess assert. Can you try using CbcMain1 or fixed
> CbcMain0 and pass in
> -preprocess off -solve
>
> and see if that works.
>
> John Forrest
>
>
> On 08/03/13 22:18, Alexis Guigue wrote:
>> Hi,
>>
>> This is kind of a follow-up of my previous email <<Problem writing
>> SOS2 constraint in the Lp file>>.
>> Here is the code again!
>>
>> ------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>
>> // Create an OsiClpSolverInterface object
>> OsiClpSolverInterface m_osiClpSolver;
>>
>> // Populate the solver
>> m_osiClpSolver.loadProblem(matrix, &m_vColLower[0], &m_vColUpper[0],
>> &m_vObjCoef[0], &m_vSign[0], &m_vRHS[0], 0);
>>
>> // Set continuous variables
>> m_osiClpSolver.setContinuous(&m_vContVarIndex[0],
>> (int)m_vContVarIndex.size());
>>
>> // Set column and row names
>> m_osiClpSolver.setIntParam(OsiNameDiscipline,2);
>> for(int i=0;i<(int)m_vRowName.size();i++)
>> m_osiClpSolver.setRowName(i,m_vRowName[i]);
>> for(int i=0;i<(int)m_vColName.size();i++)
>> m_osiClpSolver.setColName(i,m_vColName[i]);
>>
>> // Create the CbcModel object
>> CbcModel cbcModel(m_osiClpSolver);
>>
>> // Add sos2 constraint to CbcModel
>> cbcModel.addObjects(...,...);
>>
>> // Optimize
>> cbcModel.branchAndBound();
>>
>> ------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>
>>
>> This was my first version. I have a function after the optimization
>> is completed that checks
>> that my SOS2 constraints are satisfied. It passes the test when I use
>> cbcModel.branchAndBound();
>>
>> Now, I replace cbcModel.branchAndBound() with (standalone version)
>>
>> CbcMain0(cbcModel);
>> callCbc1("-solve -quit", cbcModel);
>>
>> One of my SOS2 constraint is not satisfied now. I have the impression
>> that the SOS2 constraints
>> were not part of the optimization problem in the first place, this
>> would explain why I am getting
>> at least not satisfied.
>>
>> Is my standalone code incorrect?
>>
>> Thanks in advance.
>>
>> Cheers
>>
>> Alexis
>>
>
> _______________________________________________
> Cbc mailing list
> Cbc at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/cbc
>
>
More information about the Cbc
mailing list