[Osi] please provide a code snippet for sos constraints
Christophe-Marie Duquesne
chm.duquesne at gmail.com
Fri Mar 19 09:27:35 EDT 2010
Hi,
I'm using OSI and I'd like to improve my code.
I'm currently using OSI in the following way.
At some point of my program, I'm building a CoinModel:
//---------------------------------------------------//
CoinModel model;
// fills the model
{
//1 loop using model.setObjective
//2 loops using model.setElement
}
//---------------------------------------------------//
Then, in some other part, I'm solving it:
//---------------------------------------------------//
OsiSolverInterface * solver;
// choose any solver (In my program I actually use a factory pattern
but I write it like this for better readability)
solver = new OsiClpSolverInterface();
solver->loadFromCoinModel(model);
// I use warmstart
CoinWarmStart previouslySavedWarmStart = getSavedWarmStart();
solver->setWarmStart(previouslySavedWarmStart);
solver->initialSolve();
solver->branchAndBound();
// saved for future reuse
saveNewWarmStart(solver->getWarmStart());
use(solver->getColSolution());
//---------------------------------------------------//
My question is: how do I insert the information that some constraints
of my model are special ordered sets?
I had a look
- at OsiSOS class: http://www.coin-or.org/Doxygen/Osi/class_osi_s_o_s.html,
- at OSISOSBranchingObject:
http://www.coin-or.org/Doxygen/Osi/class_osi_s_o_s_branching_object.html
- and at CoinSosSet http://www.coin-or.org/Doxygen/Osi/class_coin_sos_set.html.
I did not find methods that took any of these objects as argument in
OsiSolverInterface nor in CoinModel...
Maybe I do not use OSI the way it is intended to be?
Any advice is welcome.
--
Christophe-Marie Duquesne
06 84 14 26 82 - mobile
04 76 57 48 06 - g-scop
04 97 04 27 33 - amadeus
More information about the Osi
mailing list