CbcModel.hpp
Go to the documentation of this file.
1 /* $Id: CbcModel.hpp 1409 2009-12-21 16:59:56Z forrest $ */
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 #ifndef CbcModel_H
5 #define CbcModel_H
6 #include <string>
7 #include <vector>
8 #include "CoinFinite.hpp"
9 #include "CoinMessageHandler.hpp"
10 #include "OsiSolverInterface.hpp"
11 #include "OsiBranchingObject.hpp"
12 #include "OsiCuts.hpp"
13 #include "CoinWarmStartBasis.hpp"
14 #include "CbcCompareBase.hpp"
15 #include "CbcMessage.hpp"
16 #include "CbcEventHandler.hpp"
17 #include "ClpDualRowPivot.hpp"
18 
19 //class OsiSolverInterface;
20 
21 class CbcCutGenerator;
22 class CbcBaseModel;
23 class OsiRowCut;
24 class OsiBabSolver;
25 class OsiRowCutDebugger;
26 class CglCutGenerator;
27 class CglStored;
28 class CbcCutModifier;
29 class CglTreeProbingInfo;
30 class CbcHeuristic;
31 class OsiObject;
32 class CbcThread;
33 class CbcTree;
34 class CbcStrategy;
35 class CbcFeasibilityBase;
36 class CbcStatistics;
37 class CbcEventHandler ;
38 class CglPreProcess;
39 # ifdef COIN_HAS_CLP
40 class ClpNodeStuff;
41 #endif
42 // #define CBC_CHECK_BASIS 1
43 
44 //#############################################################################
45 
98 class CbcModel {
99 
100 public:
101 
102  enum CbcIntParam {
104  CbcMaxNumNode = 0,
106  CbcMaxNumSol,
120  CbcPrinting,
126  };
127 
128  enum CbcDblParam {
185  CbcSumChange,
192  };
193 
194  //---------------------------------------------------------------------------
195 
196 public:
198 
199 
203  void initialSolve();
204 
215  void branchAndBound(int doStatistics = 0);
216 private:
217 
225  bool solveWithCuts(OsiCuts & cuts, int numberTries, CbcNode * node);
233  int serialCuts(OsiCuts & cuts, CbcNode * node, OsiCuts & slackCuts, int lastNumberCuts);
241  int parallelCuts(CbcBaseModel * master, OsiCuts & cuts, CbcNode * node, OsiCuts & slackCuts, int lastNumberCuts);
248  CbcNode ** solveOneNode(int whichSolver, CbcNode * node,
249  int & numberNodesOutput, int & status) ;
251  void resizeWhichGenerator(int numberNow, int numberAfter);
252 public:
253 #ifdef CBC_KEEP_DEPRECATED
254  // See if anyone is using these any more!!
259  CbcModel * cleanModel(const double * lower, const double * upper);
276  int subBranchAndBound(CbcModel * model2,
277  CbcModel * presolvedModel,
278  int maximumNodes);
294  int subBranchAndBound(const double * lower, const double * upper,
295  int maximumNodes);
296 
303  OsiSolverInterface * strengthenedModel();
313  CglPreProcess * preProcess( int makeEquality = 0, int numberPasses = 5,
314  int tuning = 5);
317  void postProcess(CglPreProcess * process);
318 #endif
319  void addUpdateInformation(const CbcObjectUpdateData & data);
327  int doOneNode(CbcModel * baseModel, CbcNode * & node, CbcNode * & newNode);
328 
329 public:
343  int resolve(CbcNodeInfo * parent, int whereFrom,
344  double * saveSolution = NULL,
345  double * saveLower = NULL,
346  double * saveUpper = NULL);
348  void makeGlobalCuts(int numberRows, const int * which);
350  void makeGlobalCut(const OsiRowCut * cut);
352  void makeGlobalCut(const OsiRowCut & cut);
354  void makeGlobalCut(const OsiColCut * cut);
356  void makeGlobalCut(const OsiColCut & cut);
358 
361 
373  CbcModel * findCliques(bool makeEquality, int atLeastThisMany,
374  int lessThanThis, int defaultValue = 1000);
375 
384  CbcModel * integerPresolve(bool weak = false);
385 
390  bool integerPresolveThisModel(OsiSolverInterface * originalSolver, bool weak = false);
391 
392 
394  void originalModel(CbcModel * presolvedModel, bool weak);
395 
416  bool tightenVubs(int type, bool allowMultipleBinary = false,
417  double useCutoff = 1.0e50);
418 
424  bool tightenVubs(int numberVubs, const int * which,
425  double useCutoff = 1.0e50);
429  void analyzeObjective();
430 
434  void AddIntegers();
435 
439  void saveModel(OsiSolverInterface * saveSolver, double * checkCutoffForRestart, bool * feasible);
440 
442 
448 
450  inline int numberObjects() const {
451  return numberObjects_;
452  }
454  inline void setNumberObjects(int number) {
455  numberObjects_ = number;
456  }
457 
459  inline OsiObject ** objects() const {
460  return object_;
461  }
462 
464  const inline OsiObject * object(int which) const {
465  return object_[which];
466  }
468  inline OsiObject * modifiableObject(int which) const {
469  return object_[which];
470  }
471 
472  void setOptionalInteger(int index);
473 
475  void deleteObjects(bool findIntegers = true);
476 
481  void addObjects(int numberObjects, OsiObject ** objects);
482 
488 
490  void synchronizeModel() ;
491 
501  void findIntegers(bool startAgain, int type = 0);
502 
504 
505  //---------------------------------------------------------------------------
506 
516  inline bool setIntParam(CbcIntParam key, int value) {
518  intParam_[key] = value;
519  return true;
520  }
522  inline bool setDblParam(CbcDblParam key, double value) {
523  dblParam_[key] = value;
524  return true;
525  }
527  inline int getIntParam(CbcIntParam key) const {
528  return intParam_[key];
529  }
531  inline double getDblParam(CbcDblParam key) const {
532  return dblParam_[key];
533  }
539  void setCutoff(double value) ;
540 
542  inline double getCutoff() const { //double value ;
543  //solver_->getDblParam(OsiDualObjectiveLimit,value) ;
544  //assert( dblParam_[CbcCurrentCutoff]== value * solver_->getObjSense());
545  return dblParam_[CbcCurrentCutoff];
546  }
547 
549  inline bool setMaximumNodes( int value) {
550  return setIntParam(CbcMaxNumNode, value);
551  }
552 
554  inline int getMaximumNodes() const {
555  return getIntParam(CbcMaxNumNode);
556  }
557 
562  inline bool setMaximumSolutions( int value) {
563  return setIntParam(CbcMaxNumSol, value);
564  }
569  inline int getMaximumSolutions() const {
570  return getIntParam(CbcMaxNumSol);
571  }
573  inline bool setPrintingMode( int value) {
574  return setIntParam(CbcPrinting, value);
575  }
576 
578  inline int getPrintingMode() const {
579  return getIntParam(CbcPrinting);
580  }
581 
586  inline bool setMaximumSeconds( double value) {
587  return setDblParam(CbcMaximumSeconds, value);
588  }
593  inline double getMaximumSeconds() const {
595  }
597  double getCurrentSeconds() const ;
598 
600  bool maximumSecondsReached() const ;
601 
605  inline bool setIntegerTolerance( double value) {
606  return setDblParam(CbcIntegerTolerance, value);
607  }
611  inline double getIntegerTolerance() const {
613  }
614 
619  inline bool setInfeasibilityWeight( double value) {
620  return setDblParam(CbcInfeasibilityWeight, value);
621  }
626  inline double getInfeasibilityWeight() const {
628  }
629 
633  inline bool setAllowableGap( double value) {
634  return setDblParam(CbcAllowableGap, value);
635  }
639  inline double getAllowableGap() const {
641  }
642 
646  inline bool setAllowableFractionGap( double value) {
647  return setDblParam(CbcAllowableFractionGap, value);
648  }
652  inline double getAllowableFractionGap() const {
654  }
658  inline bool setAllowablePercentageGap( double value) {
659  return setDblParam(CbcAllowableFractionGap, value*0.01);
660  }
664  inline double getAllowablePercentageGap() const {
665  return 100.0*getDblParam(CbcAllowableFractionGap);
666  }
670  inline bool setHeuristicGap( double value) {
671  return setDblParam(CbcHeuristicGap, value);
672  }
676  inline double getHeuristicGap() const {
678  }
679 
683  inline bool setHeuristicFractionGap( double value) {
684  return setDblParam(CbcHeuristicFractionGap, value);
685  }
689  inline double getHeuristicFractionGap() const {
691  }
696  inline bool setCutoffIncrement( double value) {
697  return setDblParam(CbcCutoffIncrement, value);
698  }
703  inline double getCutoffIncrement() const {
705  }
706 
711  void setHotstartSolution(const double * solution, const int * priorities = NULL) ;
712 
714  inline void setMinimumDrop(double value) {
715  minimumDrop_ = value;
716  }
718  inline double getMinimumDrop() const {
719  return minimumDrop_;
720  }
721 
724  inline void setMaximumCutPassesAtRoot(int value) {
725  maximumCutPassesAtRoot_ = value;
726  }
728  inline int getMaximumCutPassesAtRoot() const {
730  }
731 
734  inline void setMaximumCutPasses(int value) {
735  maximumCutPasses_ = value;
736  }
738  inline int getMaximumCutPasses() const {
739  return maximumCutPasses_;
740  }
743  inline int getCurrentPassNumber() const {
744  return currentPassNumber_;
745  }
746 
752  void setNumberStrong(int number);
756  inline int numberStrong() const {
757  return numberStrong_;
758  }
761  inline void setPreferredWay(int value) {
762  preferredWay_ = value;
763  }
765  inline int getPreferredWay() const {
766  return preferredWay_;
767  }
769  inline int whenCuts() const {
770  return whenCuts_;
771  }
773  inline void setWhenCuts(int value) {
774  whenCuts_ = value;
775  }
781  bool doCutsNow(int allowForTopOfTree) const;
782 
788  void setNumberBeforeTrust(int number);
791  inline int numberBeforeTrust() const {
792  return numberBeforeTrust_;
793  }
799  void setNumberPenalties(int number);
802  inline int numberPenalties() const {
803  return numberPenalties_;
804  }
806  inline void setNumberAnalyzeIterations(int number) {
807  numberAnalyzeIterations_ = number;
808  }
809  inline int numberAnalyzeIterations() const {
811  }
814  inline double penaltyScaleFactor() const {
815  return penaltyScaleFactor_;
816  }
819  void setPenaltyScaleFactor(double value);
827  void inline setProblemType(int number) {
828  problemType_ = number;
829  }
830  inline int problemType() const {
831  return problemType_;
832  }
834  inline int currentDepth() const {
835  return currentDepth_;
836  }
837 
839  void setHowOftenGlobalScan(int number);
841  inline int howOftenGlobalScan() const {
842  return howOftenGlobalScan_;
843  }
845  inline int * originalColumns() const {
846  return originalColumns_;
847  }
849  void setOriginalColumns(const int * originalColumns) ;
850 
858  inline void setPrintFrequency(int number) {
859  printFrequency_ = number;
860  }
862  inline int printFrequency() const {
863  return printFrequency_;
864  }
866 
867  //---------------------------------------------------------------------------
869 
870  bool isAbandoned() const;
873  bool isProvenOptimal() const;
875  bool isProvenInfeasible() const;
877  bool isContinuousUnbounded() const;
879  bool isProvenDualInfeasible() const;
881  bool isNodeLimitReached() const;
883  bool isSecondsLimitReached() const;
885  bool isSolutionLimitReached() const;
887  inline int getIterationCount() const {
888  return numberIterations_;
889  }
891  inline void incrementIterationCount(int value) {
892  numberIterations_ += value;
893  }
895  inline int getNodeCount() const {
896  return numberNodes_;
897  }
899  inline void incrementNodeCount(int value) {
900  numberNodes_ += value;
901  }
911  inline int status() const {
912  return status_;
913  }
914  inline void setProblemStatus(int value) {
915  status_ = value;
916  }
928  inline int secondaryStatus() const {
929  return secondaryStatus_;
930  }
931  inline void setSecondaryStatus(int value) {
932  secondaryStatus_ = value;
933  }
935  bool isInitialSolveAbandoned() const ;
937  bool isInitialSolveProvenOptimal() const ;
942 
944 
945  //---------------------------------------------------------------------------
958  inline int numberRowsAtContinuous() const {
961  }
962 
964  inline int getNumCols() const {
965  return solver_->getNumCols();
966  }
967 
969  inline int getNumRows() const {
970  return solver_->getNumRows();
971  }
972 
974  inline CoinBigIndex getNumElements() const {
975  return solver_->getNumElements();
976  }
977 
979  inline int numberIntegers() const {
980  return numberIntegers_;
981  }
982  // Integer variables
983  inline const int * integerVariable() const {
984  return integerVariable_;
985  }
987  inline char integerType(int i) const {
988  assert (integerInfo_);
989  assert (integerInfo_[i] == 0 || integerInfo_[i] == 1);
990  return integerInfo_[i];
991  }
993  inline const char * integerType() const {
994  return integerInfo_;
995  }
996 
998  inline const double * getColLower() const {
999  return solver_->getColLower();
1000  }
1001 
1003  inline const double * getColUpper() const {
1004  return solver_->getColUpper();
1005  }
1006 
1016  inline const char * getRowSense() const {
1017  return solver_->getRowSense();
1018  }
1019 
1028  inline const double * getRightHandSide() const {
1029  return solver_->getRightHandSide();
1030  }
1031 
1040  inline const double * getRowRange() const {
1041  return solver_->getRowRange();
1042  }
1043 
1045  inline const double * getRowLower() const {
1046  return solver_->getRowLower();
1047  }
1048 
1050  inline const double * getRowUpper() const {
1051  return solver_->getRowUpper();
1052  }
1053 
1055  inline const double * getObjCoefficients() const {
1056  return solver_->getObjCoefficients();
1057  }
1058 
1060  inline double getObjSense() const {
1061  //assert (dblParam_[CbcOptimizationDirection]== solver_->getObjSense());
1063  }
1064 
1066  inline bool isContinuous(int colIndex) const {
1067  return solver_->isContinuous(colIndex);
1068  }
1069 
1071  inline bool isBinary(int colIndex) const {
1072  return solver_->isBinary(colIndex);
1073  }
1074 
1079  inline bool isInteger(int colIndex) const {
1080  return solver_->isInteger(colIndex);
1081  }
1082 
1084  inline bool isIntegerNonBinary(int colIndex) const {
1085  return solver_->isIntegerNonBinary(colIndex);
1086  }
1087 
1089  inline bool isFreeBinary(int colIndex) const {
1090  return solver_->isFreeBinary(colIndex) ;
1091  }
1092 
1094  inline const CoinPackedMatrix * getMatrixByRow() const {
1095  return solver_->getMatrixByRow();
1096  }
1097 
1099  inline const CoinPackedMatrix * getMatrixByCol() const {
1100  return solver_->getMatrixByCol();
1101  }
1102 
1104  inline double getInfinity() const {
1105  return solver_->getInfinity();
1106  }
1108  inline const double * getCbcColLower() const {
1109  return cbcColLower_;
1110  }
1112  inline const double * getCbcColUpper() const {
1113  return cbcColUpper_;
1114  }
1116  inline const double * getCbcRowLower() const {
1117  return cbcRowLower_;
1118  }
1120  inline const double * getCbcRowUpper() const {
1121  return cbcRowUpper_;
1122  }
1124  inline const double * getCbcColSolution() const {
1125  return cbcColSolution_;
1126  }
1128  inline const double * getCbcRowPrice() const {
1129  return cbcRowPrice_;
1130  }
1132  inline const double * getCbcReducedCost() const {
1133  return cbcReducedCost_;
1134  }
1136  inline const double * getCbcRowActivity() const {
1137  return cbcRowActivity_;
1138  }
1140 
1141 
1144  inline double * continuousSolution() const {
1146  return continuousSolution_;
1147  }
1152  inline int * usedInSolution() const {
1153  return usedInSolution_;
1154  }
1156  void incrementUsed(const double * solution);
1158  void setBestSolution(CBC_Message how,
1159  double & objectiveValue, const double *solution,
1160  int fixVariables = 0);
1162  void setBestObjectiveValue( double objectiveValue);
1165  double objValue,
1166  const double * solution);
1167 
1174  double checkSolution(double cutoff, double * solution,
1175  int fixVariables, double originalObjValue);
1182  bool feasibleSolution(int & numberIntegerInfeasibilities,
1183  int & numberObjectInfeasibilities) const;
1184 
1190  inline double * currentSolution() const {
1191  return currentSolution_;
1192  }
1196  inline const double * testSolution() const {
1197  return testSolution_;
1198  }
1199  inline void setTestSolution(const double * solution) {
1200  testSolution_ = solution;
1201  }
1203  void reserveCurrentSolution(const double * solution = NULL);
1204 
1206  inline const double * getColSolution() const {
1207  return solver_->getColSolution();
1208  }
1209 
1211  inline const double * getRowPrice() const {
1212  return solver_->getRowPrice();
1213  }
1214 
1216  inline const double * getReducedCost() const {
1217  return solver_->getReducedCost();
1218  }
1219 
1221  inline const double * getRowActivity() const {
1222  return solver_->getRowActivity();
1223  }
1224 
1226  inline double getCurrentObjValue() const {
1228  }
1230  inline double getCurrentMinimizationObjValue() const {
1232  }
1233 
1235  inline double getMinimizationObjValue() const {
1236  return bestObjective_;
1237  }
1239  inline void setMinimizationObjValue(double value) {
1240  bestObjective_ = value;
1241  }
1242 
1244  inline double getObjValue() const {
1245  return bestObjective_ * solver_->getObjSense() ;
1246  }
1252  double getBestPossibleObjValue() const;
1254  inline void setObjValue(double value) {
1255  bestObjective_ = value * solver_->getObjSense() ;
1256  }
1258  inline double getSolverObjValue() const {
1259  return solver_->getObjValue() * solver_->getObjSense() ;
1260  }
1261 
1268  inline double * bestSolution() const {
1269  return bestSolution_;
1270  }
1277  void setBestSolution(const double * solution, int numberColumns,
1278  double objectiveValue, bool check = false);
1279 
1281  inline int getSolutionCount() const {
1282  return numberSolutions_;
1283  }
1284 
1286  inline void setSolutionCount(int value) {
1287  numberSolutions_ = value;
1288  }
1290  int numberSavedSolutions() const;
1292  inline int maximumSavedSolutions() const {
1293  return maximumSavedSolutions_;
1294  }
1296  void setMaximumSavedSolutions(int value);
1298  const double * savedSolution(int which) const;
1300  double savedSolutionObjective(int which) const;
1301 
1310  inline int phase() const {
1311  return phase_;
1312  }
1313 
1315  inline int getNumberHeuristicSolutions() const {
1317  }
1319  inline void setNumberHeuristicSolutions(int value) {
1320  numberHeuristicSolutions_ = value;
1321  }
1322 
1324  inline void setObjSense(double s) {
1326  solver_->setObjSense(s);
1327  }
1328 
1330  inline double getContinuousObjective() const {
1332  }
1333  inline void setContinuousObjective(double value) {
1335  }
1337  inline int getContinuousInfeasibilities() const {
1339  }
1340  inline void setContinuousInfeasibilities(int value) {
1342  }
1344  inline double rootObjectiveAfterCuts() const {
1345  return continuousObjective_;
1346  }
1348  inline double sumChangeObjective() const {
1349  return sumChangeObjective1_;
1350  }
1353  inline int numberGlobalViolations() const {
1354  return numberGlobalViolations_;
1355  }
1358  }
1360  inline bool resolveAfterTakeOffCuts() const {
1361  return resolveAfterTakeOffCuts_;
1362  }
1363  inline void setResolveAfterTakeOffCuts(bool yesNo) {
1364  resolveAfterTakeOffCuts_ = yesNo;
1365  }
1367  inline int maximumRows() const {
1368  return maximumRows_;
1369  }
1371  inline CoinWarmStartBasis & workingBasis() {
1372  return workingBasis_;
1373  }
1375  inline int getStopNumberIterations() const {
1376  return stopNumberIterations_;
1377  }
1379  inline void setStopNumberIterations(int value) {
1380  stopNumberIterations_ = value;
1381  }
1383 
1386  // Comparison functions (which may be overridden by inheritance)
1387  inline CbcCompareBase * nodeComparison() const {
1388  return nodeCompare_;
1389  }
1390  void setNodeComparison(CbcCompareBase * compare);
1391  void setNodeComparison(CbcCompareBase & compare);
1393 
1396  // Feasibility functions (which may be overridden by inheritance)
1398  return problemFeasibility_;
1399  }
1400  void setProblemFeasibility(CbcFeasibilityBase * feasibility);
1401  void setProblemFeasibility(CbcFeasibilityBase & feasibility);
1403 
1406  inline CbcTree * tree() const {
1408  return tree_;
1409  }
1411  void passInTreeHandler(CbcTree & tree);
1415  void passInSubTreeModel(CbcModel & model);
1420  CbcModel * subTreeModel(OsiSolverInterface * solver = NULL) const;
1422  inline int numberStoppedSubTrees() const {
1423  return numberStoppedSubTrees_;
1424  }
1426  inline void incrementSubTreeStopped() {
1428  }
1434  inline int typePresolve() const {
1435  return presolve_;
1436  }
1437  inline void setTypePresolve(int value) {
1438  presolve_ = value;
1439  }
1440 
1442 
1448 
1451  return branchingMethod_;
1452  }
1454  inline void setBranchingMethod(CbcBranchDecision * method) {
1455  delete branchingMethod_;
1456  branchingMethod_ = method->clone();
1457  }
1462  inline void setBranchingMethod(CbcBranchDecision & method) {
1463  delete branchingMethod_;
1464  branchingMethod_ = method.clone();
1465  }
1467  inline CbcCutModifier * cutModifier() const {
1468  return cutModifier_;
1469  }
1471  void setCutModifier(CbcCutModifier * modifier);
1476  void setCutModifier(CbcCutModifier & modifier);
1478 
1481 
1488  inline int stateOfSearch() const {
1489  return stateOfSearch_;
1490  }
1491  inline void setStateOfSearch(int state) {
1492  stateOfSearch_ = state;
1493  }
1495  inline int searchStrategy() const {
1496  return searchStrategy_;
1497  }
1499  inline void setSearchStrategy(int value) {
1500  searchStrategy_ = value;
1501  }
1502 
1504  inline int numberCutGenerators() const {
1505  return numberCutGenerators_;
1506  }
1508  inline CbcCutGenerator ** cutGenerators() const {
1509  return generator_;
1510  }
1512  inline CbcCutGenerator * cutGenerator(int i) const {
1513  return generator_[i];
1514  }
1516  inline CbcCutGenerator * virginCutGenerator(int i) const {
1517  return virginGenerator_[i];
1518  }
1527  void addCutGenerator(CglCutGenerator * generator,
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);
1533 
1538 
1540  inline CbcStrategy * strategy() const {
1541  return strategy_;
1542  }
1547  strategy_ = strategy;
1548  }
1550  inline CbcModel * parentModel() const {
1551  return parentModel_;
1552  }
1556  }
1558 
1559 
1566  void addHeuristic(CbcHeuristic * generator, const char *name = NULL,
1567  int before = -1);
1569  inline CbcHeuristic * heuristic(int i) const {
1570  return heuristic_[i];
1571  }
1573  inline int numberHeuristics() const {
1574  return numberHeuristics_;
1575  }
1577  inline CbcHeuristic * lastHeuristic() const {
1578  return lastHeuristic_;
1579  }
1581  inline void setLastHeuristic(CbcHeuristic * last) {
1582  lastHeuristic_ = last;
1583  }
1584 
1603  void passInPriorities(const int * priorities, bool ifNotSimpleIntegers);
1604 
1606  inline int priority(int sequence) const {
1607  return object_[sequence]->priority();
1608  }
1609 
1614  void passInEventHandler(const CbcEventHandler *eventHandler) ;
1615 
1618  return (eventHandler_) ;
1619  }
1620 
1622 
1632  void setApplicationData (void * appData);
1633 
1635  void * getApplicationData() const;
1650  inline const OsiBabSolver * solverCharacteristics() const {
1651  return solverCharacteristics_;
1652  }
1654 
1655  //---------------------------------------------------------------------------
1656 
1659  void passInMessageHandler(CoinMessageHandler * handler);
1662  void newLanguage(CoinMessages::Language language);
1663  inline void setLanguage(CoinMessages::Language language) {
1664  newLanguage(language);
1665  }
1667  inline CoinMessageHandler * messageHandler() const {
1668  return handler_;
1669  }
1671  inline CoinMessages & messages() {
1672  return messages_;
1673  }
1675  inline CoinMessages * messagesPointer() {
1676  return &messages_;
1677  }
1679  void setLogLevel(int value);
1681  inline int logLevel() const {
1682  return handler_->logLevel();
1683  }
1689  inline void setDefaultHandler(bool yesNo) {
1690  defaultHandler_ = yesNo;
1691  }
1693  //---------------------------------------------------------------------------
1695 
1696 
1718  inline void setSpecialOptions(int value) {
1719  specialOptions_ = value;
1720  }
1722  inline int specialOptions() const {
1723  return specialOptions_;
1724  }
1726  inline bool normalSolver() const {
1727  return (specialOptions_&16) == 0;
1728  }
1736  inline void setMoreSpecialOptions(int value) {
1737  moreSpecialOptions_ = value;
1738  }
1740  inline int moreSpecialOptions() const {
1741  return moreSpecialOptions_;
1742  }
1744 #ifdef COIN_HAS_CLP
1745  void goToDantzig(int numberNodes, ClpDualRowPivot *& savePivotMethod);
1746 #endif
1747  inline bool ownObjects() const {
1749  return ownObjects_;
1750  }
1752  void checkModel();
1754  //---------------------------------------------------------------------------
1755 
1757 
1758  CbcModel();
1760 
1762  CbcModel(const OsiSolverInterface &);
1763 
1772  void assignSolver(OsiSolverInterface *&solver, bool deleteSolver = true);
1773 
1785  inline void setModelOwnsSolver (bool ourSolver) {
1786  ownership_ = ourSolver ? (ownership_ | 0x80000000) : (ownership_ & (~0x80000000)) ;
1787  }
1788 
1794  inline bool modelOwnsSolver () {
1795  return ((ownership_&0x80000000) != 0) ;
1796  }
1797 
1801  CbcModel(const CbcModel & rhs, bool cloneHandler = false);
1802 
1804  CbcModel & operator=(const CbcModel& rhs);
1805 
1807  ~CbcModel ();
1808 
1810  inline OsiSolverInterface * solver() const {
1811  return solver_;
1812  }
1813 
1815  inline OsiSolverInterface * swapSolver(OsiSolverInterface * solver) {
1816  OsiSolverInterface * returnSolver = solver_;
1817  solver_ = solver;
1818  return returnSolver;
1819  }
1820 
1822  inline OsiSolverInterface * continuousSolver() const {
1823  return continuousSolver_;
1824  }
1825 
1827  inline void createContinuousSolver() {
1828  continuousSolver_ = solver_->clone();
1829  }
1831  inline void clearContinuousSolver() {
1832  delete continuousSolver_;
1833  continuousSolver_ = NULL;
1834  }
1835 
1837  inline OsiSolverInterface * referenceSolver() const {
1838  return referenceSolver_;
1839  }
1840 
1842  void saveReferenceSolver();
1843 
1849  void resetToReferenceSolver();
1850 
1852  void gutsOfDestructor();
1855  void gutsOfDestructor2();
1858  void resetModel();
1864  void gutsOfCopy(const CbcModel & rhs, int mode = 0);
1866  void moveInfo(const CbcModel & rhs);
1868 
1870 
1871  CbcThread * masterThread() const {
1873  return masterThread_;
1874  }
1876  CbcNodeInfo ** walkback() const {
1877  return walkback_;
1878  }
1880  inline int getNumberThreads() const {
1881  return numberThreads_;
1882  }
1884  inline void setNumberThreads(int value) {
1885  numberThreads_ = value;
1886  }
1888  inline int getThreadMode() const {
1889  return threadMode_;
1890  }
1900  inline void setThreadMode(int value) {
1901  threadMode_ = value;
1902  }
1909  inline int parallelMode() const {
1910  if (!numberThreads_) {
1911  if ((threadMode_&1) == 0)
1912  return 0;
1913  else
1914  return -1;
1915  return 0;
1916  } else {
1917  if ((threadMode_&1) == 0)
1918  return 1;
1919  else
1920  return -2;
1921  }
1922  }
1925  bool isLocked() const;
1926 #ifdef CBC_THREAD
1927 
1931  void lockThread();
1935  void unlockThread();
1936 #else
1937  inline void lockThread() {}
1938  inline void unlockThread() {}
1939 #endif
1940 
1947  void setInfoInChild(int type, CbcThread * info);
1954  void moveToModel(CbcModel * baseModel, int mode);
1956  int splitModel(int numberModels, CbcModel ** model,
1957  int numberNodes);
1959  void startSplitModel(int numberIterations);
1961  void mergeModels(int numberModel, CbcModel ** model,
1962  int numberNodes);
1964 
1966 
1967  int getNodeCount2() const {
1969  return numberNodes2_;
1970  }
1972  void setPointers(const OsiSolverInterface * solver);
1978  int reducedCostFix() ;
1982  void synchronizeHandlers(int makeDefault);
1984  void saveExtraSolution(const double * solution, double objectiveValue);
1986  void saveBestSolution(const double * solution, double objectiveValue);
1988  void deleteSolutions();
1990  int resolve(OsiSolverInterface * solver);
1991 
1995  int chooseBranch(CbcNode * & newNode, int numberPassesLeft,
1996  CbcNode * oldNode, OsiCuts & cuts,
1997  bool & resolved, CoinWarmStartBasis *lastws,
1998  const double * lowerBefore, const double * upperBefore,
1999  OsiSolverBranch * & branches);
2000  int chooseBranch(CbcNode * newNode, int numberPassesLeft, bool & resolved);
2001 
2008  CoinWarmStartBasis *getEmptyBasis(int ns = 0, int na = 0) const ;
2009 
2021  int takeOffCuts(OsiCuts &cuts,
2022  bool allowResolve, OsiCuts * saveCuts,
2023  int numberNewCuts = 0, const OsiRowCut ** newCuts = NULL) ;
2024 
2038  int addCuts(CbcNode * node, CoinWarmStartBasis *&lastws, bool canFix);
2039 
2056  bool addCuts1(CbcNode * node, CoinWarmStartBasis *&lastws);
2060  void previousBounds (CbcNode * node, CbcNodeInfo * where, int iColumn,
2061  double & lower, double & upper, int force);
2066  void setObjectiveValue(CbcNode * thisNode, const CbcNode * parentNode) const;
2067 
2071  void convertToDynamic();
2073  void synchronizeNumberBeforeTrust(int type = 0);
2075  void zapIntegerInformation(bool leaveObjects = true);
2077  int cliquePseudoCosts(int doStatistics);
2079  void pseudoShadow(int type);
2086  void fillPseudoCosts(double * downCosts, double * upCosts,
2087  int * priority = NULL,
2088  int * numberDown = NULL, int * numberUp = NULL,
2089  int * numberDownInfeasible = NULL,
2090  int * numberUpInfeasible = NULL) const;
2096  void doHeuristicsAtRoot(int deleteHeuristicsAfterwards = 0);
2098  void adjustHeuristics();
2100  inline const double * hotstartSolution() const {
2101  return hotstartSolution_;
2102  }
2104  inline const int * hotstartPriorities() const {
2105  return hotstartPriorities_;
2106  }
2107 
2109  inline CbcCountRowCut ** addedCuts() const {
2110  return addedCuts_;
2111  }
2113  inline int currentNumberCuts() const {
2114  return currentNumberCuts_;
2115  }
2117  inline OsiCuts * globalCuts() {
2118  return &globalCuts_;
2119  }
2121  void setNextRowCut(const OsiRowCut & cut);
2123  inline CbcNode * currentNode() const {
2124  return currentNode_;
2125  }
2127  inline CglTreeProbingInfo * probingInfo() const {
2128  return probingInfo_;
2129  }
2131  inline CoinThreadRandom * randomNumberGenerator() {
2132  return &randomNumberGenerator_;
2133  }
2135  inline void setNumberStrongIterations(int number) {
2136  numberStrongIterations_ = number;
2137  }
2139  inline int numberStrongIterations() const {
2140  return numberStrongIterations_;
2141  }
2143  inline int maximumNumberIterations() const {
2144  return maximumNumberIterations_;
2145  }
2147  inline void setMaximumNumberIterations(int value) {
2148  maximumNumberIterations_ = value;
2149  }
2150 # ifdef COIN_HAS_CLP
2151  inline void setFastNodeDepth(int value) {
2153  fastNodeDepth_ = value;
2154  }
2156  inline int fastNodeDepth() const {
2157  return fastNodeDepth_;
2158  }
2160  inline int continuousPriority() const {
2161  return continuousPriority_;
2162  }
2164  inline void setContinuousPriority(int value) {
2165  continuousPriority_ = value;
2166  }
2167  inline void incrementExtra(int nodes, int iterations) {
2168  numberExtraNodes_ += nodes;
2169  numberExtraIterations_ += iterations;
2170  }
2171 #endif
2172  inline int numberExtraIterations() const {
2174  return numberExtraIterations_;
2175  }
2177  void incrementStrongInfo(int numberTimes, int numberIterations,
2178  int numberFixed, bool ifInfeasible);
2180  inline const int * strongInfo() const {
2181  return strongInfo_;
2182  }
2183 
2185  inline int * mutableStrongInfo() {
2186  return strongInfo_;
2187  }
2189  CglStored * storedRowCuts() const {
2190  return storedRowCuts_;
2191  }
2193  void setStoredRowCuts(CglStored * cuts) {
2194  storedRowCuts_ = cuts;
2195  }
2197  inline bool allDynamic () const {
2198  return ((ownership_&0x40000000) != 0) ;
2199  }
2201  void generateCpp( FILE * fp, int options);
2203  OsiBranchingInformation usefulInformation() const;
2210  inline void setBestSolutionBasis(const CoinWarmStartBasis & bestSolutionBasis) {
2211  bestSolutionBasis_ = bestSolutionBasis;
2212  }
2214  void redoWalkBack();
2216 
2217 //---------------------------------------------------------------------------
2218 
2219 private:
2221 
2222 
2224  OsiSolverInterface * solver_;
2225 
2231  unsigned int ownership_ ;
2232 
2234  OsiSolverInterface * continuousSolver_;
2235 
2237  OsiSolverInterface * referenceSolver_;
2238 
2240  CoinMessageHandler * handler_;
2241 
2247  bool defaultHandler_;
2248 
2250  CoinMessages messages_;
2251 
2254 
2256  double dblParam_[CbcLastDblParam];
2257 
2266  mutable CoinWarmStart *emptyWarmStart_ ;
2267 
2269  double bestObjective_;
2271  double bestPossibleObjective_;
2273  double sumChangeObjective1_;
2275  double sumChangeObjective2_;
2276 
2278  double * bestSolution_;
2280  double ** savedSolutions_;
2281 
2286  double * currentSolution_;
2290  mutable const double * testSolution_;
2297  CoinWarmStartBasis bestSolutionBasis_ ;
2299  OsiCuts globalCuts_;
2300 
2302  double minimumDrop_;
2304  int numberSolutions_;
2315  int stateOfSearch_;
2317  int whenCuts_;
2319  double * hotstartSolution_;
2321  int * hotstartPriorities_;
2325  int numberNodes_;
2329  int numberNodes2_;
2331  int numberIterations_;
2333  int numberSolves_;
2335  int status_;
2346  int secondaryStatus_;
2348  int numberIntegers_;
2352  int maximumNumberCuts_;
2361  int phase_;
2362 
2364  int currentNumberCuts_;
2365 
2370  int maximumDepth_;
2378  const OsiRowCut ** lastCut_;
2379  int lastDepth_;
2380  int lastNumberCuts2_;
2381  int maximumCuts_;
2382  int * lastNumberCuts_;
2383 
2392 
2396  OsiRowCut * nextRowCut_;
2397 
2400 
2402  int * integerVariable_;
2404  char * integerInfo_;
2406  double * continuousSolution_;
2408  int * usedInSolution_;
2432  int specialOptions_;
2436  int moreSpecialOptions_;
2442  CbcTree * tree_;
2460  const double * cbcColLower_;
2463  const double * cbcColUpper_;
2465  const double * cbcRowLower_;
2467  const double * cbcRowUpper_;
2469  const double * cbcColSolution_;
2471  const double * cbcRowPrice_;
2473  const double * cbcReducedCost_;
2475  const double * cbcRowActivity_;
2477  void * appData_;
2479  int presolve_;
2483  int numberStrong_;
2489  int numberBeforeTrust_;
2493  int numberPenalties_;
2498  double penaltyScaleFactor_;
2502  double * analyzeResults_;
2511  int problemType_;
2513  int printFrequency_;
2516  // Cut generators
2518  // Cut generators before any changes
2521  int numberHeuristics_;
2526 # ifdef COIN_HAS_CLP
2527  int fastNodeDepth_;
2529 #endif
2530 
2531 # ifdef CBC_ONLY_CLP
2532  ClpEventHandler *eventHandler_ ;
2533 # else
2535 # endif
2536 
2538  int numberObjects_;
2539 
2550  OsiObject ** object_;
2552  bool ownObjects_;
2553 
2555  int * originalColumns_;
2557  int howOftenGlobalScan_;
2564  int numberExtraNodes_;
2568  double continuousObjective_;
2577  int maximumCutPasses_;
2579  int preferredWay_;
2581  int currentPassNumber_;
2583  int maximumWhich_;
2585  int maximumRows_;
2587  int currentDepth_;
2589  mutable CoinThreadRandom randomNumberGenerator_;
2591  CoinWarmStartBasis workingBasis_;
2593  int * whichGenerator_;
2595  int maximumStatistics_;
2599  int maximumDepthActual_;
2601  double numberDJFixed_;
2603  CglTreeProbingInfo * probingInfo_;
2605  int numberFixedAtRoot_;
2607  int numberFixedNow_;
2609  bool stoppedOnGap_;
2611  mutable bool eventHappened_;
2613  int numberLongStrong_;
2617  int numberNewCuts_;
2619  int searchStrategy_;
2624  int strongInfo_[7];
2631  OsiBabSolver * solverCharacteristics_;
2637  int continuousPriority_;
2639  int numberUpdateItems_;
2645  CglStored * storedRowCuts_;
2653  int numberThreads_;
2661  int threadMode_;
2667 };
2669 void getIntegerInformation(const OsiObject * object, double & originalLower,
2670  double & originalUpper) ;
2671 // So we can call from other programs
2672 // Real main program
2673 class OsiClpSolverInterface;
2674 int CbcMain (int argc, const char *argv[], OsiClpSolverInterface & solver, CbcModel ** babSolver);
2675 int CbcMain (int argc, const char *argv[], CbcModel & babSolver);
2676 // four ways of calling
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) ;
2681 // When we want to load up CbcModel with options first
2682 void CbcMain0 (CbcModel & babSolver);
2683 int CbcMain1 (int argc, const char *argv[], CbcModel & babSolver);
2684 // two ways of calling
2685 int callCbc(const char * input2, CbcModel & babSolver);
2686 int callCbc(const std::string input2, CbcModel & babSolver);
2687 // And when CbcMain0 already called to initialize
2688 int callCbc1(const char * input2, CbcModel & babSolver);
2689 int callCbc1(const std::string input2, CbcModel & babSolver);
2690 // And when CbcMain0 already called to initialize (with call back) (see CbcMain1 for whereFrom)
2691 int callCbc1(const char * input2, CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom));
2692 int callCbc1(const std::string input2, CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom));
2693 int CbcMain1 (int argc, const char *argv[], CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom));
2694 // For uniform setting of cut and heuristic options
2695 void setCutAndHeuristicOptions(CbcModel & model);
2696 #endif
2697 
bool ownObjects() const
Now we may not own objects - just point to solver's objects.
Definition: CbcModel.hpp:1748
void clearNumberGlobalViolations()
Holds solution at continuous (after cuts if branchAndBound called)
Definition: CbcModel.hpp:1356
int getMaximumCutPassesAtRoot() const
Get the maximum number of cut passes at root node.
Definition: CbcModel.hpp:728
int getCurrentPassNumber() const
Get current cut pass number in this round of cuts.
Definition: CbcModel.hpp:743
int maximumRows_
Maximum number of rows.
Definition: CbcModel.hpp:2585
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.
Definition: CbcModel.hpp:1508
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.
Definition: CbcModel.hpp:1084
int numberRowsAtContinuous_
Number of rows at continuous.
Definition: CbcModel.hpp:2350
void setStrategy(CbcStrategy &strategy)
Set the strategy. Clones.
double * hotstartSolution_
Hotstart solution.
Definition: CbcModel.hpp:2319
int getMaximumNodes() const
Get the maximum node limit .
Definition: CbcModel.hpp:554
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.
Definition: CbcModel.hpp:2247
bool feasibleSolution(int &numberIntegerInfeasibilities, int &numberObjectInfeasibilities) const
Test the current solution for feasiblility.
CbcBranchDecision * branchingMethod_
Variable selection function.
Definition: CbcModel.hpp:2448
int getNumberThreads() const
Get number of threads.
Definition: CbcModel.hpp:1880
char * integerInfo_
Whether of not integer.
Definition: CbcModel.hpp:2404
double originalContinuousObjective_
Value of objective before root node cuts added.
Definition: CbcModel.hpp:2571
int lastNumberCuts2_
The solver associated with this model.
Definition: CbcModel.hpp:2380
double getIntegerTolerance() const
Get the integrality tolerance .
Definition: CbcModel.hpp:611
double getContinuousObjective() const
Value of objective at continuous.
Definition: CbcModel.hpp:1330
double getInfinity() const
Get solver's value for infinity.
Definition: CbcModel.hpp:1104
Just a marker, so that a static sized array can store parameters.
Definition: CbcModel.hpp:125
int numberStrongIterations_
Number of iterations in strong branching.
Definition: CbcModel.hpp:2621
int currentNumberCuts_
Number of entries in addedCuts_.
Definition: CbcModel.hpp:2364
int numberExtraIterations() const
Number of extra iterations.
Definition: CbcModel.hpp:2173
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.
Definition: CbcModel.hpp:2454
int strongInfo_[7]
0 - number times strong branching done, 1 - number fixed, 2 - number infeasible Second group of three...
Definition: CbcModel.hpp:2624
CoinMessages messages_
Cbc messages.
Definition: CbcModel.hpp:2250
void unlockThread()
To do with threads.
Definition: CbcModel.hpp:1938
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...
Definition: CbcModel.hpp:181
double getMinimumDrop() const
Get the minimum drop to continue cuts.
Definition: CbcModel.hpp:718
int currentDepth_
Current depth.
Definition: CbcModel.hpp:2587
double * continuousSolution_
Holds solution at continuous (after cuts)
Definition: CbcModel.hpp:2406
double savedSolutionObjective(int which) const
Return a saved solution objective (0==best) - COIN_DBL_MAX if off end.
double * analyzeResults_
Arrays with analysis results.
Definition: CbcModel.hpp:2502
OsiSolverInterface * referenceSolver_
A copy of the solver, taken at constructor or by saveReferenceSolver.
Definition: CbcModel.hpp:2237
CbcCompareBase * nodeComparison() const
Definition: CbcModel.hpp:1387
int numberStoppedSubTrees_
Number of times any subtree stopped on nodes, time etc.
Definition: CbcModel.hpp:2446
Base model.
Definition: CbcThread.hpp:427
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.
Definition: CbcModel.hpp:1785
bool isAbandoned() const
Are there a numerical difficulties?
int howOftenGlobalScan() const
Get how often to scan global cuts.
Definition: CbcModel.hpp:841
void deleteObjects(bool findIntegers=true)
Delete all object information (and just back to integers if true)
CbcThread * masterThread() const
To do with threads.
Definition: CbcModel.hpp:1872
bool isSolutionLimitReached() const
Solution limit reached?
int numberBeforeTrust_
The number of branches before pseudo costs believed in dynamic strong branching.
Definition: CbcModel.hpp:2489
int maximumCutPasses_
Maximum number of cut passes.
Definition: CbcModel.hpp:2577
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.
Definition: CbcModel.hpp:1099
OsiSolverInterface * solver() const
Returns solver - has current state.
Definition: CbcModel.hpp:1810
const double * cbcColUpper_
Pointer to array[getNumCols()] (for speed) of column upper bounds.
Definition: CbcModel.hpp:2463
void saveSolution(const OsiSolverInterface *osi, std::string fileName)
int maximumStatistics_
Maximum number of statistics.
Definition: CbcModel.hpp:2595
CbcHeuristic * lastHeuristic() const
Pointer to heuristic solver which found last solution (or NULL)
Definition: CbcModel.hpp:1577
bool setMaximumNodes(int value)
Set the maximum node limit .
Definition: CbcModel.hpp:549
double getObjValue() const
Get best objective function value.
Definition: CbcModel.hpp:1244
int maximumCuts_
The solver associated with this model.
Definition: CbcModel.hpp:2381
const double * getCbcRowLower() const
Get pointer to array[getNumRows()] (for speed) of row lower bounds.
Definition: CbcModel.hpp:1116
const double * getCbcRowUpper() const
Get pointer to array[getNumRows()] (for speed) of row upper bounds.
Definition: CbcModel.hpp:1120
bool setHeuristicGap(double value)
Set the heuristic gap between the best known solution and the best possible solution.
Definition: CbcModel.hpp:670
void checkModel()
Check original model before it gets messed up.
int currentPassNumber_
Current cut pass number.
Definition: CbcModel.hpp:2581
int continuousPriority_
Anything with priority >= this can be treated as continuous.
Definition: CbcModel.hpp:2637
Optimization direction - stored for speed.
Definition: CbcModel.hpp:158
void setNumberAnalyzeIterations(int number)
Number of analyze iterations to do.
Definition: CbcModel.hpp:806
bool setPrintingMode(int value)
Set the printing mode.
Definition: CbcModel.hpp:573
double dblParam_[CbcLastDblParam]
Array for double parameters.
Definition: CbcModel.hpp:2256
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...
Definition: CbcModel.hpp:2346
int numberSolutions_
Number of solutions.
Definition: CbcModel.hpp:2304
void incrementExtra(int nodes, int iterations)
semi-private i.e. users should not use
Definition: CbcModel.hpp:2167
void setNumberObjects(int number)
Set the number of objects.
Definition: CbcModel.hpp:454
const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
Definition: CbcModel.hpp:1045
CoinWarmStart * emptyWarmStart_
Pointer to an empty warm start object.
Definition: CbcModel.hpp:2266
bool setAllowablePercentageGap(double value)
Set the percentage allowable gap between the best known solution and the best possible solution...
Definition: CbcModel.hpp:658
int numberHeuristics_
Number of heuristics.
Definition: CbcModel.hpp:2521
int numberIterations_
Cumulative number of iterations.
Definition: CbcModel.hpp:2331
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.
Definition: CbcModel.hpp:2465
The maximum number of solutions before terminating.
Definition: CbcModel.hpp:106
void setBranchingMethod(CbcBranchDecision *method)
Set the branching decision method.
Definition: CbcModel.hpp:1454
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...
Definition: CbcModel.hpp:724
const double * hotstartSolution() const
Get the hotstart solution.
Definition: CbcModel.hpp:2100
const double * cbcRowActivity_
Pointer to array[getNumRows()] (for speed) of row activity levels.
Definition: CbcModel.hpp:2475
CbcTree * tree_
Tree.
Definition: CbcModel.hpp:2442
void setProblemFeasibility(CbcFeasibilityBase *feasibility)
double sumChangeObjective2_
Sum of Changes to objective by subsequent solves.
Definition: CbcModel.hpp:2275
double * bestSolution_
Array holding the incumbent (best) solution.
Definition: CbcModel.hpp:2278
bool isInitialSolveProvenOptimal() const
Is optimality proven (for initialSolve) ?
int numberLongStrong_
Number of long strong goes.
Definition: CbcModel.hpp:2613
void setContinuousInfeasibilities(int value)
Holds solution at continuous (after cuts if branchAndBound called)
Definition: CbcModel.hpp:1340
const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
Definition: CbcModel.hpp:1016
void setProblemType(int number)
Problem type as set by user or found by analysis.
Definition: CbcModel.hpp:827
int maximumSavedSolutions() const
Maximum number of extra saved solutions.
Definition: CbcModel.hpp:1292
The objective is assumed to worsen by this amount for each integer infeasibility. ...
Definition: CbcModel.hpp:134
void setSolutionCount(int value)
Set number of solutions (so heuristics will be different)
Definition: CbcModel.hpp:1286
int numberObjects_
Total number of objects.
Definition: CbcModel.hpp:2538
void resetModel()
Clears out enough to reset CbcModel cutoff etc.
void setNumberStrongIterations(int number)
Set the number of iterations done in strong branching.
Definition: CbcModel.hpp:2135
int currentDepth() const
Current depth.
Definition: CbcModel.hpp:834
const double * testSolution_
For testing infeasibilities - will point to currentSolution_ or solver–>getColSolution() ...
Definition: CbcModel.hpp:2290
CoinMessages * messagesPointer()
Return pointer to messages.
Definition: CbcModel.hpp:1675
void setSearchStrategy(int value)
Set strategy worked out - mainly at root node for use by CbcNode.
Definition: CbcModel.hpp:1499
int stateOfSearch() const
State of search 0 - no solution 1 - only heuristic solutions 2 - branched to a solution 3 - no soluti...
Definition: CbcModel.hpp:1488
Abstract cut modifier base class.
bool setCutoffIncrement(double value)
Set the CbcModel::CbcCutoffIncrement desired.
Definition: CbcModel.hpp:696
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...
Definition: CbcModel.hpp:137
int numberIntegers_
Number of integers in problem.
Definition: CbcModel.hpp:2348
int CbcMain(int argc, const char *argv[], OsiClpSolverInterface &solver, CbcModel **babSolver)
int whenCuts_
At which depths to do cuts.
Definition: CbcModel.hpp:2317
bool solveWithCuts(OsiCuts &cuts, int numberTries, CbcNode *node)
Evaluate a subproblem using cutting planes and heuristics.
CoinThreadRandom * randomNumberGenerator()
Thread specific random number generator.
Definition: CbcModel.hpp:2131
double getInfeasibilityWeight() const
Get the weight per integer infeasibility .
Definition: CbcModel.hpp:626
const int * integerVariable() const
Number of rows in continuous (root) problem.
Definition: CbcModel.hpp:983
double getHeuristicFractionGap() const
Get the fraction heuristic gap between the best known solution and the best possible solution...
Definition: CbcModel.hpp:689
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.
Definition: CbcModel.hpp:2297
void setPenaltyScaleFactor(double value)
Set scale factor to make penalties match strong.
const int * strongInfo() const
Return strong info.
Definition: CbcModel.hpp:2180
void setMaximumSavedSolutions(int value)
Set maximum number of extra saved solutions.
CbcFeasibilityBase * problemFeasibility() const
Definition: CbcModel.hpp:1397
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.
Definition: CbcModel.hpp:959
void setTestSolution(const double *solution)
Holds solution at continuous (after cuts if branchAndBound called)
Definition: CbcModel.hpp:1199
int getNumberHeuristicSolutions() const
Get number of heuristic solutions.
Definition: CbcModel.hpp:1315
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.
Definition: CbcModel.hpp:1136
void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
Definition: CbcModel.hpp:1324
CoinMessageHandler * messageHandler() const
Return handler.
Definition: CbcModel.hpp:1667
int getNumCols() const
Get number of columns.
Definition: CbcModel.hpp:964
int * usedInSolution_
Array marked whenever a solution is found if non-zero.
Definition: CbcModel.hpp:2408
int numberPenalties() const
get the number of variables for which to compute penalties in dynamic strong branching.
Definition: CbcModel.hpp:802
OsiCuts globalCuts_
Global cuts.
Definition: CbcModel.hpp:2299
CoinBigIndex getNumElements() const
Get number of nonzero elements.
Definition: CbcModel.hpp:974
double * currentSolution_
Array holding the current solution.
Definition: CbcModel.hpp:2286
int numberStoppedSubTrees() const
Returns number of times any subtree stopped on nodes, time etc.
Definition: CbcModel.hpp:1422
CbcHeuristic ** heuristic_
Heuristic solvers.
Definition: CbcModel.hpp:2523
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.
Definition: CbcModel.hpp:1794
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.
Definition: CbcModel.hpp:1837
CBC_Message
This deals with Cbc messages (as against Clp messages etc).
Definition: CbcMessage.hpp:22
CbcHeuristic * lastHeuristic_
Pointer to heuristic solver which found last solution (or NULL)
Definition: CbcModel.hpp:2525
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.
Definition: CbcModel.hpp:1344
The maximum amount the value of an integer variable can vary from integer and still be considered fea...
Definition: CbcModel.hpp:131
CoinWarmStartBasis workingBasis_
Work basis for temporary use.
Definition: CbcModel.hpp:2591
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.
Definition: CbcModel.hpp:2467
double penaltyScaleFactor() const
Get scale factor to make penalties match strong.
Definition: CbcModel.hpp:814
const double * cbcColLower_
Whether to automatically do presolve before branch and bound.
Definition: CbcModel.hpp:2461
CbcCutModifier * cutModifier_
Cut modifier function.
Definition: CbcModel.hpp:2450
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.
Definition: CbcModel.hpp:1722
int maximumRows() const
Maximum number of rows.
Definition: CbcModel.hpp:1367
CbcCompareBase * nodeCompare_
User node comparison function.
Definition: CbcModel.hpp:2438
double continuousObjective_
Value of objective at continuous (Well actually after initial round of cuts)
Definition: CbcModel.hpp:2568
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.
Definition: CbcModel.hpp:1132
int numberUpdateItems_
Number of outstanding update information items.
Definition: CbcModel.hpp:2639
void addUpdateInformation(const CbcObjectUpdateData &data)
Adds an update information object.
void setStopNumberIterations(int value)
Set number of "iterations" to stop after.
Definition: CbcModel.hpp:1379
Information required to recreate the subproblem at this node.
Definition: CbcNodeInfo.hpp:62
int callCbc1(const char *input2, CbcModel &babSolver)
OsiObject ** object_
Integer and Clique and ...
Definition: CbcModel.hpp:2550
int maximumWhich_
Maximum number of cuts (for whichGenerator_)
Definition: CbcModel.hpp:2583
bool isContinuous(int colIndex) const
Return true if variable is continuous.
Definition: CbcModel.hpp:1066
int maximumDepth_
Current limit on search tree depth.
Definition: CbcModel.hpp:2370
const double * getCbcColSolution() const
Get pointer to array[getNumCols()] (for speed) of primal solution vector.
Definition: CbcModel.hpp:1124
const double * getCbcRowPrice() const
Get pointer to array[getNumRows()] (for speed) of dual prices.
Definition: CbcModel.hpp:1128
For gathering statistics.
void passInTreeHandler(CbcTree &tree)
For modifying tree handling (original is cloned)
double ** savedSolutions_
Arrays holding other solutions.
Definition: CbcModel.hpp:2280
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.
Definition: CbcModel.hpp:1375
OsiSolverInterface * swapSolver(OsiSolverInterface *solver)
Returns current solver - sets new one.
Definition: CbcModel.hpp:1815
bool setHeuristicFractionGap(double value)
Set the fraction heuristic gap between the best known solution and the best possible solution...
Definition: CbcModel.hpp:683
int getPreferredWay() const
Get the preferred way to branch (default 0)
Definition: CbcModel.hpp:765
int numberAnalyzeIterations() const
Set an integer parameter.
Definition: CbcModel.hpp:809
CbcStatistics ** statistics_
statistics
Definition: CbcModel.hpp:2597
Smallest non-zero change on a branch.
Definition: CbcModel.hpp:183
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.
Definition: CbcModel.hpp:2493
void setMaximumCutPasses(int value)
Set the maximum number of cut passes at other nodes (default 10) Minimum drop can also be used for fi...
Definition: CbcModel.hpp:734
char integerType(int i) const
Whether or not integer.
Definition: CbcModel.hpp:987
void incrementStrongInfo(int numberTimes, int numberIterations, int numberFixed, bool ifInfeasible)
Increment strong info.
CoinThreadRandom randomNumberGenerator_
Thread specific random number generator.
Definition: CbcModel.hpp:2589
int numberThreads_
Parallel 0 - off 1 - testing 2-99 threads other special meanings.
Definition: CbcModel.hpp:2653
void newLanguage(CoinMessages::Language language)
Set language.
const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
Definition: CbcModel.hpp:1028
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.
Definition: CbcModel.hpp:2631
Cutoff - stored for speed.
Definition: CbcModel.hpp:156
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...
Definition: CbcModel.hpp:144
int numberObjects() const
Get the number of objects.
Definition: CbcModel.hpp:450
bool integerPresolveThisModel(OsiSolverInterface *originalSolver, bool weak=false)
Do integer presolve, modifying the current model.
void setNumberHeuristicSolutions(int value)
Set number of heuristic solutions.
Definition: CbcModel.hpp:1319
void setPreferredWay(int value)
Set global preferred way to branch -1 down, +1 up, 0 no preference.
Definition: CbcModel.hpp:761
int priority(int sequence) const
Returns priority level for an object (or 1000 if no priorities exist)
Definition: CbcModel.hpp:1606
CbcCountRowCut ** addedCuts() const
Return the list of cuts initially collected for this subproblem.
Definition: CbcModel.hpp:2109
OsiRowCut * nextRowCut_
A pointer to a row cut which will be added instead of normal branching.
Definition: CbcModel.hpp:2396
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...
Definition: CbcModel.hpp:173
int numberFixedAtRoot_
Number of fixed by analyze at root.
Definition: CbcModel.hpp:2605
Current objective value.
Definition: CbcModel.hpp:160
int getMaximumSolutions() const
Get the maximum number of solutions desired.
Definition: CbcModel.hpp:569
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.
Definition: CbcModel.hpp:2665
bool setAllowableFractionGap(double value)
Set the fraction allowable gap between the best known solution and the best possible solution...
Definition: CbcModel.hpp:646
int secondaryStatus() const
Secondary status of problem -1 unset (status_ will also be -1) 0 search completed with solution 1 lin...
Definition: CbcModel.hpp:928
CbcStrategy * strategy() const
Get the current strategy.
Definition: CbcModel.hpp:1540
CbcStrategy * strategy_
Strategy.
Definition: CbcModel.hpp:2452
bool ownObjects_
Now we may not own objects - just point to solver's objects.
Definition: CbcModel.hpp:2552
CglStored * storedRowCuts() const
Get stored row cuts for donor/recipient CbcModel.
Definition: CbcModel.hpp:2189
CoinMessages & messages()
Return messages.
Definition: CbcModel.hpp:1671
const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels.
Definition: CbcModel.hpp:1221
Just a marker, so that a static sized array can store parameters.
Definition: CbcModel.hpp:191
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.
Definition: CbcModel.hpp:154
double getCutoff() const
Get the cutoff bound on the objective function - always as minimize.
Definition: CbcModel.hpp:542
CbcBaseModel * master_
Thread stuff for master.
Definition: CbcModel.hpp:2663
double getMinimizationObjValue() const
Get best objective function value as minimization.
Definition: CbcModel.hpp:1235
bool setInfeasibilityWeight(double value)
Set the weight per integer infeasibility .
Definition: CbcModel.hpp:619
const double * getCbcColLower() const
Get pointer to array[getNumCols()] (for speed) of column lower bounds.
Definition: CbcModel.hpp:1108
void incrementIterationCount(int value)
Increment how many iterations it took to solve the problem.
Definition: CbcModel.hpp:891
bool setIntegerTolerance(double value)
Set the integrality tolerance .
Definition: CbcModel.hpp:605
int numberSolves_
Cumulative number of solves.
Definition: CbcModel.hpp:2333
const double * getCbcColUpper() const
Get pointer to array[getNumCols()] (for speed) of column upper bounds.
Definition: CbcModel.hpp:1112
double * currentSolution() const
Solution to the most recent lp relaxation.
Definition: CbcModel.hpp:1190
double bestPossibleObjective_
Best possible objective.
Definition: CbcModel.hpp:2271
int numberSavedSolutions() const
Number of saved solutions (including best)
CbcFeasibilityBase * problemFeasibility_
User feasibility function (see CbcFeasibleBase.hpp)
Definition: CbcModel.hpp:2440
int intParam_[CbcLastIntParam]
Array for integer parameters.
Definition: CbcModel.hpp:2253
CbcNodeInfo ** lastNodeInfo_
The solver associated with this model.
Definition: CbcModel.hpp:2377
int stateOfSearch_
State of search 0 - no solution 1 - only heuristic solutions 2 - branched to a solution 3 - no soluti...
Definition: CbcModel.hpp:2315
bool isSecondsLimitReached() const
Time limit reached?
bool setMaximumSeconds(double value)
Set the maximum number of seconds desired.
Definition: CbcModel.hpp:586
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.
Definition: CbcModel.hpp:1681
virtual CbcBranchDecision * clone() const =0
Clone.
Sum of non-zero changes on a branch.
Definition: CbcModel.hpp:185
void gutsOfDestructor2()
Clears out enough to reset CbcModel as if no branch and bound done.
double numberDJFixed_
Number of reduced cost fixings.
Definition: CbcModel.hpp:2601
void setContinuousPriority(int value)
Set anything with priority >= this can be treated as continuous.
Definition: CbcModel.hpp:2164
void makeGlobalCut(const OsiRowCut *cut)
Make given cut into a global cut.
int maximumNumberUpdateItems_
Maximum number of outstanding update information items.
Definition: CbcModel.hpp:2641
int maximumCutPassesAtRoot_
Maximum number of cut passes at root.
Definition: CbcModel.hpp:2575
void setObjectiveValue(CbcNode *thisNode, const CbcNode *parentNode) const
Set objective value in a node.
int * originalColumns_
Original columns as created by integerPresolve or preprocessing.
Definition: CbcModel.hpp:2555
const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
Definition: CbcModel.hpp:1040
double minimumDrop_
Minimum degradation in objective value to continue cut generation.
Definition: CbcModel.hpp:2302
void setLanguage(CoinMessages::Language language)
Pass in Message handler (not deleted at end)
Definition: CbcModel.hpp:1663
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.
Definition: CbcModel.hpp:2528
int maximumSavedSolutions_
Maximum number of saved solutions.
Definition: CbcModel.hpp:2308
void setProblemStatus(int value)
Are there a numerical difficulties?
Definition: CbcModel.hpp:914
void setDefaultHandler(bool yesNo)
Set flag to say if handler_ is the default handler.
Definition: CbcModel.hpp:1689
const OsiObject * object(int which) const
Get the specified object.
Definition: CbcModel.hpp:464
double penaltyScaleFactor_
Scale factor to make penalties match strong.
Definition: CbcModel.hpp:2498
double getSolverObjValue() const
Get solver objective function value (as minimization)
Definition: CbcModel.hpp:1258
void deleteSolutions()
Delete best and saved solutions.
void setBranchingMethod(CbcBranchDecision &method)
Set the branching method.
Definition: CbcModel.hpp:1462
bool setDblParam(CbcDblParam key, double value)
Set a double parameter.
Definition: CbcModel.hpp:522
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.
Definition: CbcModel.hpp:531
const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
Definition: CbcModel.hpp:1050
int numberGlobalViolations_
Number of times global cuts violated.
Definition: CbcModel.hpp:2560
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...
Definition: CbcModel.hpp:151
void saveExtraSolution(const double *solution, double objectiveValue)
Save a solution to saved list.
int numberGlobalViolations() const
Number of times global cuts violated.
Definition: CbcModel.hpp:1353
int getNodeCount() const
Get how many Nodes it took to solve the problem.
Definition: CbcModel.hpp:895
void incrementNodeCount(int value)
Increment how many nodes it took to solve the problem.
Definition: CbcModel.hpp:899
void setResolveAfterTakeOffCuts(bool yesNo)
Holds solution at continuous (after cuts if branchAndBound called)
Definition: CbcModel.hpp:1363
int getMaximumCutPasses() const
Get the maximum number of cut passes at other nodes (default 10)
Definition: CbcModel.hpp:738
int problemType() const
Set an integer parameter.
Definition: CbcModel.hpp:830
CbcEventHandler * getEventHandler() const
Retrieve a pointer to the event handler.
Definition: CbcModel.hpp:1617
int getSolutionCount() const
Get number of solutions.
Definition: CbcModel.hpp:1281
int numberIntegers() const
Number of integers in problem.
Definition: CbcModel.hpp:979
void setHowOftenGlobalScan(int number)
Set how often to scan global cuts.
~CbcModel()
Destructor.
A class to encapsulate thread stuff.
Definition: CbcThread.hpp:416
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.
Definition: CbcModel.hpp:1827
int maximumNumberIterations() const
Get maximum number of iterations (designed to be used in heuristics)
Definition: CbcModel.hpp:2143
void generateCpp(FILE *fp, int options)
Create C++ lines to get to current state.
Fathoming discipline.
Definition: CbcModel.hpp:116
OsiObject * modifiableObject(int which) const
Get the specified object.
Definition: CbcModel.hpp:468
CglTreeProbingInfo * probingInfo_
Probing info.
Definition: CbcModel.hpp:2603
CbcNode * currentNode_
Current node so can be used elsewhere.
Definition: CbcModel.hpp:2399
void setStoredRowCuts(CglStored *cuts)
Set stored row cuts for donor/recipient CbcModel.
Definition: CbcModel.hpp:2193
int callCbc(const char *input2, OsiClpSolverInterface &solver1)
CoinWarmStartBasis & workingBasis()
Work basis for temporary use.
Definition: CbcModel.hpp:1371
const double * testSolution() const
For testing infeasibilities - will point to currentSolution_ or solver–>getColSolution() ...
Definition: CbcModel.hpp:1196
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.
Definition: CbcModel.hpp:993
CbcTree * tree() const
Tree method e.g. heap (which may be overridden by inheritance)
Definition: CbcModel.hpp:1407
void setPointers(const OsiSolverInterface *solver)
Set pointers for speed.
int numberStrong_
Maximum number of candidates to consider for strong branching.
Definition: CbcModel.hpp:2483
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.
Definition: CbcModel.hpp:2579
CoinMessageHandler * handler_
Message handler.
Definition: CbcModel.hpp:2240
CglTreeProbingInfo * probingInfo() const
Get a pointer to probing info.
Definition: CbcModel.hpp:2127
int getThreadMode() const
Get thread mode.
Definition: CbcModel.hpp:1888
int getIntParam(CbcIntParam key) const
Get an integer parameter.
Definition: CbcModel.hpp:527
int getPrintingMode() const
Get the printing mode.
Definition: CbcModel.hpp:578
int * integerVariable_
Indices of integer variables.
Definition: CbcModel.hpp:2402
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.
Definition: CbcModel.hpp:562
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.
Definition: CbcModel.hpp:998
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).
Definition: CbcModel.hpp:1434
void setFastNodeDepth(int value)
Set depth for fast nodes.
Definition: CbcModel.hpp:2152
CbcModel & operator=(const CbcModel &rhs)
Assignment operator.
int getIterationCount() const
Get how many iterations it took to solve the problem.
Definition: CbcModel.hpp:887
int numberOldActiveCuts_
Number of old active cuts.
Definition: CbcModel.hpp:2615
int * whichGenerator_
Which cut generator generated this cut.
Definition: CbcModel.hpp:2593
const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
Definition: CbcModel.hpp:1206
int numberSavedSolutions_
Number of saved solutions.
Definition: CbcModel.hpp:2306
int specialOptions_
Special options 0 bit (1) - check if cuts valid (if on debugger list) 1 bit (2) - use current basis t...
Definition: CbcModel.hpp:2432
const OsiBabSolver * solverCharacteristics() const
Get solver characteristics.
Definition: CbcModel.hpp:1650
void * getApplicationData() const
Get application data.
int searchStrategy() const
Strategy worked out - mainly at root node for use by CbcNode.
Definition: CbcModel.hpp:1495
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.
Definition: CbcModel.hpp:676
void setStrategy(CbcStrategy *strategy)
Set the strategy. assigns.
Definition: CbcModel.hpp:1546
void doHeuristicsAtRoot(int deleteHeuristicsAfterwards=0)
Do heuristics at root.
int moreSpecialOptions() const
Get more special options.
Definition: CbcModel.hpp:1740
void setLastHeuristic(CbcHeuristic *last)
set last heuristic which found a solution
Definition: CbcModel.hpp:1581
int numberHeuristics() const
Get the number of heuristics.
Definition: CbcModel.hpp:1573
int presolve_
Presolve for CbcTreeLocal.
Definition: CbcModel.hpp:2479
CbcNode * currentNode() const
Get a pointer to current node (be careful)
Definition: CbcModel.hpp:2123
int numberStrongIterations() const
Get the number of iterations done in strong branching.
Definition: CbcModel.hpp:2139
double getAllowablePercentageGap() const
Get the percentage allowable gap between the best known solution and the best possible solution...
Definition: CbcModel.hpp:664
CbcModel()
Default Constructor.
double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
Definition: CbcModel.hpp:1060
Strategy base class.
Definition: CbcStrategy.hpp:16
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.
Definition: CbcModel.hpp:2607
CbcEventHandler::CbcAction dealWithEventHandler(CbcEventHandler::CbcEvent event, double objValue, const double *solution)
Deals with event handler and solution.
int numberHeuristicSolutions_
Number of heuristic solutions.
Definition: CbcModel.hpp:2323
double * bestSolution() const
The best solution to the integer programming problem.
Definition: CbcModel.hpp:1268
bool isFreeBinary(int colIndex) const
Return true if variable is binary and not fixed at either bound.
Definition: CbcModel.hpp:1089
void passInEventHandler(const CbcEventHandler *eventHandler)
Set an event handler.
int stopNumberIterations_
For threads - stop after this many "iterations".
Definition: CbcModel.hpp:2495
const int * hotstartPriorities() const
Get the hotstart priorities.
Definition: CbcModel.hpp:2104
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.
Definition: CbcModel.hpp:1360
double getBestPossibleObjValue() const
Get best possible objective function value.
int numberStrong() const
Get the maximum number of candidates to be evaluated for strong branching.
Definition: CbcModel.hpp:756
double bestObjective_
Best objective.
Definition: CbcModel.hpp:2269
const OsiRowCut ** lastCut_
The solver associated with this model.
Definition: CbcModel.hpp:2378
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...
Heuristic base class.
void setSecondaryStatus(int value)
Are there a numerical difficulties?
Definition: CbcModel.hpp:931
int numberExtraIterations_
Number of extra iterations in fast lp.
Definition: CbcModel.hpp:2562
CbcCutGenerator * virginCutGenerator(int i) const
Get the specified cut generator before any changes.
Definition: CbcModel.hpp:1516
void pseudoShadow(int type)
Fill in useful estimates.
void setWhenCuts(int value)
Set at which depths to do cuts.
Definition: CbcModel.hpp:773
const double * cbcColSolution_
Pointer to array[getNumCols()] (for speed) of primal solution vector.
Definition: CbcModel.hpp:2469
int phase() const
Current phase (so heuristics etc etc can find out).
Definition: CbcModel.hpp:1310
CbcCutModifier * cutModifier() const
Get the current cut modifier method.
Definition: CbcModel.hpp:1467
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.
Definition: CbcModel.hpp:2511
void setNumberThreads(int value)
Set number of threads.
Definition: CbcModel.hpp:1884
int moreSpecialOptions_
More special options at present bottom 3 bits used for shadow price mode.
Definition: CbcModel.hpp:2436
void setContinuousObjective(double value)
Holds solution at continuous (after cuts if branchAndBound called)
Definition: CbcModel.hpp:1333
void * appData_
Pointer to user-defined data structure.
Definition: CbcModel.hpp:2477
int * usedInSolution() const
Array marked whenever a solution is found if non-zero.
Definition: CbcModel.hpp:1152
double * continuousSolution() const
Holds solution at continuous (after cuts if branchAndBound called)
Definition: CbcModel.hpp:1145
bool isInteger(int colIndex) const
Return true if column is integer.
Definition: CbcModel.hpp:1079
CbcCutGenerator * cutGenerator(int i) const
Get the specified cut generator.
Definition: CbcModel.hpp:1512
int printFrequency_
Print frequency.
Definition: CbcModel.hpp:2513
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.
Definition: CbcModel.hpp:2391
int status() const
Final status of problem Some of these can be found out by is......
Definition: CbcModel.hpp:911
OsiSolverInterface * continuousSolver() const
Returns solver with continuous state.
Definition: CbcModel.hpp:1822
CbcObjectUpdateData * updateItems_
Update items.
Definition: CbcModel.hpp:2643
void addObjects(int numberObjects, OsiObject **objects)
Add in object information.
double sumChangeObjective() const
Sum of Changes to objective by first solve.
Definition: CbcModel.hpp:1348
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.
Definition: CbcModel.hpp:120
double sumChangeObjective1_
Sum of Changes to objective by first solve.
Definition: CbcModel.hpp:2273
CbcModel * parentModel() const
Get the current parent model.
Definition: CbcModel.hpp:1550
int * lastNumberCuts_
The solver associated with this model.
Definition: CbcModel.hpp:2382
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.
Definition: CbcModel.hpp:633
void setTypePresolve(int value)
Tree method e.g. heap (which may be overridden by inheritance)
Definition: CbcModel.hpp:1437
const double * cbcRowPrice_
Pointer to array[getNumRows()] (for speed) of dual prices.
Definition: CbcModel.hpp:2471
int status_
Status of problem - 0 finished, 1 stopped, 2 difficulties.
Definition: CbcModel.hpp:2335
int * mutableStrongInfo()
Return mutable strong info.
Definition: CbcModel.hpp:2185
int currentNumberCuts() const
Number of entries in the list returned by addedCuts()
Definition: CbcModel.hpp:2113
void setCutAndHeuristicOptions(CbcModel &model)
void resizeWhichGenerator(int numberNow, int numberAfter)
Update size of whichGenerator.
int numberAnalyzeIterations_
Number of analyze iterations to do.
Definition: CbcModel.hpp:2500
OsiCuts * globalCuts()
Global cuts.
Definition: CbcModel.hpp:2117
CbcCutGenerator ** generator_
The solver associated with this model.
Definition: CbcModel.hpp:2517
double getAllowableGap() const
Get the allowable gap between the best known solution and the best possible solution.
Definition: CbcModel.hpp:639
void setSpecialOptions(int value)
Set special options 0 bit (1) - check if cuts valid (if on debugger list) 1 bit (2) - use current bas...
Definition: CbcModel.hpp:1718
Information required while the node is live.
Definition: CbcNode.hpp:47
void setMinimumDrop(double value)
Set the minimum drop to continue cuts.
Definition: CbcModel.hpp:714
void setMaximumNumberIterations(int value)
Set maximum number of iterations (designed to be used in heuristics)
Definition: CbcModel.hpp:2147
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.
Definition: CbcModel.hpp:517
const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
Definition: CbcModel.hpp:1094
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.
Definition: CbcModel.hpp:2376
bool isBinary(int colIndex) const
Return true if variable is binary.
Definition: CbcModel.hpp:1071
CbcEventHandler * eventHandler_
Definition: CbcModel.hpp:2534
CbcModel * subTreeModel_
A pointer to model to be used for subtrees.
Definition: CbcModel.hpp:2444
int maximumNumberCuts_
Maximum number of cuts.
Definition: CbcModel.hpp:2352
void setThreadMode(int value)
Set thread mode always use numberThreads for branching 1 set then deterministic 2 set then use number...
Definition: CbcModel.hpp:1900
CglStored * storedRowCuts_
Stored row cuts for donor/recipient CbcModel.
Definition: CbcModel.hpp:2645
The time at start of model.
Definition: CbcModel.hpp:165
int parallelMode() const
Return -2 if deterministic threaded and main thread -1 if deterministic threaded and serial thread 0 ...
Definition: CbcModel.hpp:1909
void branchAndBound(int doStatistics=0)
Invoke the branch & cut algorithm.
int * hotstartPriorities_
Hotstart priorities.
Definition: CbcModel.hpp:2321
bool stoppedOnGap_
Whether stopping on gap.
Definition: CbcModel.hpp:2609
Current minimization objective value.
Definition: CbcModel.hpp:162
int numberCutGenerators_
Number of cut generators.
Definition: CbcModel.hpp:2515
int lastDepth_
The solver associated with this model.
Definition: CbcModel.hpp:2379
int threadMode_
thread mode always use numberThreads for branching 1 set then deterministic 2 set then use numberThre...
Definition: CbcModel.hpp:2661
const double * cbcReducedCost_
Get a pointer to array[getNumCols()] (for speed) of reduced costs.
Definition: CbcModel.hpp:2473
OsiRowCut augmented with bookkeeping.
int numberNodes2_
Cumulative number of nodes for statistics.
Definition: CbcModel.hpp:2329
OsiSolverInterface * continuousSolver_
A copy of the solver, taken at the continuous (root) node.
Definition: CbcModel.hpp:2234
int * originalColumns() const
Original columns as created by integerPresolve or preprocessing.
Definition: CbcModel.hpp:845
void setBestObjectiveValue(double objectiveValue)
Just update objectiveValue.
bool resolveAfterTakeOffCuts_
Whether to force a resolve after takeOffCuts.
Definition: CbcModel.hpp:2633
OsiSolverInterface * solver_
The solver associated with this model.
Definition: CbcModel.hpp:2224
const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
Definition: CbcModel.hpp:1216
double getCurrentObjValue() const
Get current objective function value.
Definition: CbcModel.hpp:1226
double getMaximumSeconds() const
Get the maximum number of seconds desired.
Definition: CbcModel.hpp:593
double getCurrentMinimizationObjValue() const
Get current minimization objective function value.
Definition: CbcModel.hpp:1230
double getAllowableFractionGap() const
Get the fraction allowable gap between the best known solution and the best possible solution...
Definition: CbcModel.hpp:652
int searchStrategy_
Strategy worked out - mainly at root node.
Definition: CbcModel.hpp:2619
int CbcMain1(int argc, const char *argv[], CbcModel &babSolver)
void setBestSolutionBasis(const CoinWarmStartBasis &bestSolutionBasis)
Warm start object produced by heuristic or strong branching.
Definition: CbcModel.hpp:2210
int numberCutGenerators() const
Get the number of cut generators.
Definition: CbcModel.hpp:1504
int printFrequency() const
Get the print frequency.
Definition: CbcModel.hpp:862
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.
Definition: CbcModel.hpp:1211
int getNumRows() const
Get number of rows.
Definition: CbcModel.hpp:969
Small non-zero change on a branch to be used as guess.
Definition: CbcModel.hpp:189
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.
Definition: CbcModel.hpp:2573
int numberBeforeTrust() const
get the number of branches before pseudo costs believed in dynamic strong branching.
Definition: CbcModel.hpp:791
CbcEvent
Events known to cbc.
unsigned int ownership_
Ownership of objects and other stuff.
Definition: CbcModel.hpp:2231
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.
Definition: CbcModel.hpp:2325
int numberNewCuts_
Number of new cuts.
Definition: CbcModel.hpp:2617
void clearContinuousSolver()
Clear solver with continuous state.
Definition: CbcModel.hpp:1831
void setPrintFrequency(int number)
Set the print frequency.
Definition: CbcModel.hpp:858
void synchronizeModel()
Ensure attached objects point to this model.
void lockThread()
To do with threads.
Definition: CbcModel.hpp:1937
void setMoreSpecialOptions(int value)
Set more special options at present bottom 6 bits used for shadow price mode 1024 for experimental ho...
Definition: CbcModel.hpp:1736
double getCutoffIncrement() const
Get the CbcModel::CbcCutoffIncrement desired.
Definition: CbcModel.hpp:703
int fastNodeDepth() const
Get depth for fast nodes.
Definition: CbcModel.hpp:2156
void setStateOfSearch(int state)
State of search 0 - no solution 1 - only heuristic solutions 2 - branched to a solution 3 - no soluti...
Definition: CbcModel.hpp:1491
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.
Definition: CbcModel.hpp:1450
int getNodeCount2() const
semi-private i.e. users should not use
Definition: CbcModel.hpp:1968
int continuousPriority() const
Get anything with priority >= this can be treated as continuous.
Definition: CbcModel.hpp:2160
Number of branches (may be more than number of nodes as may include strong branching) ...
Definition: CbcModel.hpp:123
void setParentModel(CbcModel &parentModel)
Set the parent model.
Definition: CbcModel.hpp:1554
void setMinimizationObjValue(double value)
Set best objective function value as minimization.
Definition: CbcModel.hpp:1239
CbcHeuristic * heuristic(int i) const
Get the specified heuristic.
Definition: CbcModel.hpp:1569
void incrementSubTreeStopped()
Says a sub tree was stopped.
Definition: CbcModel.hpp:1426
void originalModel(CbcModel *presolvedModel, bool weak)
Put back information into the original model after integer presolve.
OsiObject ** objects() const
Get the array of objects.
Definition: CbcModel.hpp:459
Simple Branch and bound class.
Definition: CbcModel.hpp:98
CbcNodeInfo ** walkback() const
Get pointer to walkback.
Definition: CbcModel.hpp:1876
bool normalSolver() const
Says if normal solver i.e. has well defined CoinPackedMatrix.
Definition: CbcModel.hpp:1726
void setObjValue(double value)
Set best objective function value.
Definition: CbcModel.hpp:1254
CbcCutGenerator ** virginGenerator_
The solver associated with this model.
Definition: CbcModel.hpp:2519
const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
Definition: CbcModel.hpp:1003
int getContinuousInfeasibilities() const
Number of infeasibilities at continuous.
Definition: CbcModel.hpp:1337
The maximum number of nodes before terminating.
Definition: CbcModel.hpp:104
void AddIntegers()
Add additional integers.
bool eventHappened_
Whether event happened.
Definition: CbcModel.hpp:2611
int howOftenGlobalScan_
How often to scan global cuts.
Definition: CbcModel.hpp:2557
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)
Definition: CbcModel.hpp:2504
int whenCuts() const
Get at which depths to do cuts.
Definition: CbcModel.hpp:769
int maximumDepthActual_
Maximum depth reached.
Definition: CbcModel.hpp:2599
bool isInitialSolveAbandoned() const
Are there numerical difficulties (for initialSolve) ?
int phase_
Current phase (so heuristics etc etc can find out).
Definition: CbcModel.hpp:2361
const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
Definition: CbcModel.hpp:1055
int maximumNumberIterations_
Maximum number of iterations (designed to be used in heuristics)
Definition: CbcModel.hpp:2635
bool maximumSecondsReached() const
Return true if maximum time reached.
bool allDynamic() const
Says whether all dynamic integers.
Definition: CbcModel.hpp:2197
void startSplitModel(int numberIterations)
Start threads.
int numberExtraNodes_
Number of extra nodes in fast lp.
Definition: CbcModel.hpp:2564
Largest non-zero change on a branch.
Definition: CbcModel.hpp:187
Interface between Cbc and Cut Generation Library.