8 #include "CoinFinite.hpp"
9 #include "CoinMessageHandler.hpp"
10 #include "OsiSolverInterface.hpp"
11 #include "OsiBranchingObject.hpp"
12 #include "OsiCuts.hpp"
13 #include "CoinWarmStartBasis.hpp"
17 #include "ClpDualRowPivot.hpp"
25 class OsiRowCutDebugger;
26 class CglCutGenerator;
29 class CglTreeProbingInfo;
233 int serialCuts(OsiCuts & cuts,
CbcNode * node, OsiCuts & slackCuts,
int lastNumberCuts);
249 int & numberNodesOutput,
int &
status) ;
253 #ifdef CBC_KEEP_DEPRECATED
259 CbcModel * cleanModel(
const double * lower,
const double * upper);
276 int subBranchAndBound(
CbcModel * model2,
294 int subBranchAndBound(
const double * lower,
const double * upper,
303 OsiSolverInterface * strengthenedModel();
313 CglPreProcess * preProcess(
int makeEquality = 0,
int numberPasses = 5,
317 void postProcess(CglPreProcess * process);
345 double * saveLower = NULL,
346 double * saveUpper = NULL);
374 int lessThanThis,
int defaultValue = 1000);
416 bool tightenVubs(
int type,
bool allowMultipleBinary =
false,
417 double useCutoff = 1.0e50);
424 bool tightenVubs(
int numberVubs,
const int * which,
425 double useCutoff = 1.0e50);
439 void saveModel(OsiSolverInterface * saveSolver,
double * checkCutoffForRestart,
bool * feasible);
464 const inline OsiObject *
object(
int which)
const {
781 bool doCutsNow(
int allowForTopOfTree)
const;
975 return solver_->getNumElements();
1004 return solver_->getColUpper();
1017 return solver_->getRowSense();
1029 return solver_->getRightHandSide();
1041 return solver_->getRowRange();
1046 return solver_->getRowLower();
1051 return solver_->getRowUpper();
1056 return solver_->getObjCoefficients();
1067 return solver_->isContinuous(colIndex);
1072 return solver_->isBinary(colIndex);
1080 return solver_->isInteger(colIndex);
1085 return solver_->isIntegerNonBinary(colIndex);
1090 return solver_->isFreeBinary(colIndex) ;
1095 return solver_->getMatrixByRow();
1100 return solver_->getMatrixByCol();
1105 return solver_->getInfinity();
1159 double & objectiveValue,
const double *solution,
1160 int fixVariables = 0);
1166 const double * solution);
1175 int fixVariables,
double originalObjValue);
1183 int & numberObjectInfeasibilities)
const;
1207 return solver_->getColSolution();
1212 return solver_->getRowPrice();
1217 return solver_->getReducedCost();
1222 return solver_->getRowActivity();
1278 double objectiveValue,
bool check =
false);
1528 int howOften = 1,
const char * name = NULL,
1529 bool normal =
true,
bool atSolution =
false,
1530 bool infeasible =
false,
int howOftenInSub = -100,
1531 int whatDepth = -1,
int whatDepthInSub = -1);
1607 return object_[sequence]->priority();
1662 void newLanguage(CoinMessages::Language language);
1745 void goToDantzig(
int numberNodes, ClpDualRowPivot *& savePivotMethod);
1762 CbcModel(
const OsiSolverInterface &);
1816 OsiSolverInterface * returnSolver =
solver_;
1818 return returnSolver;
1996 CbcNode * oldNode, OsiCuts & cuts,
1997 bool & resolved, CoinWarmStartBasis *lastws,
1998 const double * lowerBefore,
const double * upperBefore,
1999 OsiSolverBranch * & branches);
2008 CoinWarmStartBasis *
getEmptyBasis(
int ns = 0,
int na = 0)
const ;
2022 bool allowResolve, OsiCuts * saveCuts,
2023 int numberNewCuts = 0,
const OsiRowCut ** newCuts = NULL) ;
2038 int addCuts(
CbcNode * node, CoinWarmStartBasis *&lastws,
bool canFix);
2061 double & lower,
double & upper,
int force);
2088 int * numberDown = NULL,
int * numberUp = NULL,
2089 int * numberDownInfeasible = NULL,
2090 int * numberUpInfeasible = NULL)
const;
2150 # ifdef COIN_HAS_CLP
2178 int numberFixed,
bool ifInfeasible);
2526 # ifdef COIN_HAS_CLP
2531 # ifdef CBC_ONLY_CLP
2670 double & originalUpper) ;
2673 class OsiClpSolverInterface;
2674 int CbcMain (
int argc,
const char *argv[], OsiClpSolverInterface & solver,
CbcModel ** babSolver);
2677 int callCbc(
const char * input2, OsiClpSolverInterface& solver1);
2678 int callCbc(
const char * input2);
2679 int callCbc(
const std::string input2, OsiClpSolverInterface& solver1);
2680 int callCbc(
const std::string input2) ;
bool ownObjects() const
Now we may not own objects - just point to solver's objects.
void clearNumberGlobalViolations()
Holds solution at continuous (after cuts if branchAndBound called)
int getMaximumCutPassesAtRoot() const
Get the maximum number of cut passes at root node.
int getCurrentPassNumber() const
Get current cut pass number in this round of cuts.
int maximumRows_
Maximum number of rows.
bool isProvenDualInfeasible() const
Was continuous solution unbounded.
CbcModel * subTreeModel(OsiSolverInterface *solver=NULL) const
For retrieving a copy of subtree model with given OsiSolver.
CbcCutGenerator ** cutGenerators() const
Get the list of cut generators.
bool isNodeLimitReached() const
Node limit reached?
void previousBounds(CbcNode *node, CbcNodeInfo *where, int iColumn, double &lower, double &upper, int force)
Returns bounds just before where - initially original bounds.
void setHotstartSolution(const double *solution, const int *priorities=NULL)
Pass in target solution and optional priorities.
bool isIntegerNonBinary(int colIndex) const
Return true if variable is general integer.
int numberRowsAtContinuous_
Number of rows at continuous.
void setStrategy(CbcStrategy &strategy)
Set the strategy. Clones.
double * hotstartSolution_
Hotstart solution.
int getMaximumNodes() const
Get the maximum node limit .
void saveBestSolution(const double *solution, double objectiveValue)
Save a solution to best and move current to saved.
bool defaultHandler_
Flag to say if handler_ is the default handler.
bool feasibleSolution(int &numberIntegerInfeasibilities, int &numberObjectInfeasibilities) const
Test the current solution for feasiblility.
CbcBranchDecision * branchingMethod_
Variable selection function.
int getNumberThreads() const
Get number of threads.
char * integerInfo_
Whether of not integer.
double originalContinuousObjective_
Value of objective before root node cuts added.
int lastNumberCuts2_
The solver associated with this model.
double getIntegerTolerance() const
Get the integrality tolerance .
double getContinuousObjective() const
Value of objective at continuous.
double getInfinity() const
Get solver's value for infinity.
Just a marker, so that a static sized array can store parameters.
int numberStrongIterations_
Number of iterations in strong branching.
int currentNumberCuts_
Number of entries in addedCuts_.
int numberExtraIterations() const
Number of extra iterations.
void setNumberStrong(int number)
Set the maximum number of candidates to be evaluated for strong branching.
void saveReferenceSolver()
Save a copy of the current solver so can be reset to.
CbcModel * parentModel_
Parent model.
int strongInfo_[7]
0 - number times strong branching done, 1 - number fixed, 2 - number infeasible Second group of three...
CoinMessages messages_
Cbc messages.
void unlockThread()
To do with threads.
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...
Stop doing heuristics when the gap between the objective value of the best known solution and the bes...
double getMinimumDrop() const
Get the minimum drop to continue cuts.
int currentDepth_
Current depth.
double * continuousSolution_
Holds solution at continuous (after cuts)
double savedSolutionObjective(int which) const
Return a saved solution objective (0==best) - COIN_DBL_MAX if off end.
double * analyzeResults_
Arrays with analysis results.
OsiSolverInterface * referenceSolver_
A copy of the solver, taken at constructor or by saveReferenceSolver.
CbcCompareBase * nodeComparison() const
int numberStoppedSubTrees_
Number of times any subtree stopped on nodes, time etc.
void setBestSolution(CBC_Message how, double &objectiveValue, const double *solution, int fixVariables=0)
Record a new incumbent solution and update objectiveValue.
int splitModel(int numberModels, CbcModel **model, int numberNodes)
Split up nodes.
void setModelOwnsSolver(bool ourSolver)
Set ownership of solver.
bool isAbandoned() const
Are there a numerical difficulties?
int howOftenGlobalScan() const
Get how often to scan global cuts.
void deleteObjects(bool findIntegers=true)
Delete all object information (and just back to integers if true)
CbcThread * masterThread() const
To do with threads.
bool isSolutionLimitReached() const
Solution limit reached?
int numberBeforeTrust_
The number of branches before pseudo costs believed in dynamic strong branching.
int maximumCutPasses_
Maximum number of cut passes.
void setNumberPenalties(int number)
Set the number of variables for which to compute penalties in dynamic strong branching.
void CbcMain0(CbcModel &babSolver)
const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
OsiSolverInterface * solver() const
Returns solver - has current state.
const double * cbcColUpper_
Pointer to array[getNumCols()] (for speed) of column upper bounds.
void saveSolution(const OsiSolverInterface *osi, std::string fileName)
int maximumStatistics_
Maximum number of statistics.
CbcHeuristic * lastHeuristic() const
Pointer to heuristic solver which found last solution (or NULL)
bool setMaximumNodes(int value)
Set the maximum node limit .
double getObjValue() const
Get best objective function value.
int maximumCuts_
The solver associated with this model.
const double * getCbcRowLower() const
Get pointer to array[getNumRows()] (for speed) of row lower bounds.
const double * getCbcRowUpper() const
Get pointer to array[getNumRows()] (for speed) of row upper bounds.
bool setHeuristicGap(double value)
Set the heuristic gap between the best known solution and the best possible solution.
void checkModel()
Check original model before it gets messed up.
int currentPassNumber_
Current cut pass number.
int continuousPriority_
Anything with priority >= this can be treated as continuous.
Optimization direction - stored for speed.
void setNumberAnalyzeIterations(int number)
Number of analyze iterations to do.
bool setPrintingMode(int value)
Set the printing mode.
double dblParam_[CbcLastDblParam]
Array for double parameters.
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...
int secondaryStatus_
Secondary status of problem -1 unset (status_ will also be -1) 0 search completed with solution 1 lin...
int numberSolutions_
Number of solutions.
void incrementExtra(int nodes, int iterations)
semi-private i.e. users should not use
void setNumberObjects(int number)
Set the number of objects.
const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
CoinWarmStart * emptyWarmStart_
Pointer to an empty warm start object.
bool setAllowablePercentageGap(double value)
Set the percentage allowable gap between the best known solution and the best possible solution...
int numberHeuristics_
Number of heuristics.
int numberIterations_
Cumulative number of iterations.
void saveModel(OsiSolverInterface *saveSolver, double *checkCutoffForRestart, bool *feasible)
Save copy of the model.
const double * cbcRowLower_
Pointer to array[getNumRows()] (for speed) of row lower bounds.
The maximum number of solutions before terminating.
void setBranchingMethod(CbcBranchDecision *method)
Set the branching decision method.
bool addCuts1(CbcNode *node, CoinWarmStartBasis *&lastws)
Traverse the tree from node to root and prep the model.
void setMaximumCutPassesAtRoot(int value)
Set the maximum number of cut passes at root node (default 20) Minimum drop can also be used for fine...
const double * hotstartSolution() const
Get the hotstart solution.
const double * cbcRowActivity_
Pointer to array[getNumRows()] (for speed) of row activity levels.
void setProblemFeasibility(CbcFeasibilityBase *feasibility)
double sumChangeObjective2_
Sum of Changes to objective by subsequent solves.
double * bestSolution_
Array holding the incumbent (best) solution.
bool isInitialSolveProvenOptimal() const
Is optimality proven (for initialSolve) ?
int numberLongStrong_
Number of long strong goes.
void setContinuousInfeasibilities(int value)
Holds solution at continuous (after cuts if branchAndBound called)
const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
void setProblemType(int number)
Problem type as set by user or found by analysis.
int maximumSavedSolutions() const
Maximum number of extra saved solutions.
The objective is assumed to worsen by this amount for each integer infeasibility. ...
void setSolutionCount(int value)
Set number of solutions (so heuristics will be different)
int numberObjects_
Total number of objects.
void resetModel()
Clears out enough to reset CbcModel cutoff etc.
void setNumberStrongIterations(int number)
Set the number of iterations done in strong branching.
int currentDepth() const
Current depth.
const double * testSolution_
For testing infeasibilities - will point to currentSolution_ or solver–>getColSolution() ...
CoinMessages * messagesPointer()
Return pointer to messages.
void setSearchStrategy(int value)
Set strategy worked out - mainly at root node for use by CbcNode.
int stateOfSearch() const
State of search 0 - no solution 1 - only heuristic solutions 2 - branched to a solution 3 - no soluti...
Abstract cut modifier base class.
bool setCutoffIncrement(double value)
Set the CbcModel::CbcCutoffIncrement desired.
bool isContinuousUnbounded() const
Was continuous solution unbounded.
Base class for Cbc event handling.
The amount by which to tighten the objective function cutoff when a new solution is discovered...
int numberIntegers_
Number of integers in problem.
int CbcMain(int argc, const char *argv[], OsiClpSolverInterface &solver, CbcModel **babSolver)
int whenCuts_
At which depths to do cuts.
bool solveWithCuts(OsiCuts &cuts, int numberTries, CbcNode *node)
Evaluate a subproblem using cutting planes and heuristics.
CoinThreadRandom * randomNumberGenerator()
Thread specific random number generator.
double getInfeasibilityWeight() const
Get the weight per integer infeasibility .
const int * integerVariable() const
Number of rows in continuous (root) problem.
double getHeuristicFractionGap() const
Get the fraction heuristic gap between the best known solution and the best possible solution...
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 zapIntegerInformation(bool leaveObjects=true)
Zap integer information in problem (may leave object info)
CoinWarmStartBasis bestSolutionBasis_
Warm start object produced by heuristic or strong branching.
void setPenaltyScaleFactor(double value)
Set scale factor to make penalties match strong.
const int * strongInfo() const
Return strong info.
void setMaximumSavedSolutions(int value)
Set maximum number of extra saved solutions.
CbcFeasibilityBase * problemFeasibility() const
CbcAction
Action codes returned by the event handler.
OsiBranchingInformation usefulInformation() const
Generate an OsiBranchingInformation object.
int numberRowsAtContinuous() const
Number of rows in continuous (root) problem.
void setTestSolution(const double *solution)
Holds solution at continuous (after cuts if branchAndBound called)
int getNumberHeuristicSolutions() const
Get number of heuristic solutions.
void moveToModel(CbcModel *baseModel, int mode)
Move/copy information from one model to another -1 - initialization 0 - from base model 1 - to base m...
const double * getCbcRowActivity() const
Get pointer to array[getNumRows()] (for speed) of row activity levels.
void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
CoinMessageHandler * messageHandler() const
Return handler.
int getNumCols() const
Get number of columns.
int * usedInSolution_
Array marked whenever a solution is found if non-zero.
int numberPenalties() const
get the number of variables for which to compute penalties in dynamic strong branching.
OsiCuts globalCuts_
Global cuts.
CoinBigIndex getNumElements() const
Get number of nonzero elements.
double * currentSolution_
Array holding the current solution.
int numberStoppedSubTrees() const
Returns number of times any subtree stopped on nodes, time etc.
CbcHeuristic ** heuristic_
Heuristic solvers.
CbcModel * findCliques(bool makeEquality, int atLeastThisMany, int lessThanThis, int defaultValue=1000)
Identify cliques and construct corresponding objects.
void setNodeComparison(CbcCompareBase *compare)
void synchronizeNumberBeforeTrust(int type=0)
Set numberBeforeTrust in all objects.
bool modelOwnsSolver()
Get ownership of solver.
CoinWarmStartBasis * getEmptyBasis(int ns=0, int na=0) const
Return an empty basis object of the specified size.
OsiSolverInterface * referenceSolver() const
A copy of the solver, taken at constructor or by saveReferenceSolver.
CBC_Message
This deals with Cbc messages (as against Clp messages etc).
CbcHeuristic * lastHeuristic_
Pointer to heuristic solver which found last solution (or NULL)
void setApplicationData(void *appData)
Set application data.
void passInSolverCharacteristics(OsiBabSolver *solverCharacteristics)
For advanced applications you may wish to modify the behavior of Cbc e.g.
double rootObjectiveAfterCuts() const
Value of objective after root node cuts added.
The maximum amount the value of an integer variable can vary from integer and still be considered fea...
CoinWarmStartBasis workingBasis_
Work basis for temporary use.
void analyzeObjective()
Analyze problem to find a minimum change in the objective function.
const double * cbcRowUpper_
Pointer to array[getNumRows()] (for speed) of row upper bounds.
double penaltyScaleFactor() const
Get scale factor to make penalties match strong.
const double * cbcColLower_
Whether to automatically do presolve before branch and bound.
CbcCutModifier * cutModifier_
Cut modifier function.
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.
int specialOptions() const
Get special options.
int maximumRows() const
Maximum number of rows.
CbcCompareBase * nodeCompare_
User node comparison function.
double continuousObjective_
Value of objective at continuous (Well actually after initial round of cuts)
void gutsOfDestructor()
Clears out as much as possible (except solver)
const double * getCbcReducedCost() const
Get a pointer to array[getNumCols()] (for speed) of reduced costs.
int numberUpdateItems_
Number of outstanding update information items.
void addUpdateInformation(const CbcObjectUpdateData &data)
Adds an update information object.
void setStopNumberIterations(int value)
Set number of "iterations" to stop after.
Information required to recreate the subproblem at this node.
int callCbc1(const char *input2, CbcModel &babSolver)
OsiObject ** object_
Integer and Clique and ...
int maximumWhich_
Maximum number of cuts (for whichGenerator_)
bool isContinuous(int colIndex) const
Return true if variable is continuous.
int maximumDepth_
Current limit on search tree depth.
const double * getCbcColSolution() const
Get pointer to array[getNumCols()] (for speed) of primal solution vector.
const double * getCbcRowPrice() const
Get pointer to array[getNumRows()] (for speed) of dual prices.
For gathering statistics.
void passInTreeHandler(CbcTree &tree)
For modifying tree handling (original is cloned)
double ** savedSolutions_
Arrays holding other solutions.
bool isProvenOptimal() const
Is optimality proven?
int addCuts(CbcNode *node, CoinWarmStartBasis *&lastws, bool canFix)
Determine and install the active cuts that need to be added for the current subproblem.
int getStopNumberIterations() const
Get number of "iterations" to stop after.
OsiSolverInterface * swapSolver(OsiSolverInterface *solver)
Returns current solver - sets new one.
bool setHeuristicFractionGap(double value)
Set the fraction heuristic gap between the best known solution and the best possible solution...
int getPreferredWay() const
Get the preferred way to branch (default 0)
int numberAnalyzeIterations() const
Set an integer parameter.
CbcStatistics ** statistics_
statistics
Smallest non-zero change on a branch.
const double * savedSolution(int which) const
Return a saved solution (0==best) - NULL if off end.
int numberPenalties_
The number of variables for which to compute penalties in dynamic strong branching.
void setMaximumCutPasses(int value)
Set the maximum number of cut passes at other nodes (default 10) Minimum drop can also be used for fi...
char integerType(int i) const
Whether or not integer.
void incrementStrongInfo(int numberTimes, int numberIterations, int numberFixed, bool ifInfeasible)
Increment strong info.
CoinThreadRandom randomNumberGenerator_
Thread specific random number generator.
int numberThreads_
Parallel 0 - off 1 - testing 2-99 threads other special meanings.
void newLanguage(CoinMessages::Language language)
Set language.
const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
void moveInfo(const CbcModel &rhs)
Move status, nodes etc etc across.
void mergeModels(int numberModel, CbcModel **model, int numberNodes)
Merge models.
OsiBabSolver * solverCharacteristics_
For advanced applications you may wish to modify the behavior of Cbc e.g.
Cutoff - stored for speed.
void redoWalkBack()
Redo walkback arrays.
Stop when the gap between the objective value of the best known solution and the best bound on the ob...
int numberObjects() const
Get the number of objects.
bool integerPresolveThisModel(OsiSolverInterface *originalSolver, bool weak=false)
Do integer presolve, modifying the current model.
void setNumberHeuristicSolutions(int value)
Set number of heuristic solutions.
void setPreferredWay(int value)
Set global preferred way to branch -1 down, +1 up, 0 no preference.
int priority(int sequence) const
Returns priority level for an object (or 1000 if no priorities exist)
CbcCountRowCut ** addedCuts() const
Return the list of cuts initially collected for this subproblem.
OsiRowCut * nextRowCut_
A pointer to a row cut which will be added instead of normal branching.
void setOriginalColumns(const int *originalColumns)
Set original columns as created by preprocessing.
void setOptionalInteger(int index)
Get the number of objects.
Stop doing heuristics when the gap between the objective value of the best known solution and the bes...
int numberFixedAtRoot_
Number of fixed by analyze at root.
int getMaximumSolutions() const
Get the maximum number of solutions desired.
void assignSolver(OsiSolverInterface *&solver, bool deleteSolver=true)
Assign a solver to the model (model assumes ownership)
bool isInitialSolveProvenPrimalInfeasible() const
Is primal infeasiblity proven (for initialSolve) ?
CbcThread * masterThread_
Pointer to masterthread.
bool setAllowableFractionGap(double value)
Set the fraction allowable gap between the best known solution and the best possible solution...
int secondaryStatus() const
Secondary status of problem -1 unset (status_ will also be -1) 0 search completed with solution 1 lin...
CbcStrategy * strategy() const
Get the current strategy.
CbcStrategy * strategy_
Strategy.
bool ownObjects_
Now we may not own objects - just point to solver's objects.
CglStored * storedRowCuts() const
Get stored row cuts for donor/recipient CbcModel.
CoinMessages & messages()
Return messages.
const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels.
Just a marker, so that a static sized array can store parameters.
void goToDantzig(int numberNodes, ClpDualRowPivot *&savePivotMethod)
Go to dantzig pivot selection if easy problem (clp only)
void makeGlobalCuts(int numberRows, const int *which)
Make given rows (L or G) into global cuts and remove from lp.
The maximum number of seconds before terminating.
double getCutoff() const
Get the cutoff bound on the objective function - always as minimize.
CbcBaseModel * master_
Thread stuff for master.
double getMinimizationObjValue() const
Get best objective function value as minimization.
bool setInfeasibilityWeight(double value)
Set the weight per integer infeasibility .
const double * getCbcColLower() const
Get pointer to array[getNumCols()] (for speed) of column lower bounds.
void incrementIterationCount(int value)
Increment how many iterations it took to solve the problem.
bool setIntegerTolerance(double value)
Set the integrality tolerance .
int numberSolves_
Cumulative number of solves.
const double * getCbcColUpper() const
Get pointer to array[getNumCols()] (for speed) of column upper bounds.
double * currentSolution() const
Solution to the most recent lp relaxation.
double bestPossibleObjective_
Best possible objective.
int numberSavedSolutions() const
Number of saved solutions (including best)
CbcFeasibilityBase * problemFeasibility_
User feasibility function (see CbcFeasibleBase.hpp)
int intParam_[CbcLastIntParam]
Array for integer parameters.
CbcNodeInfo ** lastNodeInfo_
The solver associated with this model.
int stateOfSearch_
State of search 0 - no solution 1 - only heuristic solutions 2 - branched to a solution 3 - no soluti...
bool isSecondsLimitReached() const
Time limit reached?
bool setMaximumSeconds(double value)
Set the maximum number of seconds desired.
bool isInitialSolveProvenDualInfeasible() const
Is dual infeasiblity proven (for initialSolve) ?
void adjustHeuristics()
Adjust heuristics based on model.
int serialCuts(OsiCuts &cuts, CbcNode *node, OsiCuts &slackCuts, int lastNumberCuts)
Generate one round of cuts - serial mode returns - 0 - normal 1 - must keep going 2 - set numberTries...
int logLevel() const
Get log level.
virtual CbcBranchDecision * clone() const =0
Clone.
Sum of non-zero changes on a branch.
void gutsOfDestructor2()
Clears out enough to reset CbcModel as if no branch and bound done.
double numberDJFixed_
Number of reduced cost fixings.
void setContinuousPriority(int value)
Set anything with priority >= this can be treated as continuous.
void makeGlobalCut(const OsiRowCut *cut)
Make given cut into a global cut.
int maximumNumberUpdateItems_
Maximum number of outstanding update information items.
int maximumCutPassesAtRoot_
Maximum number of cut passes at root.
void setObjectiveValue(CbcNode *thisNode, const CbcNode *parentNode) const
Set objective value in a node.
int * originalColumns_
Original columns as created by integerPresolve or preprocessing.
const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
double minimumDrop_
Minimum degradation in objective value to continue cut generation.
void setLanguage(CoinMessages::Language language)
Pass in Message handler (not deleted at end)
int parallelCuts(CbcBaseModel *master, OsiCuts &cuts, CbcNode *node, OsiCuts &slackCuts, int lastNumberCuts)
Generate one round of cuts - parallel mode returns - 0 - normal 1 - must keep going 2 - set numberTri...
int fastNodeDepth_
Depth for fast nodes.
int maximumSavedSolutions_
Maximum number of saved solutions.
void setProblemStatus(int value)
Are there a numerical difficulties?
void setDefaultHandler(bool yesNo)
Set flag to say if handler_ is the default handler.
const OsiObject * object(int which) const
Get the specified object.
double penaltyScaleFactor_
Scale factor to make penalties match strong.
double getSolverObjValue() const
Get solver objective function value (as minimization)
void deleteSolutions()
Delete best and saved solutions.
void setBranchingMethod(CbcBranchDecision &method)
Set the branching method.
bool setDblParam(CbcDblParam key, double value)
Set a double parameter.
void addHeuristic(CbcHeuristic *generator, const char *name=NULL, int before=-1)
Add one heuristic - up to user to delete.
double getDblParam(CbcDblParam key) const
Get a double parameter.
const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
int numberGlobalViolations_
Number of times global cuts violated.
void resetToReferenceSolver()
Uses a copy of reference solver to be current solver.
Stop when the gap between the objective value of the best known solution and the best bound on the ob...
void saveExtraSolution(const double *solution, double objectiveValue)
Save a solution to saved list.
int numberGlobalViolations() const
Number of times global cuts violated.
int getNodeCount() const
Get how many Nodes it took to solve the problem.
void incrementNodeCount(int value)
Increment how many nodes it took to solve the problem.
void setResolveAfterTakeOffCuts(bool yesNo)
Holds solution at continuous (after cuts if branchAndBound called)
int getMaximumCutPasses() const
Get the maximum number of cut passes at other nodes (default 10)
int problemType() const
Set an integer parameter.
CbcEventHandler * getEventHandler() const
Retrieve a pointer to the event handler.
int getSolutionCount() const
Get number of solutions.
int numberIntegers() const
Number of integers in problem.
void setHowOftenGlobalScan(int number)
Set how often to scan global cuts.
A class to encapsulate thread stuff.
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 convertToDynamic()
If numberBeforeTrust >0 then we are going to use CbcBranchDynamic.
void createContinuousSolver()
Create solver with continuous state.
int maximumNumberIterations() const
Get maximum number of iterations (designed to be used in heuristics)
void generateCpp(FILE *fp, int options)
Create C++ lines to get to current state.
OsiObject * modifiableObject(int which) const
Get the specified object.
CglTreeProbingInfo * probingInfo_
Probing info.
CbcNode * currentNode_
Current node so can be used elsewhere.
void setStoredRowCuts(CglStored *cuts)
Set stored row cuts for donor/recipient CbcModel.
int callCbc(const char *input2, OsiClpSolverInterface &solver1)
CoinWarmStartBasis & workingBasis()
Work basis for temporary use.
const double * testSolution() const
For testing infeasibilities - will point to currentSolution_ or solver–>getColSolution() ...
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...
void setNextRowCut(const OsiRowCut &cut)
Copy and set a pointer to a row cut which will be added instead of normal branching.
const char * integerType() const
Whether or not integer.
CbcTree * tree() const
Tree method e.g. heap (which may be overridden by inheritance)
void setPointers(const OsiSolverInterface *solver)
Set pointers for speed.
int numberStrong_
Maximum number of candidates to consider for strong branching.
int reducedCostFix()
Perform reduced cost fixing.
CbcModel * integerPresolve(bool weak=false)
Do integer presolve, creating a new (presolved) model.
int preferredWay_
Preferred way of branching.
CoinMessageHandler * handler_
Message handler.
CglTreeProbingInfo * probingInfo() const
Get a pointer to probing info.
int getThreadMode() const
Get thread mode.
int getIntParam(CbcIntParam key) const
Get an integer parameter.
int getPrintingMode() const
Get the printing mode.
int * integerVariable_
Indices of integer variables.
bool isLocked() const
From here to end of section - code in CbcThread.cpp until class changed Returns true if locked...
bool setMaximumSolutions(int value)
Set the maximum number of solutions desired.
void reserveCurrentSolution(const double *solution=NULL)
Make sure region there and optionally copy solution.
const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
void passInMessageHandler(CoinMessageHandler *handler)
Pass in Message handler (not deleted at end)
int typePresolve() const
Whether to automatically do presolve before branch and bound (subTrees).
void setFastNodeDepth(int value)
Set depth for fast nodes.
CbcModel & operator=(const CbcModel &rhs)
Assignment operator.
int getIterationCount() const
Get how many iterations it took to solve the problem.
int numberOldActiveCuts_
Number of old active cuts.
int * whichGenerator_
Which cut generator generated this cut.
const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
int numberSavedSolutions_
Number of saved solutions.
int specialOptions_
Special options 0 bit (1) - check if cuts valid (if on debugger list) 1 bit (2) - use current basis t...
const OsiBabSolver * solverCharacteristics() const
Get solver characteristics.
void * getApplicationData() const
Get application data.
int searchStrategy() const
Strategy worked out - mainly at root node for use by CbcNode.
void getIntegerInformation(const OsiObject *object, double &originalLower, double &originalUpper)
So we can use osiObject or CbcObject during transition.
double getHeuristicGap() const
Get the heuristic gap between the best known solution and the best possible solution.
void setStrategy(CbcStrategy *strategy)
Set the strategy. assigns.
void doHeuristicsAtRoot(int deleteHeuristicsAfterwards=0)
Do heuristics at root.
int moreSpecialOptions() const
Get more special options.
void setLastHeuristic(CbcHeuristic *last)
set last heuristic which found a solution
int numberHeuristics() const
Get the number of heuristics.
int presolve_
Presolve for CbcTreeLocal.
CbcNode * currentNode() const
Get a pointer to current node (be careful)
int numberStrongIterations() const
Get the number of iterations done in strong branching.
double getAllowablePercentageGap() const
Get the percentage allowable gap between the best known solution and the best possible solution...
CbcModel()
Default Constructor.
double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
void initialSolve()
Solve the initial LP relaxation.
void passInSubTreeModel(CbcModel &model)
For passing in an CbcModel to do a sub Tree (with derived tree handlers).
int numberFixedNow_
Number fixed by analyze so far.
CbcEventHandler::CbcAction dealWithEventHandler(CbcEventHandler::CbcEvent event, double objValue, const double *solution)
Deals with event handler and solution.
int numberHeuristicSolutions_
Number of heuristic solutions.
double * bestSolution() const
The best solution to the integer programming problem.
bool isFreeBinary(int colIndex) const
Return true if variable is binary and not fixed at either bound.
void passInEventHandler(const CbcEventHandler *eventHandler)
Set an event handler.
int stopNumberIterations_
For threads - stop after this many "iterations".
const int * hotstartPriorities() const
Get the hotstart priorities.
void setNumberBeforeTrust(int number)
Set the number of branches before pseudo costs believed in dynamic strong branching.
bool resolveAfterTakeOffCuts() const
Whether to force a resolve after takeOffCuts.
double getBestPossibleObjValue() const
Get best possible objective function value.
int numberStrong() const
Get the maximum number of candidates to be evaluated for strong branching.
double bestObjective_
Best objective.
const OsiRowCut ** lastCut_
The solver associated with this model.
void setCutoff(double value)
Set cutoff bound on the objective function.
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 setSecondaryStatus(int value)
Are there a numerical difficulties?
int numberExtraIterations_
Number of extra iterations in fast lp.
CbcCutGenerator * virginCutGenerator(int i) const
Get the specified cut generator before any changes.
void pseudoShadow(int type)
Fill in useful estimates.
void setWhenCuts(int value)
Set at which depths to do cuts.
const double * cbcColSolution_
Pointer to array[getNumCols()] (for speed) of primal solution vector.
int phase() const
Current phase (so heuristics etc etc can find out).
CbcCutModifier * cutModifier() const
Get the current cut modifier method.
CbcNode ** solveOneNode(int whichSolver, CbcNode *node, int &numberNodesOutput, int &status)
Input one node output N nodes to put on tree and optional solution update This should be able to oper...
int problemType_
Problem type as set by user or found by analysis.
void setNumberThreads(int value)
Set number of threads.
int moreSpecialOptions_
More special options at present bottom 3 bits used for shadow price mode.
void setContinuousObjective(double value)
Holds solution at continuous (after cuts if branchAndBound called)
void * appData_
Pointer to user-defined data structure.
int * usedInSolution() const
Array marked whenever a solution is found if non-zero.
double * continuousSolution() const
Holds solution at continuous (after cuts if branchAndBound called)
bool isInteger(int colIndex) const
Return true if column is integer.
CbcCutGenerator * cutGenerator(int i) const
Get the specified cut generator.
int printFrequency_
Print frequency.
void incrementUsed(const double *solution)
Increases usedInSolution for nonzeros.
Implementation of live set as a heap.
CbcCountRowCut ** addedCuts_
The list of cuts initially collected for this subproblem.
int status() const
Final status of problem Some of these can be found out by is......
OsiSolverInterface * continuousSolver() const
Returns solver with continuous state.
CbcObjectUpdateData * updateItems_
Update items.
void addObjects(int numberObjects, OsiObject **objects)
Add in object information.
double sumChangeObjective() const
Sum of Changes to objective by first solve.
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.
Adjusts printout 1 does different node message with number unsatisfied on last branch.
double sumChangeObjective1_
Sum of Changes to objective by first solve.
CbcModel * parentModel() const
Get the current parent model.
int * lastNumberCuts_
The solver associated with this model.
bool isProvenInfeasible() const
Is infeasiblity proven (or none better than cutoff)?
bool setAllowableGap(double value)
Set the allowable gap between the best known solution and the best possible solution.
void setTypePresolve(int value)
Tree method e.g. heap (which may be overridden by inheritance)
const double * cbcRowPrice_
Pointer to array[getNumRows()] (for speed) of dual prices.
int status_
Status of problem - 0 finished, 1 stopped, 2 difficulties.
int * mutableStrongInfo()
Return mutable strong info.
int currentNumberCuts() const
Number of entries in the list returned by addedCuts()
void setCutAndHeuristicOptions(CbcModel &model)
void resizeWhichGenerator(int numberNow, int numberAfter)
Update size of whichGenerator.
int numberAnalyzeIterations_
Number of analyze iterations to do.
OsiCuts * globalCuts()
Global cuts.
CbcCutGenerator ** generator_
The solver associated with this model.
double getAllowableGap() const
Get the allowable gap between the best known solution and the best possible solution.
void setSpecialOptions(int value)
Set special options 0 bit (1) - check if cuts valid (if on debugger list) 1 bit (2) - use current bas...
Information required while the node is live.
void setMinimumDrop(double value)
Set the minimum drop to continue cuts.
void setMaximumNumberIterations(int value)
Set maximum number of iterations (designed to be used in heuristics)
void synchronizeHandlers(int makeDefault)
Makes all handlers same.
void setLogLevel(int value)
Set log level.
bool setIntParam(CbcIntParam key, int value)
Set an integer parameter.
const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
void setCutModifier(CbcCutModifier *modifier)
Set the cut modifier method.
CbcNodeInfo ** walkback_
Array used to assemble the path between a node and the search tree root.
bool isBinary(int colIndex) const
Return true if variable is binary.
CbcEventHandler * eventHandler_
CbcModel * subTreeModel_
A pointer to model to be used for subtrees.
int maximumNumberCuts_
Maximum number of cuts.
void setThreadMode(int value)
Set thread mode always use numberThreads for branching 1 set then deterministic 2 set then use number...
CglStored * storedRowCuts_
Stored row cuts for donor/recipient CbcModel.
The time at start of model.
int parallelMode() const
Return -2 if deterministic threaded and main thread -1 if deterministic threaded and serial thread 0 ...
void branchAndBound(int doStatistics=0)
Invoke the branch & cut algorithm.
int * hotstartPriorities_
Hotstart priorities.
bool stoppedOnGap_
Whether stopping on gap.
Current minimization objective value.
int numberCutGenerators_
Number of cut generators.
int lastDepth_
The solver associated with this model.
int threadMode_
thread mode always use numberThreads for branching 1 set then deterministic 2 set then use numberThre...
const double * cbcReducedCost_
Get a pointer to array[getNumCols()] (for speed) of reduced costs.
OsiRowCut augmented with bookkeeping.
int numberNodes2_
Cumulative number of nodes for statistics.
OsiSolverInterface * continuousSolver_
A copy of the solver, taken at the continuous (root) node.
int * originalColumns() const
Original columns as created by integerPresolve or preprocessing.
void setBestObjectiveValue(double objectiveValue)
Just update objectiveValue.
bool resolveAfterTakeOffCuts_
Whether to force a resolve after takeOffCuts.
OsiSolverInterface * solver_
The solver associated with this model.
const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
double getCurrentObjValue() const
Get current objective function value.
double getMaximumSeconds() const
Get the maximum number of seconds desired.
double getCurrentMinimizationObjValue() const
Get current minimization objective function value.
double getAllowableFractionGap() const
Get the fraction allowable gap between the best known solution and the best possible solution...
int searchStrategy_
Strategy worked out - mainly at root node.
int CbcMain1(int argc, const char *argv[], CbcModel &babSolver)
void setBestSolutionBasis(const CoinWarmStartBasis &bestSolutionBasis)
Warm start object produced by heuristic or strong branching.
int numberCutGenerators() const
Get the number of cut generators.
int printFrequency() const
Get the print frequency.
int cliquePseudoCosts(int doStatistics)
Use cliques for pseudocost information - return nonzero if infeasible.
const double * getRowPrice() const
Get pointer to array[getNumRows()] of dual prices.
int getNumRows() const
Get number of rows.
Small non-zero change on a branch to be used as guess.
int takeOffCuts(OsiCuts &cuts, bool allowResolve, OsiCuts *saveCuts, int numberNewCuts=0, const OsiRowCut **newCuts=NULL)
Remove inactive cuts from the model.
int continuousInfeasibilities_
Number of infeasibilities at continuous.
int numberBeforeTrust() const
get the number of branches before pseudo costs believed in dynamic strong branching.
CbcEvent
Events known to cbc.
unsigned int ownership_
Ownership of objects and other stuff.
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 passInPriorities(const int *priorities, bool ifNotSimpleIntegers)
Pass in branching priorities.
int numberNodes_
Cumulative number of nodes.
int numberNewCuts_
Number of new cuts.
void clearContinuousSolver()
Clear solver with continuous state.
void setPrintFrequency(int number)
Set the print frequency.
void synchronizeModel()
Ensure attached objects point to this model.
void lockThread()
To do with threads.
void setMoreSpecialOptions(int value)
Set more special options at present bottom 6 bits used for shadow price mode 1024 for experimental ho...
double getCutoffIncrement() const
Get the CbcModel::CbcCutoffIncrement desired.
int fastNodeDepth() const
Get depth for fast nodes.
void setStateOfSearch(int state)
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.
void findIntegers(bool startAgain, int type=0)
Identify integer variables and create corresponding objects.
CbcBranchDecision * branchingMethod() const
Get the current branching decision method.
int getNodeCount2() const
semi-private i.e. users should not use
int continuousPriority() const
Get anything with priority >= this can be treated as continuous.
Number of branches (may be more than number of nodes as may include strong branching) ...
void setParentModel(CbcModel &parentModel)
Set the parent model.
void setMinimizationObjValue(double value)
Set best objective function value as minimization.
CbcHeuristic * heuristic(int i) const
Get the specified heuristic.
void incrementSubTreeStopped()
Says a sub tree was stopped.
void originalModel(CbcModel *presolvedModel, bool weak)
Put back information into the original model after integer presolve.
OsiObject ** objects() const
Get the array of objects.
Simple Branch and bound class.
CbcNodeInfo ** walkback() const
Get pointer to walkback.
bool normalSolver() const
Says if normal solver i.e. has well defined CoinPackedMatrix.
void setObjValue(double value)
Set best objective function value.
CbcCutGenerator ** virginGenerator_
The solver associated with this model.
const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
int getContinuousInfeasibilities() const
Number of infeasibilities at continuous.
The maximum number of nodes before terminating.
void AddIntegers()
Add additional integers.
bool eventHappened_
Whether event happened.
int howOftenGlobalScan_
How often to scan global cuts.
int resolve(CbcNodeInfo *parent, int whereFrom, double *saveSolution=NULL, double *saveLower=NULL, double *saveUpper=NULL)
Reoptimise an LP relaxation.
int numberInfeasibleNodes_
Number of nodes infeasible by normal branching (before cuts)
int whenCuts() const
Get at which depths to do cuts.
int maximumDepthActual_
Maximum depth reached.
bool isInitialSolveAbandoned() const
Are there numerical difficulties (for initialSolve) ?
int phase_
Current phase (so heuristics etc etc can find out).
const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
int maximumNumberIterations_
Maximum number of iterations (designed to be used in heuristics)
bool maximumSecondsReached() const
Return true if maximum time reached.
bool allDynamic() const
Says whether all dynamic integers.
void startSplitModel(int numberIterations)
Start threads.
int numberExtraNodes_
Number of extra nodes in fast lp.
Largest non-zero change on a branch.
Interface between Cbc and Cut Generation Library.