10 #include "CoinMessageHandler.hpp"
11 #include "OsiSolverInterface.hpp"
12 #include "OsiBranchingObject.hpp"
13 #include "OsiCuts.hpp"
14 #include "CoinWarmStartBasis.hpp"
19 #include "ClpDualRowPivot.hpp"
26 class OsiRowCutDebugger;
27 class CglCutGenerator;
30 class CglTreeProbingInfo;
41 class OsiClpSolverInterface;
227 bool solveWithCuts(OsiCuts & cuts,
int numberTries,
CbcNode * node);
235 int serialCuts(OsiCuts & cuts,
CbcNode * node, OsiCuts & slackCuts,
int lastNumberCuts);
251 int & numberNodesOutput,
int &
status) ;
253 void resizeWhichGenerator(
int numberNow,
int numberAfter);
255 #ifdef CBC_KEEP_DEPRECATED
261 CbcModel * cleanModel(
const double * lower,
const double * upper);
278 int subBranchAndBound(
CbcModel * model2,
296 int subBranchAndBound(
const double * lower,
const double * upper,
305 OsiSolverInterface * strengthenedModel();
315 CglPreProcess * preProcess(
int makeEquality = 0,
int numberPasses = 5,
319 void postProcess(CglPreProcess * process);
347 double * saveLower = NULL,
348 double * saveUpper = NULL);
365 {
return whichGenerator_;}
383 int lessThanThis,
int defaultValue = 1000);
425 bool tightenVubs(
int type,
bool allowMultipleBinary =
false,
426 double useCutoff = 1.0e50);
433 bool tightenVubs(
int numberVubs,
const int * which,
434 double useCutoff = 1.0e50);
447 void saveModel(OsiSolverInterface * saveSolver,
double * checkCutoffForRestart,
bool * feasible);
463 return numberObjects_;
467 numberObjects_ = number;
476 const inline OsiObject *
object(
int which)
const {
477 return object_[which];
481 return object_[which];
530 intParam_[key] = value;
535 dblParam_[key] = value;
540 return intParam_[key];
544 return dblParam_[key];
729 minimumDrop_ = value;
739 maximumCutPassesAtRoot_ = value;
743 return maximumCutPassesAtRoot_;
749 maximumCutPasses_ = value;
753 return maximumCutPasses_;
758 return currentPassNumber_;
771 return numberStrong_;
776 preferredWay_ = value;
780 return preferredWay_;
795 bool doCutsNow(
int allowForTopOfTree)
const;
806 return numberBeforeTrust_;
817 return numberPenalties_;
821 {
return topOfTree_;}
824 numberAnalyzeIterations_ = number;
827 return numberAnalyzeIterations_;
832 return penaltyScaleFactor_;
845 problemType_ = number;
852 return currentDepth_;
859 return howOftenGlobalScan_;
863 return originalColumns_;
867 int numberGood=COIN_INT_MAX) ;
879 printFrequency_ = number;
883 return printFrequency_;
908 return numberIterations_;
912 numberIterations_ += value;
920 numberNodes_ += value;
924 return numberExtraNodes_;
954 return secondaryStatus_;
957 secondaryStatus_ = value;
985 return numberRowsAtContinuous_;
990 return solver_->getNumCols();
995 return solver_->getNumRows();
1000 return solver_->getNumElements();
1005 return numberIntegers_;
1009 return integerVariable_;
1013 assert (integerInfo_);
1014 assert (integerInfo_[i] == 0 || integerInfo_[i] == 1);
1015 return integerInfo_[i];
1019 return integerInfo_;
1024 return solver_->getColLower();
1029 return solver_->getColUpper();
1042 return solver_->getRowSense();
1054 return solver_->getRightHandSide();
1066 return solver_->getRowRange();
1071 return solver_->getRowLower();
1076 return solver_->getRowUpper();
1081 return solver_->getObjCoefficients();
1092 return solver_->isContinuous(colIndex);
1097 return solver_->isBinary(colIndex);
1105 return solver_->isInteger(colIndex);
1110 return solver_->isIntegerNonBinary(colIndex);
1115 return solver_->isFreeBinary(colIndex) ;
1120 return solver_->getMatrixByRow();
1125 return solver_->getMatrixByCol();
1130 return solver_->getInfinity();
1134 return cbcColLower_;
1138 return cbcColUpper_;
1142 return cbcRowLower_;
1146 return cbcRowUpper_;
1150 return cbcColSolution_;
1154 return cbcRowPrice_;
1158 return cbcReducedCost_;
1162 return cbcRowActivity_;
1171 return continuousSolution_;
1178 return usedInSolution_;
1184 double & objectiveValue,
const double *solution,
1185 int fixVariables = 0);
1191 const double * solution);
1200 virtual double checkSolution(
double cutoff,
double * solution,
1201 int fixVariables,
double originalObjValue);
1209 int & numberObjectInfeasibilities)
const;
1217 return currentSolution_;
1223 return testSolution_;
1226 testSolution_ = solution;
1233 return solver_->getColSolution();
1238 return solver_->getRowPrice();
1243 return solver_->getReducedCost();
1248 return solver_->getRowActivity();
1262 return bestObjective_;
1266 bestObjective_ = value;
1271 return bestObjective_ * solver_->getObjSense() ;
1281 bestObjective_ = value * solver_->getObjSense() ;
1285 return solver_->getObjValue() * solver_->getObjSense() ;
1295 return bestSolution_;
1304 double objectiveValue,
bool check =
false);
1308 return numberSolutions_;
1313 numberSolutions_ = value;
1319 return maximumSavedSolutions_;
1344 return numberHeuristicSolutions_;
1348 numberHeuristicSolutions_ = value;
1354 solver_->setObjSense(s);
1359 return originalContinuousObjective_;
1362 originalContinuousObjective_ = value;
1366 return continuousInfeasibilities_;
1369 continuousInfeasibilities_ = value;
1373 return continuousObjective_;
1377 return sumChangeObjective1_;
1382 return numberGlobalViolations_;
1385 numberGlobalViolations_ = 0;
1389 return resolveAfterTakeOffCuts_;
1392 resolveAfterTakeOffCuts_ = yesNo;
1396 return maximumRows_;
1400 return workingBasis_;
1404 return stopNumberIterations_;
1408 stopNumberIterations_ = value;
1412 {
return heuristicModel_;}
1415 { heuristicModel_ = model;}
1422 return nodeCompare_;
1432 return problemFeasibility_;
1457 return numberStoppedSubTrees_;
1461 numberStoppedSubTrees_++;
1485 return branchingMethod_;
1489 delete branchingMethod_;
1490 branchingMethod_ = method->
clone();
1497 delete branchingMethod_;
1498 branchingMethod_ = method.
clone();
1502 return cutModifier_;
1523 return stateOfSearch_;
1526 stateOfSearch_ = state;
1530 return searchStrategy_;
1534 searchStrategy_ = value;
1538 return strongStrategy_;
1542 strongStrategy_ = value;
1547 return numberCutGenerators_;
1555 return generator_[i];
1559 return virginGenerator_[i];
1570 int howOften = 1,
const char * name = NULL,
1571 bool normal =
true,
bool atSolution =
false,
1572 bool infeasible =
false,
int howOftenInSub = -100,
1573 int whatDepth = -1,
int whatDepthInSub = -1);
1593 return parentModel_;
1612 return heuristic_[i];
1616 return numberHeuristics_;
1620 numberHeuristics_ = value;
1624 return lastHeuristic_;
1628 lastHeuristic_ = last;
1653 return object_[sequence]->priority();
1664 return (eventHandler_) ;
1697 return solverCharacteristics_;
1708 void newLanguage(CoinMessages::Language language);
1728 return handler_->logLevel();
1736 defaultHandler_ = yesNo;
1740 return defaultHandler_;
1774 specialOptions_ = value;
1778 return specialOptions_;
1782 randomSeed_ = value;
1790 multipleRootTries_ = value;
1794 return multipleRootTries_;
1798 { eventHappened_=
true;}
1801 return (specialOptions_&16) == 0;
1808 return (specialOptions_&1048576) != 0;
1834 moreSpecialOptions_ = value;
1838 return moreSpecialOptions_;
1842 cutoffRowNumber_ = (yesNo) ? -2 : -1;
1847 moreSpecialOptions_ |= 131072;
1849 moreSpecialOptions_ &= ~131072;
1853 return (moreSpecialOptions_&131072)!=0;
1857 {
return temporaryPointer_;}
1860 { temporaryPointer_=pointer;}
1862 void goToDantzig(
int numberNodes, ClpDualRowPivot *& savePivotMethod);
1878 CbcModel(
const OsiSolverInterface &);
1902 ownership_ = ourSolver ? (ownership_ | 0x80000000) : (ownership_ & (~0x80000000)) ;
1911 return ((ownership_&0x80000000) != 0) ;
1935 OsiSolverInterface * returnSolver = solver_;
1937 return returnSolver;
1942 return continuousSolver_;
1947 continuousSolver_ = solver_->clone();
1951 delete continuousSolver_;
1952 continuousSolver_ = NULL;
1957 return referenceSolver_;
1994 return masterThread_;
2002 return numberThreads_;
2006 numberThreads_ = value;
2022 threadMode_ = value;
2031 if (!numberThreads_) {
2032 if ((threadMode_&1) == 0)
2038 if ((threadMode_&1) == 0)
2093 return numberNodes2_;
2116 int resolveClp(OsiClpSolverInterface *
solver,
int type);
2124 CbcNode * oldNode, OsiCuts & cuts,
2125 bool & resolved, CoinWarmStartBasis *lastws,
2126 const double * lowerBefore,
const double * upperBefore,
2127 OsiSolverBranch * & branches);
2136 CoinWarmStartBasis *
getEmptyBasis(
int ns = 0,
int na = 0)
const ;
2150 bool allowResolve, OsiCuts * saveCuts,
2151 int numberNewCuts = 0,
const OsiRowCut ** newCuts = NULL) ;
2166 int addCuts(
CbcNode * node, CoinWarmStartBasis *&lastws,
bool canFix);
2189 double & lower,
double & upper,
int force);
2216 int * numberDown = NULL,
int * numberUp = NULL,
2217 int * numberDownInfeasible = NULL,
2218 int * numberUpInfeasible = NULL)
const;
2229 return hotstartSolution_;
2233 return hotstartPriorities_;
2242 return currentNumberCuts_;
2246 return &globalCuts_;
2252 return currentNode_;
2256 return probingInfo_;
2260 return &randomNumberGenerator_;
2264 numberStrongIterations_ = number;
2268 return numberStrongIterations_;
2272 return maximumNumberIterations_;
2276 maximumNumberIterations_ = value;
2280 fastNodeDepth_ = value;
2284 return fastNodeDepth_;
2288 return continuousPriority_;
2292 continuousPriority_ = value;
2295 numberExtraNodes_ += nodes;
2296 numberExtraIterations_ += iterations;
2300 return numberExtraIterations_;
2304 int numberFixed,
bool ifInfeasible);
2316 return storedRowCuts_;
2320 storedRowCuts_ = cuts;
2324 return ((ownership_&0x40000000) != 0) ;
2337 bestSolutionBasis_ = bestSolutionBasis;
2350 OsiSolverInterface * solver_;
2357 unsigned int ownership_ ;
2360 OsiSolverInterface * continuousSolver_;
2363 OsiSolverInterface * referenceSolver_;
2366 CoinMessageHandler * handler_;
2373 bool defaultHandler_;
2376 CoinMessages messages_;
2392 mutable CoinWarmStart *emptyWarmStart_ ;
2395 double bestObjective_;
2397 double bestPossibleObjective_;
2399 double sumChangeObjective1_;
2401 double sumChangeObjective2_;
2404 double * bestSolution_;
2406 double ** savedSolutions_;
2412 double * currentSolution_;
2416 mutable const double * testSolution_;
2423 CoinWarmStartBasis bestSolutionBasis_ ;
2430 double minimumDrop_;
2432 int numberSolutions_;
2434 int numberSavedSolutions_;
2436 int maximumSavedSolutions_;
2447 double * hotstartSolution_;
2449 int * hotstartPriorities_;
2451 int numberHeuristicSolutions_;
2459 int numberIterations_;
2474 int secondaryStatus_;
2476 int numberIntegers_;
2478 int numberRowsAtContinuous_;
2484 int cutoffRowNumber_;
2486 int maximumNumberCuts_;
2498 int currentNumberCuts_;
2512 const OsiRowCut ** lastCut_;
2514 int lastNumberCuts2_;
2516 int * lastNumberCuts_;
2530 OsiRowCut * nextRowCut_;
2536 int * integerVariable_;
2538 char * integerInfo_;
2540 double * continuousSolution_;
2542 int * usedInSolution_;
2566 int specialOptions_;
2581 int moreSpecialOptions_;
2595 int numberStoppedSubTrees_;
2609 const double * cbcColLower_;
2612 const double * cbcColUpper_;
2614 const double * cbcRowLower_;
2616 const double * cbcRowUpper_;
2618 const double * cbcColSolution_;
2620 const double * cbcRowPrice_;
2622 const double * cbcReducedCost_;
2624 const double * cbcRowActivity_;
2638 int numberBeforeTrust_;
2642 int numberPenalties_;
2644 int stopNumberIterations_;
2647 double penaltyScaleFactor_;
2649 int numberAnalyzeIterations_;
2651 double * analyzeResults_;
2653 void * temporaryPointer_;
2655 int numberInfeasibleNodes_;
2664 int printFrequency_;
2666 int numberCutGenerators_;
2672 int numberHeuristics_;
2680 # ifdef CBC_ONLY_CLP
2681 ClpEventHandler *eventHandler_ ;
2699 OsiObject ** object_;
2704 int * originalColumns_;
2706 int howOftenGlobalScan_;
2709 int numberGlobalViolations_;
2711 int numberExtraIterations_;
2713 int numberExtraNodes_;
2717 double continuousObjective_;
2720 double originalContinuousObjective_;
2722 int continuousInfeasibilities_;
2724 int maximumCutPassesAtRoot_;
2726 int maximumCutPasses_;
2730 int currentPassNumber_;
2738 int multipleRootTries_;
2742 mutable CoinThreadRandom randomNumberGenerator_;
2744 CoinWarmStartBasis workingBasis_;
2746 int * whichGenerator_;
2748 int maximumStatistics_;
2752 int maximumDepthActual_;
2754 double numberDJFixed_;
2756 CglTreeProbingInfo * probingInfo_;
2758 int numberFixedAtRoot_;
2760 int numberFixedNow_;
2764 mutable bool eventHappened_;
2766 int numberLongStrong_;
2768 int numberOldActiveCuts_;
2772 int searchStrategy_;
2784 int strongStrategy_;
2786 int numberStrongIterations_;
2796 OsiBabSolver * solverCharacteristics_;
2798 bool resolveAfterTakeOffCuts_;
2800 int maximumNumberIterations_;
2802 int continuousPriority_;
2804 int numberUpdateItems_;
2806 int maximumNumberUpdateItems_;
2810 CglStored * storedRowCuts_;
2835 double & originalUpper) ;
2838 class OsiClpSolverInterface;
2839 int CbcMain (
int argc,
const char *argv[], OsiClpSolverInterface & solver,
CbcModel ** babSolver);
2842 int callCbc(
const char * input2, OsiClpSolverInterface& solver1);
2843 int callCbc(
const char * input2);
2844 int callCbc(
const std::string input2, OsiClpSolverInterface& solver1);
2845 int callCbc(
const std::string input2) ;
void flipModel()
Flip direction of optimization on all models.
CbcThread * masterThread() const
Get pointer to masterthread.
void passInSolverCharacteristics(OsiBabSolver *solverCharacteristics)
For advanced applications you may wish to modify the behavior of Cbc e.g.
const double * testSolution() const
For testing infeasibilities - will point to currentSolution_ or solver–>getColSolution() ...
void setProblemFeasibility(CbcFeasibilityBase *feasibility)
int addCuts(CbcNode *node, CoinWarmStartBasis *&lastws, bool canFix)
Determine and install the active cuts that need to be added for the current subproblem.
The objective is assumed to worsen by this amount for each integer infeasibility. ...
void resetToReferenceSolver()
Uses a copy of reference solver to be current solver.
Number of branches (may be more than number of nodes as may include strong branching) ...
void newLanguage(CoinMessages::Language language)
Set language.
CbcHeuristic * lastHeuristic() const
Pointer to heuristic solver which found last solution (or NULL)
CbcModel * integerPresolve(bool weak=false)
Do integer presolve, creating a new (presolved) model.
void setPointers(const OsiSolverInterface *solver)
Set pointers for speed.
const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
void setHowOftenGlobalScan(int number)
Set how often to scan global cuts.
void setLastHeuristic(CbcHeuristic *last)
set last heuristic which found a solution
CbcBranchDecision * branchingMethod() const
Get the current branching decision method.
double getSolverObjValue() const
Get solver objective function value (as minimization)
int * usedInSolution() const
Array marked whenever a solution is found if non-zero.
void setOptionalInteger(int index)
int moreSpecialOptions() const
Get more special options.
void * getApplicationData() const
Get application data.
void setRandomSeed(int value)
Set random seed.
bool setAllowableFractionGap(double value)
Set the fraction allowable gap between the best known solution and the best possible solution...
bool isInitialSolveProvenOptimal() const
Is optimality proven (for initialSolve) ?
const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
int getPrintingMode() const
Get the printing mode.
void incrementStrongInfo(int numberTimes, int numberIterations, int numberFixed, bool ifInfeasible)
Increment strong info.
int CbcMain(int argc, const char *argv[], OsiClpSolverInterface &solver, CbcModel **babSolver)
void setCutoffAsConstraint(bool yesNo)
Set cutoff as constraint.
CbcModel & operator=(const CbcModel &rhs)
Assignment operator.
const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
bool isAbandoned() const
Are there a numerical difficulties?
The maximum number of nodes before terminating.
bool isNodeLimitReached() const
Node limit reached?
const char * integerType() const
Whether or not integer.
CbcModel * heuristicModel() const
A pointer to model from CbcHeuristic.
void setFastNodeDepth(int value)
Set depth for fast nodes.
void setNumberStrongIterations(int number)
Set the number of iterations done in strong branching.
int getThreadMode() const
Get thread mode.
int numberObjects() const
Get the number of objects.
bool isSolutionLimitReached() const
Solution limit reached?
bool setHeuristicFractionGap(double value)
Set the fraction heuristic gap between the best known solution and the best possible solution...
CoinBigIndex getNumElements() const
Get number of nonzero elements.
bool isIntegerNonBinary(int colIndex) const
Return true if variable is general integer.
void setStrongStrategy(int value)
Set strong branching strategy.
int * mutableStrongInfo()
Return mutable strong info.
virtual CbcModel * clone(bool cloneHandler)
Clone.
const double * getCbcColUpper() const
Get pointer to array[getNumCols()] (for speed) of column upper bounds.
void setHeuristicModel(CbcModel *model)
Set a pointer to model from CbcHeuristic.
bool isBinary(int colIndex) const
Return true if variable is binary.
void setResolveAfterTakeOffCuts(bool yesNo)
int getIterationCount() const
Get how many iterations it took to solve the problem.
int numberHeuristics() const
Get the number of heuristics.
int secondaryStatus() const
Secondary status of problem -1 unset (status_ will also be -1) 0 search completed with solution 1 lin...
void incrementNodeCount(int value)
Increment how many nodes it took to solve the problem.
void setContinuousPriority(int value)
Set anything with priority >= this can be treated as continuous.
int maximumRows() const
Maximum number of rows.
double rootObjectiveAfterCuts() const
Value of objective after root node cuts added.
int getContinuousInfeasibilities() const
Number of infeasibilities at continuous.
int callCbc(const char *input2, OsiClpSolverInterface &solver1)
CbcEventHandler * getEventHandler() const
Retrieve a pointer to the event handler.
const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
int getNumberHeuristicSolutions() const
Get number of heuristic solutions.
Just a marker, so that a static sized array can store parameters.
const double * getCbcReducedCost() const
Get a pointer to array[getNumCols()] (for speed) of reduced costs.
bool setInfeasibilityWeight(double value)
Set the weight per integer infeasibility .
void reserveCurrentSolution(const double *solution=NULL)
Make sure region there and optionally copy solution.
int getMultipleRootTries() const
Get multiple root tries.
int numberRowsAtContinuous() const
Number of rows in continuous (root) problem.
bool setIntegerTolerance(double value)
Set the integrality tolerance .
int logLevel() const
Get log level.
int searchStrategy() const
Strategy worked out - mainly at root node for use by CbcNode.
const double * hotstartSolution() const
Get the hotstart solution.
bool addCuts1(CbcNode *node, CoinWarmStartBasis *&lastws)
Traverse the tree from node to root and prep the model.
bool setMaximumSolutions(int value)
Set the maximum number of solutions desired.
bool isFreeBinary(int colIndex) const
Return true if variable is binary and not fixed at either bound.
bool canStopOnGap() const
See if can stop on gap.
Cutoff - stored for speed.
bool isProvenOptimal() const
Is optimality proven?
CbcNodeInfo ** walkback() const
Get pointer to walkback.
int howOftenGlobalScan() const
Get how often to scan global cuts.
bool integerPresolveThisModel(OsiSolverInterface *originalSolver, bool weak=false)
Do integer presolve, modifying the current model.
const CbcFullNodeInfo * topOfTree() const
Pointer to top of tree.
CoinWarmStartBasis & workingBasis()
Work basis for temporary use.
CbcCountRowCut ** addedCuts() const
Return the list of cuts initially collected for this subproblem.
void setStoredRowCuts(CglStored *cuts)
Set stored row cuts for donor/recipient CbcModel.
bool setDblParam(CbcDblParam key, double value)
Set a double parameter.
void clearContinuousSolver()
Clear solver with continuous state.
CoinMessages * messagesPointer()
Return pointer to messages.
void makePartialCut(const OsiRowCut *cut, const OsiSolverInterface *solver=NULL)
Make partial cut into a global cut and save.
int getRandomSeed() const
Get random seed.
void setNumberHeuristicSolutions(int value)
Set number of heuristic solutions.
int getNodeCount2() const
Get how many Nodes it took to solve the problem.
Sum of non-zero changes on a branch.
int phase() const
Current phase (so heuristics etc etc can find out).
bool modelOwnsSolver()
Get ownership of solver.
void setModelOwnsSolver(bool ourSolver)
Set ownership of solver.
void setNumberAnalyzeIterations(int number)
Number of analyze iterations to do.
int currentNumberCuts() const
Number of entries in the list returned by addedCuts()
void setThreadMode(int value)
Set thread mode always use numberThreads for branching 1 set then deterministic 2 set then use number...
int takeOffCuts(OsiCuts &cuts, bool allowResolve, OsiCuts *saveCuts, int numberNewCuts=0, const OsiRowCut **newCuts=NULL)
Remove inactive cuts from the model.
double getCurrentObjValue() const
Get current objective function value.
void setNumberThreads(int value)
Set number of threads.
void saveReferenceSolver()
Save a copy of the current solver so can be reset to.
int strongStrategy() const
Stong branching strategy.
void setPrintFrequency(int number)
Set the print frequency.
bool feasibleSolution(int &numberIntegerInfeasibilities, int &numberObjectInfeasibilities) const
Test the current solution for feasiblility.
bool normalSolver() const
Says if normal solver i.e. has well defined CoinPackedMatrix.
virtual double checkSolution(double cutoff, double *solution, int fixVariables, double originalObjValue)
Call this to really test if a valid solution can be feasible Solution is number columns in size...
void passInEventHandler(const CbcEventHandler *eventHandler)
Set an event handler.
void setNumberStrong(int number)
Set the maximum number of candidates to be evaluated for strong branching.
void setLanguage(CoinMessages::Language language)
OsiRowCut * conflictCut(const OsiSolverInterface *solver, bool &localCuts)
Create conflict cut (well - most of)
void passInTreeHandler(CbcTree &tree)
For modifying tree handling (original is cloned)
void incrementUsed(const double *solution)
Increases usedInSolution for nonzeros.
double savedSolutionObjective(int which) const
Return a saved solution objective (0==best) - COIN_DBL_MAX if off end.
bool defaultHandler() const
Check default handler.
void convertToDynamic()
If numberBeforeTrust >0 then we are going to use CbcBranchDynamic.
double getIntegerTolerance() const
Get the integrality tolerance .
int numberStrong() const
Get the maximum number of candidates to be evaluated for strong branching.
const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
bool setAllowablePercentageGap(double value)
Set the percentage allowable gap between the best known solution and the best possible solution...
int numberIntegers() const
Number of integers in problem.
void setBranchingMethod(CbcBranchDecision *method)
Set the branching decision method.
void generateCpp(FILE *fp, int options)
Create C++ lines to get to current state.
void incrementExtra(int nodes, int iterations)
int cliquePseudoCosts(int doStatistics)
Use cliques for pseudocost information - return nonzero if infeasible.
Adjusts printout 1 does different node message with number unsatisfied on last branch.
void setApplicationData(void *appData)
Set application data.
Stop when the gap between the objective value of the best known solution and the best bound on the ob...
void setStrategy(CbcStrategy &strategy)
Set the strategy. Clones.
void setSearchStrategy(int value)
Set strategy worked out - mainly at root node for use by CbcNode.
bool isInitialSolveProvenPrimalInfeasible() const
Is primal infeasiblity proven (for initialSolve) ?
void setOriginalColumns(const int *originalColumns, int numberGood=COIN_INT_MAX)
Set original columns as created by preprocessing.
void deleteSolutions()
Delete best and saved solutions.
void makeGlobalCuts()
Make partial cuts into global cuts.
double * bestSolution() const
The best solution to the integer programming problem.
bool isProvenInfeasible() const
Is infeasiblity proven (or none better than cutoff)?
CbcCutGenerator ** cutGenerators() const
Get the list of cut generators.
void setMoreSpecialOptions(int value)
Set more special options at present bottom 6 bits used for shadow price mode 1024 for experimental ho...
bool setPrintingMode(int value)
Set the printing mode.
void setDefaultHandler(bool yesNo)
Set flag to say if handler_ is the default handler.
int numberGlobalViolations() const
Number of times global cuts violated.
CbcNode * currentNode() const
Get a pointer to current node (be careful)
void saveSolution(const OsiSolverInterface *osi, std::string fileName)
void setCutAndHeuristicOptions(CbcModel &model)
int getMaximumCutPasses() const
Get the maximum number of cut passes at other nodes (default 10)
void moveToModel(CbcModel *baseModel, int mode)
Move/copy information from one model to another -1 - initialization 0 - from base model 1 - to base m...
bool ownObjects() const
Now we may not own objects - just point to solver's objects.
const double * getCbcColSolution() const
Get pointer to array[getNumCols()] (for speed) of primal solution vector.
double getHeuristicGap() const
Get the heuristic gap between the best known solution and the best possible solution.
const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
double getAllowablePercentageGap() const
Get the percentage allowable gap between the best known solution and the best possible solution...
bool maximumSecondsReached() const
Return true if maximum time reached.
double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
bool isSecondsLimitReached() const
Time limit reached?
int whenCuts() const
Get at which depths to do cuts.
void incrementSubTreeStopped()
Says a sub tree was stopped.
int getMaximumCutPassesAtRoot() const
Get the maximum number of cut passes at root node.
double getMinimumDrop() const
Get the minimum drop to continue cuts.
const double * getRowPrice() const
Get pointer to array[getNumRows()] of dual prices.
void gutsOfCopy(const CbcModel &rhs, int mode=0)
Most of copy constructor mode - 0 copy but don't delete before 1 copy and delete before 2 copy and de...
bool isProvenDualInfeasible() const
Was continuous solution unbounded.
int printFrequency() const
Get the print frequency.
void setInfoInChild(int type, CbcThread *info)
Set information in a child -3 pass pointer to child thread info -2 just stop -1 delete simple child s...
CbcEventHandler::CbcAction dealWithEventHandler(CbcEventHandler::CbcEvent event, double objValue, const double *solution)
Deals with event handler and solution.
void branchAndBound(int doStatistics=0)
Invoke the branch & cut algorithm.
CbcEvent
Events known to cbc.
Current minimization objective value.
CoinWarmStartBasis * getEmptyBasis(int ns=0, int na=0) const
Return an empty basis object of the specified size.
double getAllowableFractionGap() const
Get the fraction allowable gap between the best known solution and the best possible solution...
CbcCutModifier * cutModifier() const
Get the current cut modifier method.
void setBestSolutionBasis(const CoinWarmStartBasis &bestSolutionBasis)
Warm start object produced by heuristic or strong branching.
void synchronizeHandlers(int makeDefault)
Makes all handlers same.
void setNumberPenalties(int number)
Set the number of variables for which to compute penalties in dynamic strong branching.
double getAllowableGap() const
Get the allowable gap between the best known solution and the best possible solution.
void setMinimizationObjValue(double value)
Set best objective function value as minimization.
void startSplitModel(int numberIterations)
Start threads.
Using MS heap implementation.
const OsiObject * object(int which) const
Get the specified object.
Stop doing heuristics when the gap between the objective value of the best known solution and the bes...
void setLogLevel(int value)
Set log level.
int getCurrentPassNumber() const
Get current cut pass number in this round of cuts.
bool isInteger(int colIndex) const
Return true if column is integer.
void setWhenCuts(int value)
Set at which depths to do cuts.
void setNumberBeforeTrust(int number)
Set the number of branches before pseudo costs believed in dynamic strong branching.
Base class for Cbc event handling.
int callCbc1(const char *input2, CbcModel &babSolver)
int typePresolve() const
Whether to automatically do presolve before branch and bound (subTrees).
CoinMessageHandler * messageHandler() const
Return handler.
void setHotstartSolution(const double *solution, const int *priorities=NULL)
Pass in target solution and optional priorities.
OsiObject ** objects() const
Get the array of objects.
double * currentSolution() const
Solution to the most recent lp relaxation.
Just a marker, so that a static sized array can store parameters.
const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
void setMaximumSavedSolutions(int value)
Set maximum number of extra saved solutions.
void setUseElapsedTime(bool yesNo)
Set time method.
double * continuousSolution() const
Holds solution at continuous (after cuts if branchAndBound called)
int numberCutGenerators() const
Get the number of cut generators.
int getPreferredWay() const
Get the preferred way to branch (default 0)
double getInfinity() const
Get solver's value for infinity.
int numberStoppedSubTrees() const
Returns number of times any subtree stopped on nodes, time etc.
CbcHeuristic * heuristic(int i) const
Get the specified heuristic.
OsiSolverInterface * continuousSolver() const
Returns solver with continuous state.
void gutsOfDestructor2()
Clears out enough to reset CbcModel as if no branch and bound done.
const int * whichGenerator() const
Which cut generator generated this cut.
int getMaximumNodes() const
Get the maximum node limit .
const double * savedSolution(int which) const
Return a saved solution (0==best) - NULL if off end.
const double * getCbcRowUpper() const
Get pointer to array[getNumRows()] (for speed) of row upper bounds.
void setBestObjectiveValue(double objectiveValue)
Just update objectiveValue.
void redoWalkBack()
Redo walkback arrays.
int fastNodeDepth() const
Get depth for fast nodes.
void setStateOfSearch(int state)
void setNodeComparison(CbcCompareBase *compare)
Stop doing heuristics when the gap between the objective value of the best known solution and the bes...
int chooseBranch(CbcNode *&newNode, int numberPassesLeft, CbcNode *oldNode, OsiCuts &cuts, bool &resolved, CoinWarmStartBasis *lastws, const double *lowerBefore, const double *upperBefore, OsiSolverBranch *&branches)
Encapsulates choosing a variable - anyAction -2, infeasible (-1 round again), 0 done.
void synchronizeModel()
Ensure attached objects point to this model.
int resolve(CbcNodeInfo *parent, int whereFrom, double *saveSolution=NULL, double *saveLower=NULL, double *saveUpper=NULL)
Reoptimise an LP relaxation.
void setBranchingMethod(CbcBranchDecision &method)
Set the branching method.
The amount by which to tighten the objective function cutoff when a new solution is discovered...
virtual CbcBranchDecision * clone() const =0
Clone.
void setProblemType(int number)
Problem type as set by user or found by analysis.
void saveBestSolution(const double *solution, double objectiveValue)
Save a solution to best and move current to saved.
void clearNumberGlobalViolations()
CbcModel * parentModel() const
Get the current parent model.
void setCutoff(double value)
Set cutoff bound on the objective function.
const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
CbcModel * subTreeModel(OsiSolverInterface *solver=NULL) const
For retrieving a copy of subtree model with given OsiSolver.
void passInPriorities(const int *priorities, bool ifNotSimpleIntegers)
Pass in branching priorities.
int numberBeforeTrust() const
get the number of branches before pseudo costs believed in dynamic strong branching.
OsiRowCut augmented with bookkeeping.
int stateOfSearch() const
State of search 0 - no solution 1 - only heuristic solutions 2 - branched to a solution 3 - no soluti...
double getCurrentSeconds() const
Current time since start of branchAndbound.
bool tightenVubs(int type, bool allowMultipleBinary=false, double useCutoff=1.0e50)
For variables involved in VUB constraints, see if we can tighten bounds by solving lp's...
void setNumberObjects(int number)
Set the number of objects.
double getCurrentMinimizationObjValue() const
Get current minimization objective function value.
double getContinuousObjective() const
Value of objective at continuous.
void previousBounds(CbcNode *node, CbcNodeInfo *where, int iColumn, double &lower, double &upper, int force)
Returns bounds just before where - initially original bounds.
CbcBaseModel * master() const
Thread stuff for master.
CbcModel()
Default Constructor.
int continuousPriority() const
Get anything with priority >= this can be treated as continuous.
Optimization direction - stored for speed.
Information required while the node is live.
For gathering statistics.
const double * getCbcRowLower() const
Get pointer to array[getNumRows()] (for speed) of row lower bounds.
int * originalColumns() const
Original columns as created by integerPresolve or preprocessing.
void setSolutionCount(int value)
Set number of solutions (so heuristics will be different)
int getNumRows() const
Get number of rows.
double getCutoffIncrement() const
Get the CbcModel::CbcCutoffIncrement desired.
int parallelMode() const
Return -2 if deterministic threaded and main thread -1 if deterministic threaded and serial thread 0 ...
CoinThreadRandom * randomNumberGenerator()
Thread specific random number generator.
void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
int currentDepth() const
Current depth.
void CbcMain0(CbcModel &babSolver)
The maximum number of solutions before terminating.
int getExtraNodeCount() const
Get how many Nodes were enumerated in complete fathoming B&B inside CLP.
CbcCompareBase * nodeComparison() const
int getNumCols() const
Get number of columns.
CglStored * storedRowCuts() const
Get stored row cuts for donor/recipient CbcModel.
const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
void setStrategy(CbcStrategy *strategy)
Set the strategy. assigns.
void incrementIterationCount(int value)
Increment how many iterations it took to solve the problem.
CBC_Message
This deals with Cbc messages (as against Clp messages etc).
Smallest non-zero change on a branch.
int getNumberThreads() const
Get number of threads.
void setMaximumCutPassesAtRoot(int value)
Set the maximum number of cut passes at root node (default 20) Minimum drop can also be used for fine...
void checkModel()
Check original model before it gets messed up.
int doOneNode(CbcModel *baseModel, CbcNode *&node, CbcNode *&newNode)
Do one node - broken out for clarity? also for parallel (when baseModel!=this) Returns 1 if solution ...
void setObjValue(double value)
Set best objective function value.
The maximum number of seconds before terminating.
CoinMessages & messages()
Return messages.
bool allDynamic() const
Says whether all dynamic integers.
void initialSolve()
Solve the initial LP relaxation.
bool isContinuous(int colIndex) const
Return true if variable is continuous.
const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels.
CbcRowCuts * globalCuts()
Global cuts.
int status() const
Final status of problem Some of these can be found out by is......
bool setMaximumNodes(int value)
Set the maximum node limit .
The time at start of model.
const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
void addObjects(int numberObjects, OsiObject **objects)
Add in object information.
int getStopNumberIterations() const
Get number of "iterations" to stop after.
OsiSolverInterface * solver() const
Returns solver - has current state.
bool isInitialSolveAbandoned() const
Are there numerical difficulties (for initialSolve) ?
int splitModel(int numberModels, CbcModel **model, int numberNodes)
Split up nodes.
void sayEventHappened()
Tell model to stop on event.
Abstract cut modifier base class.
double getObjValue() const
Get best objective function value.
bool isLocked() const
From here to end of section - code in CbcThread.cpp until class changed Returns true if locked...
Information required to recreate the subproblem at this node.
void setBestSolution(CBC_Message how, double &objectiveValue, const double *solution, int fixVariables=0)
Record a new incumbent solution and update objectiveValue.
void setParentModel(CbcModel &parentModel)
Set the parent model.
bool isContinuousUnbounded() const
Was continuous solution unbounded.
int getNodeCount() const
Get how many Nodes it took to solve the problem (including those in complete fathoming B&B inside CLP...
void zapIntegerInformation(bool leaveObjects=true)
Zap integer information in problem (may leave object info)
void setPenaltyScaleFactor(double value)
Set scale factor to make penalties match strong.
Information required to recreate the subproblem at this node.
void setSecondaryStatus(int value)
void setMaximumNumberIterations(int value)
Set maximum number of iterations (designed to be used in heuristics)
void doHeuristicsAtRoot(int deleteHeuristicsAfterwards=0)
Do heuristics at root.
void setContinuousObjective(double value)
void analyzeObjective()
Analyze problem to find a minimum change in the objective function.
int numberPenalties() const
get the number of variables for which to compute penalties in dynamic strong branching.
void setProblemStatus(int value)
int numberStrongIterations() const
Get the number of iterations done in strong branching.
CbcAction
Action codes returned by the event handler.
Largest non-zero change on a branch.
int specialOptions() const
Get special options.
const double * getCbcColLower() const
Get pointer to array[getNumCols()] (for speed) of column lower bounds.
int getSolutionCount() const
Get number of solutions.
bool useElapsedTime() const
Get time method.
static bool haveMultiThreadSupport()
Indicates whether Cbc library has been compiled with multithreading support.
int CbcMain1(int argc, const char *argv[], CbcModel &babSolver)
void createContinuousSolver()
Create solver with continuous state.
void setTestSolution(const double *solution)
char integerType(int i) const
Whether or not integer.
CbcTree * tree() const
Tree method e.g. heap (which may be overridden by inheritance)
int numberSavedSolutions() const
Number of saved solutions (including best)
double penaltyScaleFactor() const
Get scale factor to make penalties match strong.
double getCutoff() const
Get the cutoff bound on the objective function - always as minimize.
double getMinimizationObjValue() const
Get best objective function value as minimization.
void synchronizeNumberBeforeTrust(int type=0)
Set numberBeforeTrust in all objects.
const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
void setNumberHeuristics(int value)
Set the number of heuristics.
Small non-zero change on a branch to be used as guess.
int numberAnalyzeIterations() const
bool setAllowableGap(double value)
Set the allowable gap between the best known solution and the best possible solution.
void setMaximumCutPasses(int value)
Set the maximum number of cut passes at other nodes (default 10) Minimum drop can also be used for fi...
void setMinimumDrop(double value)
Set the minimum drop to continue cuts.
int getIntParam(CbcIntParam key) const
Get an integer parameter.
void passInMessageHandler(CoinMessageHandler *handler)
Pass in Message handler (not deleted at end)
double getInfeasibilityWeight() const
Get the weight per integer infeasibility .
void addUpdateInformation(const CbcObjectUpdateData &data)
Adds an update information object.
int maximumNumberIterations() const
Get maximum number of iterations (designed to be used in heuristics)
CbcCutGenerator * virginCutGenerator(int i) const
Get the specified cut generator before any changes.
void resetModel()
Clears out enough to reset CbcModel cutoff etc.
void goToDantzig(int numberNodes, ClpDualRowPivot *&savePivotMethod)
Go to dantzig pivot selection if easy problem (clp only)
OsiBranchingInformation usefulInformation() const
Generate an OsiBranchingInformation object.
void getIntegerInformation(const OsiObject *object, double &originalLower, double &originalUpper)
So we can use osiObject or CbcObject during transition.
void setTemporaryPointer(void *pointer)
Set useful temporary pointer.
bool setIntParam(CbcIntParam key, int value)
Set an integer parameter.
void setMultipleRootTries(int value)
Set multiple root tries.
void fillPseudoCosts(double *downCosts, double *upCosts, int *priority=NULL, int *numberDown=NULL, int *numberUp=NULL, int *numberDownInfeasible=NULL, int *numberUpInfeasible=NULL) const
Return pseudo costs If not all integers or not pseudo costs - returns all zero Length of arrays are n...
CglTreeProbingInfo * probingInfo() const
Get a pointer to probing info.
int numberExtraIterations() const
Number of extra iterations.
void makeGlobalCut(const OsiRowCut *cut)
Make given cut into a global cut.
void AddIntegers()
Add additional integers.
int maximumSavedSolutions() const
Maximum number of extra saved solutions.
const OsiBabSolver * solverCharacteristics() const
Get solver characteristics.
CbcStrategy * strategy() const
Get the current strategy.
int getMaximumSolutions() const
Get the maximum number of solutions desired.
void setContinuousInfeasibilities(int value)
int reducedCostFix()
Perform reduced cost fixing.
bool setMaximumSeconds(double value)
Set the maximum number of seconds desired.
Interface between Cbc and Cut Generation Library.
void deleteSavedSolution(int which)
Delete a saved solution and move others up.
void setObjectiveValue(CbcNode *thisNode, const CbcNode *parentNode) const
Set objective value in a node.
void setTypePresolve(int value)
void deleteObjects(bool findIntegers=true)
Delete all object information (and just back to integers if true)
double getMaximumSeconds() const
Get the maximum number of seconds desired.
bool setCutoffIncrement(double value)
Set the CbcModel::CbcCutoffIncrement desired.
bool setHeuristicGap(double value)
Set the heuristic gap between the best known solution and the best possible solution.
CbcModel * findCliques(bool makeEquality, int atLeastThisMany, int lessThanThis, int defaultValue=1000)
Identify cliques and construct corresponding objects.
double getHeuristicFractionGap() const
Get the fraction heuristic gap between the best known solution and the best possible solution...
The maximum amount the value of an integer variable can vary from integer and still be considered fea...
void addCutGenerator(CglCutGenerator *generator, int howOften=1, const char *name=NULL, bool normal=true, bool atSolution=false, bool infeasible=false, int howOftenInSub=-100, int whatDepth=-1, int whatDepthInSub=-1)
Add one generator - up to user to delete generators.
Stop when the gap between the objective value of the best known solution and the best bound on the ob...
void addHeuristic(CbcHeuristic *generator, const char *name=NULL, int before=-1)
Add one heuristic - up to user to delete.
void assignSolver(OsiSolverInterface *&solver, bool deleteSolver=true)
Assign a solver to the model (model assumes ownership)
OsiSolverInterface * swapSolver(OsiSolverInterface *solver)
Returns current solver - sets new one.
bool waitingForMiniBranchAndBound() const
Says if model is sitting there waiting for mini branch and bound to finish This is because an event h...
double getDblParam(CbcDblParam key) const
Get a double parameter.
OsiObject * modifiableObject(int which) const
Get the specified object.
const double * getCbcRowPrice() const
Get pointer to array[getNumRows()] (for speed) of dual prices.
void setPreferredWay(int value)
Set global preferred way to branch -1 down, +1 up, 0 no preference.
double getBestPossibleObjValue() const
Get best possible objective function value.
const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
void gutsOfDestructor()
Clears out as much as possible (except solver)
const int * strongInfo() const
Return strong info.
Simple Branch and bound class.
void saveExtraSolution(const double *solution, double objectiveValue)
Save a solution to saved list.
OsiSolverInterface * referenceSolver() const
A copy of the solver, taken at constructor or by saveReferenceSolver.
void * temporaryPointer() const
Get useful temporary pointer.
void findIntegers(bool startAgain, int type=0)
Identify integer variables and create corresponding objects.
bool resolveAfterTakeOffCuts() const
Whether to force a resolve after takeOffCuts.
void setStopNumberIterations(int value)
Set number of "iterations" to stop after.
void setCutModifier(CbcCutModifier *modifier)
Set the cut modifier method.
void setSpecialOptions(int value)
Set special options 0 bit (1) - check if cuts valid (if on debugger list) 1 bit (2) - use current bas...
CbcFeasibilityBase * problemFeasibility() const
void saveModel(OsiSolverInterface *saveSolver, double *checkCutoffForRestart, bool *feasible)
Save copy of the model.
const double * getCbcRowActivity() const
Get pointer to array[getNumRows()] (for speed) of row activity levels.
void setNextRowCut(const OsiRowCut &cut)
Copy and set a pointer to a row cut which will be added instead of normal branching.
CbcCutGenerator * cutGenerator(int i) const
Get the specified cut generator.
void originalModel(CbcModel *presolvedModel, bool weak)
Put back information into the original model after integer presolve.
void pseudoShadow(int type)
Fill in useful estimates.
bool doCutsNow(int allowForTopOfTree) const
Return true if we want to do cuts If allowForTopOfTree zero then just does on multiples of depth if 1...
void passInSubTreeModel(CbcModel &model)
For passing in an CbcModel to do a sub Tree (with derived tree handlers).
bool isInitialSolveProvenDualInfeasible() const
Is dual infeasiblity proven (for initialSolve) ?
virtual ~CbcModel()
Destructor.
A class to encapsulate thread stuff.
void mergeModels(int numberModel, CbcModel **model, int numberNodes)
Merge models.
const int * hotstartPriorities() const
Get the hotstart priorities.
void adjustHeuristics()
Adjust heuristics based on model.
double sumChangeObjective() const
Sum of Changes to objective by first solve.
const int * integerVariable() const
void moveInfo(const CbcModel &rhs)
Move status, nodes etc etc across.
int priority(int sequence) const
Returns priority level for an object (or 1000 if no priorities exist)