Cbc  2.8.12
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CbcModel.hpp
Go to the documentation of this file.
1 /* $Id: CbcModel.hpp 2055 2014-08-09 16:05:41Z forrest $ */
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5 
6 #ifndef CbcModel_H
7 #define CbcModel_H
8 #include <string>
9 #include <vector>
10 #include "CoinMessageHandler.hpp"
11 #include "OsiSolverInterface.hpp"
12 #include "OsiBranchingObject.hpp"
13 #include "OsiCuts.hpp"
14 #include "CoinWarmStartBasis.hpp"
15 #include "CbcCompareBase.hpp"
16 #include "CbcCountRowCut.hpp"
17 #include "CbcMessage.hpp"
18 #include "CbcEventHandler.hpp"
19 #include "ClpDualRowPivot.hpp"
20 
21 
22 class CbcCutGenerator;
23 class CbcBaseModel;
24 class OsiRowCut;
25 class OsiBabSolver;
26 class OsiRowCutDebugger;
27 class CglCutGenerator;
28 class CglStored;
29 class CbcCutModifier;
30 class CglTreeProbingInfo;
31 class CbcHeuristic;
32 class OsiObject;
33 class CbcThread;
34 class CbcTree;
35 class CbcStrategy;
36 class CbcFeasibilityBase;
37 class CbcStatistics;
38 class CbcFullNodeInfo;
39 class CbcEventHandler ;
40 class CglPreProcess;
41 class OsiClpSolverInterface;
42 class ClpNodeStuff;
43 
44 // #define CBC_CHECK_BASIS 1
45 
46 //#############################################################################
47 
100 class CbcModel {
101 
102 public:
103 
104  enum CbcIntParam {
128  };
129 
130  enum CbcDblParam {
194  };
195 
196  //---------------------------------------------------------------------------
197 
198 public:
200 
201 
205  void initialSolve();
206 
217  void branchAndBound(int doStatistics = 0);
218 private:
219 
227  bool solveWithCuts(OsiCuts & cuts, int numberTries, CbcNode * node);
235  int serialCuts(OsiCuts & cuts, CbcNode * node, OsiCuts & slackCuts, int lastNumberCuts);
243  int parallelCuts(CbcBaseModel * master, OsiCuts & cuts, CbcNode * node, OsiCuts & slackCuts, int lastNumberCuts);
250  CbcNode ** solveOneNode(int whichSolver, CbcNode * node,
251  int & numberNodesOutput, int & status) ;
253  void resizeWhichGenerator(int numberNow, int numberAfter);
254 public:
255 #ifdef CBC_KEEP_DEPRECATED
256  // See if anyone is using these any more!!
261  CbcModel * cleanModel(const double * lower, const double * upper);
278  int subBranchAndBound(CbcModel * model2,
279  CbcModel * presolvedModel,
280  int maximumNodes);
296  int subBranchAndBound(const double * lower, const double * upper,
297  int maximumNodes);
298 
305  OsiSolverInterface * strengthenedModel();
315  CglPreProcess * preProcess( int makeEquality = 0, int numberPasses = 5,
316  int tuning = 5);
319  void postProcess(CglPreProcess * process);
320 #endif
321  void addUpdateInformation(const CbcObjectUpdateData & data);
329  int doOneNode(CbcModel * baseModel, CbcNode * & node, CbcNode * & newNode);
330 
331 public:
345  int resolve(CbcNodeInfo * parent, int whereFrom,
346  double * saveSolution = NULL,
347  double * saveLower = NULL,
348  double * saveUpper = NULL);
350  void makeGlobalCuts(int numberRows, const int * which);
352  void makeGlobalCut(const OsiRowCut * cut);
354  void makeGlobalCut(const OsiRowCut & cut);
356  void makeGlobalCut(const OsiColCut * cut);
358  void makeGlobalCut(const OsiColCut & cut);
360  void makePartialCut(const OsiRowCut * cut, const OsiSolverInterface * solver=NULL);
362  void makeGlobalCuts();
364  inline const int * whichGenerator() const
365  { return whichGenerator_;}
367 
370 
382  CbcModel * findCliques(bool makeEquality, int atLeastThisMany,
383  int lessThanThis, int defaultValue = 1000);
384 
393  CbcModel * integerPresolve(bool weak = false);
394 
399  bool integerPresolveThisModel(OsiSolverInterface * originalSolver, bool weak = false);
400 
401 
403  void originalModel(CbcModel * presolvedModel, bool weak);
404 
425  bool tightenVubs(int type, bool allowMultipleBinary = false,
426  double useCutoff = 1.0e50);
427 
433  bool tightenVubs(int numberVubs, const int * which,
434  double useCutoff = 1.0e50);
438  void analyzeObjective();
439 
443  void AddIntegers();
447  void saveModel(OsiSolverInterface * saveSolver, double * checkCutoffForRestart, bool * feasible);
451  void flipModel();
452 
454 
460 
462  inline int numberObjects() const {
463  return numberObjects_;
464  }
466  inline void setNumberObjects(int number) {
467  numberObjects_ = number;
468  }
469 
471  inline OsiObject ** objects() const {
472  return object_;
473  }
474 
476  const inline OsiObject * object(int which) const {
477  return object_[which];
478  }
480  inline OsiObject * modifiableObject(int which) const {
481  return object_[which];
482  }
483 
484  void setOptionalInteger(int index);
485 
487  void deleteObjects(bool findIntegers = true);
488 
493  void addObjects(int numberObjects, OsiObject ** objects);
494 
500 
502  void synchronizeModel() ;
503 
513  void findIntegers(bool startAgain, int type = 0);
514 
516 
517  //---------------------------------------------------------------------------
518 
528  inline bool setIntParam(CbcIntParam key, int value) {
530  intParam_[key] = value;
531  return true;
532  }
534  inline bool setDblParam(CbcDblParam key, double value) {
535  dblParam_[key] = value;
536  return true;
537  }
539  inline int getIntParam(CbcIntParam key) const {
540  return intParam_[key];
541  }
543  inline double getDblParam(CbcDblParam key) const {
544  return dblParam_[key];
545  }
551  void setCutoff(double value) ;
552 
554  inline double getCutoff() const { //double value ;
555  //solver_->getDblParam(OsiDualObjectiveLimit,value) ;
556  //assert( dblParam_[CbcCurrentCutoff]== value * solver_->getObjSense());
557  return dblParam_[CbcCurrentCutoff];
558  }
559 
561  inline bool setMaximumNodes( int value) {
562  return setIntParam(CbcMaxNumNode, value);
563  }
564 
566  inline int getMaximumNodes() const {
567  return getIntParam(CbcMaxNumNode);
568  }
569 
574  inline bool setMaximumSolutions( int value) {
575  return setIntParam(CbcMaxNumSol, value);
576  }
581  inline int getMaximumSolutions() const {
582  return getIntParam(CbcMaxNumSol);
583  }
585  inline bool setPrintingMode( int value) {
586  return setIntParam(CbcPrinting, value);
587  }
588 
590  inline int getPrintingMode() const {
591  return getIntParam(CbcPrinting);
592  }
593 
598  inline bool setMaximumSeconds( double value) {
599  return setDblParam(CbcMaximumSeconds, value);
600  }
605  inline double getMaximumSeconds() const {
607  }
609  double getCurrentSeconds() const ;
610 
612  bool maximumSecondsReached() const ;
613 
617  inline bool setIntegerTolerance( double value) {
618  return setDblParam(CbcIntegerTolerance, value);
619  }
623  inline double getIntegerTolerance() const {
625  }
626 
631  inline bool setInfeasibilityWeight( double value) {
632  return setDblParam(CbcInfeasibilityWeight, value);
633  }
638  inline double getInfeasibilityWeight() const {
640  }
641 
645  inline bool setAllowableGap( double value) {
646  return setDblParam(CbcAllowableGap, value);
647  }
651  inline double getAllowableGap() const {
653  }
654 
658  inline bool setAllowableFractionGap( double value) {
659  return setDblParam(CbcAllowableFractionGap, value);
660  }
664  inline double getAllowableFractionGap() const {
666  }
670  inline bool setAllowablePercentageGap( double value) {
671  return setDblParam(CbcAllowableFractionGap, value*0.01);
672  }
676  inline double getAllowablePercentageGap() const {
677  return 100.0*getDblParam(CbcAllowableFractionGap);
678  }
682  inline bool setHeuristicGap( double value) {
683  return setDblParam(CbcHeuristicGap, value);
684  }
688  inline double getHeuristicGap() const {
690  }
691 
695  inline bool setHeuristicFractionGap( double value) {
696  return setDblParam(CbcHeuristicFractionGap, value);
697  }
701  inline double getHeuristicFractionGap() const {
703  }
708  inline bool setCutoffIncrement( double value) {
709  return setDblParam(CbcCutoffIncrement, value);
710  }
715  inline double getCutoffIncrement() const {
717  }
719  bool canStopOnGap() const;
720 
725  void setHotstartSolution(const double * solution, const int * priorities = NULL) ;
726 
728  inline void setMinimumDrop(double value) {
729  minimumDrop_ = value;
730  }
732  inline double getMinimumDrop() const {
733  return minimumDrop_;
734  }
735 
738  inline void setMaximumCutPassesAtRoot(int value) {
739  maximumCutPassesAtRoot_ = value;
740  }
742  inline int getMaximumCutPassesAtRoot() const {
743  return maximumCutPassesAtRoot_;
744  }
745 
748  inline void setMaximumCutPasses(int value) {
749  maximumCutPasses_ = value;
750  }
752  inline int getMaximumCutPasses() const {
753  return maximumCutPasses_;
754  }
757  inline int getCurrentPassNumber() const {
758  return currentPassNumber_;
759  }
760 
766  void setNumberStrong(int number);
770  inline int numberStrong() const {
771  return numberStrong_;
772  }
775  inline void setPreferredWay(int value) {
776  preferredWay_ = value;
777  }
779  inline int getPreferredWay() const {
780  return preferredWay_;
781  }
783  inline int whenCuts() const {
784  return whenCuts_;
785  }
787  inline void setWhenCuts(int value) {
788  whenCuts_ = value;
789  }
795  bool doCutsNow(int allowForTopOfTree) const;
796 
802  void setNumberBeforeTrust(int number);
805  inline int numberBeforeTrust() const {
806  return numberBeforeTrust_;
807  }
813  void setNumberPenalties(int number);
816  inline int numberPenalties() const {
817  return numberPenalties_;
818  }
820  inline const CbcFullNodeInfo * topOfTree() const
821  { return topOfTree_;}
823  inline void setNumberAnalyzeIterations(int number) {
824  numberAnalyzeIterations_ = number;
825  }
826  inline int numberAnalyzeIterations() const {
827  return numberAnalyzeIterations_;
828  }
831  inline double penaltyScaleFactor() const {
832  return penaltyScaleFactor_;
833  }
836  void setPenaltyScaleFactor(double value);
844  void inline setProblemType(int number) {
845  problemType_ = number;
846  }
847  inline int problemType() const {
848  return problemType_;
849  }
851  inline int currentDepth() const {
852  return currentDepth_;
853  }
854 
856  void setHowOftenGlobalScan(int number);
858  inline int howOftenGlobalScan() const {
859  return howOftenGlobalScan_;
860  }
862  inline int * originalColumns() const {
863  return originalColumns_;
864  }
866  void setOriginalColumns(const int * originalColumns,
867  int numberGood=COIN_INT_MAX) ;
869  OsiRowCut * conflictCut(const OsiSolverInterface * solver, bool & localCuts);
870 
878  inline void setPrintFrequency(int number) {
879  printFrequency_ = number;
880  }
882  inline int printFrequency() const {
883  return printFrequency_;
884  }
886 
887  //---------------------------------------------------------------------------
889 
890  bool isAbandoned() const;
893  bool isProvenOptimal() const;
895  bool isProvenInfeasible() const;
897  bool isContinuousUnbounded() const;
899  bool isProvenDualInfeasible() const;
901  bool isNodeLimitReached() const;
903  bool isSecondsLimitReached() const;
905  bool isSolutionLimitReached() const;
907  inline int getIterationCount() const {
908  return numberIterations_;
909  }
911  inline void incrementIterationCount(int value) {
912  numberIterations_ += value;
913  }
915  inline int getNodeCount() const {
916  return numberNodes_;
917  }
919  inline void incrementNodeCount(int value) {
920  numberNodes_ += value;
921  }
923  inline int getExtraNodeCount() const {
924  return numberExtraNodes_;
925  }
935  inline int status() const {
936  return status_;
937  }
938  inline void setProblemStatus(int value) {
939  status_ = value;
940  }
953  inline int secondaryStatus() const {
954  return secondaryStatus_;
955  }
956  inline void setSecondaryStatus(int value) {
957  secondaryStatus_ = value;
958  }
960  bool isInitialSolveAbandoned() const ;
962  bool isInitialSolveProvenOptimal() const ;
967 
969 
970  //---------------------------------------------------------------------------
983  inline int numberRowsAtContinuous() const {
985  return numberRowsAtContinuous_;
986  }
987 
989  inline int getNumCols() const {
990  return solver_->getNumCols();
991  }
992 
994  inline int getNumRows() const {
995  return solver_->getNumRows();
996  }
997 
999  inline CoinBigIndex getNumElements() const {
1000  return solver_->getNumElements();
1001  }
1002 
1004  inline int numberIntegers() const {
1005  return numberIntegers_;
1006  }
1007  // Integer variables
1008  inline const int * integerVariable() const {
1009  return integerVariable_;
1010  }
1012  inline char integerType(int i) const {
1013  assert (integerInfo_);
1014  assert (integerInfo_[i] == 0 || integerInfo_[i] == 1);
1015  return integerInfo_[i];
1016  }
1018  inline const char * integerType() const {
1019  return integerInfo_;
1020  }
1021 
1023  inline const double * getColLower() const {
1024  return solver_->getColLower();
1025  }
1026 
1028  inline const double * getColUpper() const {
1029  return solver_->getColUpper();
1030  }
1031 
1041  inline const char * getRowSense() const {
1042  return solver_->getRowSense();
1043  }
1044 
1053  inline const double * getRightHandSide() const {
1054  return solver_->getRightHandSide();
1055  }
1056 
1065  inline const double * getRowRange() const {
1066  return solver_->getRowRange();
1067  }
1068 
1070  inline const double * getRowLower() const {
1071  return solver_->getRowLower();
1072  }
1073 
1075  inline const double * getRowUpper() const {
1076  return solver_->getRowUpper();
1077  }
1078 
1080  inline const double * getObjCoefficients() const {
1081  return solver_->getObjCoefficients();
1082  }
1083 
1085  inline double getObjSense() const {
1086  //assert (dblParam_[CbcOptimizationDirection]== solver_->getObjSense());
1087  return dblParam_[CbcOptimizationDirection];
1088  }
1089 
1091  inline bool isContinuous(int colIndex) const {
1092  return solver_->isContinuous(colIndex);
1093  }
1094 
1096  inline bool isBinary(int colIndex) const {
1097  return solver_->isBinary(colIndex);
1098  }
1099 
1104  inline bool isInteger(int colIndex) const {
1105  return solver_->isInteger(colIndex);
1106  }
1107 
1109  inline bool isIntegerNonBinary(int colIndex) const {
1110  return solver_->isIntegerNonBinary(colIndex);
1111  }
1112 
1114  inline bool isFreeBinary(int colIndex) const {
1115  return solver_->isFreeBinary(colIndex) ;
1116  }
1117 
1119  inline const CoinPackedMatrix * getMatrixByRow() const {
1120  return solver_->getMatrixByRow();
1121  }
1122 
1124  inline const CoinPackedMatrix * getMatrixByCol() const {
1125  return solver_->getMatrixByCol();
1126  }
1127 
1129  inline double getInfinity() const {
1130  return solver_->getInfinity();
1131  }
1133  inline const double * getCbcColLower() const {
1134  return cbcColLower_;
1135  }
1137  inline const double * getCbcColUpper() const {
1138  return cbcColUpper_;
1139  }
1141  inline const double * getCbcRowLower() const {
1142  return cbcRowLower_;
1143  }
1145  inline const double * getCbcRowUpper() const {
1146  return cbcRowUpper_;
1147  }
1149  inline const double * getCbcColSolution() const {
1150  return cbcColSolution_;
1151  }
1153  inline const double * getCbcRowPrice() const {
1154  return cbcRowPrice_;
1155  }
1157  inline const double * getCbcReducedCost() const {
1158  return cbcReducedCost_;
1159  }
1161  inline const double * getCbcRowActivity() const {
1162  return cbcRowActivity_;
1163  }
1165 
1166 
1169  inline double * continuousSolution() const {
1171  return continuousSolution_;
1172  }
1177  inline int * usedInSolution() const {
1178  return usedInSolution_;
1179  }
1181  void incrementUsed(const double * solution);
1183  void setBestSolution(CBC_Message how,
1184  double & objectiveValue, const double *solution,
1185  int fixVariables = 0);
1187  void setBestObjectiveValue( double objectiveValue);
1190  double objValue,
1191  const double * solution);
1192 
1200  virtual double checkSolution(double cutoff, double * solution,
1201  int fixVariables, double originalObjValue);
1208  bool feasibleSolution(int & numberIntegerInfeasibilities,
1209  int & numberObjectInfeasibilities) const;
1210 
1216  inline double * currentSolution() const {
1217  return currentSolution_;
1218  }
1222  inline const double * testSolution() const {
1223  return testSolution_;
1224  }
1225  inline void setTestSolution(const double * solution) {
1226  testSolution_ = solution;
1227  }
1229  void reserveCurrentSolution(const double * solution = NULL);
1230 
1232  inline const double * getColSolution() const {
1233  return solver_->getColSolution();
1234  }
1235 
1237  inline const double * getRowPrice() const {
1238  return solver_->getRowPrice();
1239  }
1240 
1242  inline const double * getReducedCost() const {
1243  return solver_->getReducedCost();
1244  }
1245 
1247  inline const double * getRowActivity() const {
1248  return solver_->getRowActivity();
1249  }
1250 
1252  inline double getCurrentObjValue() const {
1253  return dblParam_[CbcCurrentObjectiveValue];
1254  }
1256  inline double getCurrentMinimizationObjValue() const {
1257  return dblParam_[CbcCurrentMinimizationObjectiveValue];
1258  }
1259 
1261  inline double getMinimizationObjValue() const {
1262  return bestObjective_;
1263  }
1265  inline void setMinimizationObjValue(double value) {
1266  bestObjective_ = value;
1267  }
1268 
1270  inline double getObjValue() const {
1271  return bestObjective_ * solver_->getObjSense() ;
1272  }
1278  double getBestPossibleObjValue() const;
1280  inline void setObjValue(double value) {
1281  bestObjective_ = value * solver_->getObjSense() ;
1282  }
1284  inline double getSolverObjValue() const {
1285  return solver_->getObjValue() * solver_->getObjSense() ;
1286  }
1287 
1294  inline double * bestSolution() const {
1295  return bestSolution_;
1296  }
1303  void setBestSolution(const double * solution, int numberColumns,
1304  double objectiveValue, bool check = false);
1305 
1307  inline int getSolutionCount() const {
1308  return numberSolutions_;
1309  }
1310 
1312  inline void setSolutionCount(int value) {
1313  numberSolutions_ = value;
1314  }
1316  int numberSavedSolutions() const;
1318  inline int maximumSavedSolutions() const {
1319  return maximumSavedSolutions_;
1320  }
1322  void setMaximumSavedSolutions(int value);
1324  const double * savedSolution(int which) const;
1326  double savedSolutionObjective(int which) const;
1328  void deleteSavedSolution(int which);
1329 
1338  inline int phase() const {
1339  return phase_;
1340  }
1341 
1343  inline int getNumberHeuristicSolutions() const {
1344  return numberHeuristicSolutions_;
1345  }
1347  inline void setNumberHeuristicSolutions(int value) {
1348  numberHeuristicSolutions_ = value;
1349  }
1350 
1352  inline void setObjSense(double s) {
1353  dblParam_[CbcOptimizationDirection] = s;
1354  solver_->setObjSense(s);
1355  }
1356 
1358  inline double getContinuousObjective() const {
1359  return originalContinuousObjective_;
1360  }
1361  inline void setContinuousObjective(double value) {
1362  originalContinuousObjective_ = value;
1363  }
1365  inline int getContinuousInfeasibilities() const {
1366  return continuousInfeasibilities_;
1367  }
1368  inline void setContinuousInfeasibilities(int value) {
1369  continuousInfeasibilities_ = value;
1370  }
1372  inline double rootObjectiveAfterCuts() const {
1373  return continuousObjective_;
1374  }
1376  inline double sumChangeObjective() const {
1377  return sumChangeObjective1_;
1378  }
1381  inline int numberGlobalViolations() const {
1382  return numberGlobalViolations_;
1383  }
1385  numberGlobalViolations_ = 0;
1386  }
1388  inline bool resolveAfterTakeOffCuts() const {
1389  return resolveAfterTakeOffCuts_;
1390  }
1391  inline void setResolveAfterTakeOffCuts(bool yesNo) {
1392  resolveAfterTakeOffCuts_ = yesNo;
1393  }
1395  inline int maximumRows() const {
1396  return maximumRows_;
1397  }
1399  inline CoinWarmStartBasis & workingBasis() {
1400  return workingBasis_;
1401  }
1403  inline int getStopNumberIterations() const {
1404  return stopNumberIterations_;
1405  }
1407  inline void setStopNumberIterations(int value) {
1408  stopNumberIterations_ = value;
1409  }
1411  inline CbcModel * heuristicModel() const
1412  { return heuristicModel_;}
1414  inline void setHeuristicModel(CbcModel * model)
1415  { heuristicModel_ = model;}
1417 
1420  // Comparison functions (which may be overridden by inheritance)
1421  inline CbcCompareBase * nodeComparison() const {
1422  return nodeCompare_;
1423  }
1424  void setNodeComparison(CbcCompareBase * compare);
1425  void setNodeComparison(CbcCompareBase & compare);
1427 
1430  // Feasibility functions (which may be overridden by inheritance)
1432  return problemFeasibility_;
1433  }
1434  void setProblemFeasibility(CbcFeasibilityBase * feasibility);
1435  void setProblemFeasibility(CbcFeasibilityBase & feasibility);
1437 
1440  inline CbcTree * tree() const {
1442  return tree_;
1443  }
1445  void passInTreeHandler(CbcTree & tree);
1449  void passInSubTreeModel(CbcModel & model);
1454  CbcModel * subTreeModel(OsiSolverInterface * solver = NULL) const;
1456  inline int numberStoppedSubTrees() const {
1457  return numberStoppedSubTrees_;
1458  }
1460  inline void incrementSubTreeStopped() {
1461  numberStoppedSubTrees_++;
1462  }
1468  inline int typePresolve() const {
1469  return presolve_;
1470  }
1471  inline void setTypePresolve(int value) {
1472  presolve_ = value;
1473  }
1474 
1476 
1482 
1485  return branchingMethod_;
1486  }
1488  inline void setBranchingMethod(CbcBranchDecision * method) {
1489  delete branchingMethod_;
1490  branchingMethod_ = method->clone();
1491  }
1496  inline void setBranchingMethod(CbcBranchDecision & method) {
1497  delete branchingMethod_;
1498  branchingMethod_ = method.clone();
1499  }
1501  inline CbcCutModifier * cutModifier() const {
1502  return cutModifier_;
1503  }
1505  void setCutModifier(CbcCutModifier * modifier);
1510  void setCutModifier(CbcCutModifier & modifier);
1512 
1515 
1522  inline int stateOfSearch() const {
1523  return stateOfSearch_;
1524  }
1525  inline void setStateOfSearch(int state) {
1526  stateOfSearch_ = state;
1527  }
1529  inline int searchStrategy() const {
1530  return searchStrategy_;
1531  }
1533  inline void setSearchStrategy(int value) {
1534  searchStrategy_ = value;
1535  }
1537  inline int strongStrategy() const {
1538  return strongStrategy_;
1539  }
1541  inline void setStrongStrategy(int value) {
1542  strongStrategy_ = value;
1543  }
1544 
1546  inline int numberCutGenerators() const {
1547  return numberCutGenerators_;
1548  }
1550  inline CbcCutGenerator ** cutGenerators() const {
1551  return generator_;
1552  }
1554  inline CbcCutGenerator * cutGenerator(int i) const {
1555  return generator_[i];
1556  }
1558  inline CbcCutGenerator * virginCutGenerator(int i) const {
1559  return virginGenerator_[i];
1560  }
1569  void addCutGenerator(CglCutGenerator * generator,
1570  int howOften = 1, const char * name = NULL,
1571  bool normal = true, bool atSolution = false,
1572  bool infeasible = false, int howOftenInSub = -100,
1573  int whatDepth = -1, int whatDepthInSub = -1);
1575 
1580 
1582  inline CbcStrategy * strategy() const {
1583  return strategy_;
1584  }
1589  strategy_ = strategy;
1590  }
1592  inline CbcModel * parentModel() const {
1593  return parentModel_;
1594  }
1597  parentModel_ = &parentModel;
1598  }
1600 
1601 
1608  void addHeuristic(CbcHeuristic * generator, const char *name = NULL,
1609  int before = -1);
1611  inline CbcHeuristic * heuristic(int i) const {
1612  return heuristic_[i];
1613  }
1615  inline int numberHeuristics() const {
1616  return numberHeuristics_;
1617  }
1619  inline void setNumberHeuristics(int value) {
1620  numberHeuristics_ = value;
1621  }
1623  inline CbcHeuristic * lastHeuristic() const {
1624  return lastHeuristic_;
1625  }
1627  inline void setLastHeuristic(CbcHeuristic * last) {
1628  lastHeuristic_ = last;
1629  }
1630 
1649  void passInPriorities(const int * priorities, bool ifNotSimpleIntegers);
1650 
1652  inline int priority(int sequence) const {
1653  return object_[sequence]->priority();
1654  }
1655 
1660  void passInEventHandler(const CbcEventHandler *eventHandler) ;
1661 
1664  return (eventHandler_) ;
1665  }
1666 
1668 
1678  void setApplicationData (void * appData);
1679 
1681  void * getApplicationData() const;
1696  inline const OsiBabSolver * solverCharacteristics() const {
1697  return solverCharacteristics_;
1698  }
1700 
1701  //---------------------------------------------------------------------------
1702 
1705  void passInMessageHandler(CoinMessageHandler * handler);
1708  void newLanguage(CoinMessages::Language language);
1709  inline void setLanguage(CoinMessages::Language language) {
1710  newLanguage(language);
1711  }
1713  inline CoinMessageHandler * messageHandler() const {
1714  return handler_;
1715  }
1717  inline CoinMessages & messages() {
1718  return messages_;
1719  }
1721  inline CoinMessages * messagesPointer() {
1722  return &messages_;
1723  }
1725  void setLogLevel(int value);
1727  inline int logLevel() const {
1728  return handler_->logLevel();
1729  }
1735  inline void setDefaultHandler(bool yesNo) {
1736  defaultHandler_ = yesNo;
1737  }
1739  inline bool defaultHandler() const {
1740  return defaultHandler_;
1741  }
1743  //---------------------------------------------------------------------------
1745 
1746 
1773  inline void setSpecialOptions(int value) {
1774  specialOptions_ = value;
1775  }
1777  inline int specialOptions() const {
1778  return specialOptions_;
1779  }
1781  inline void setRandomSeed(int value) {
1782  randomSeed_ = value;
1783  }
1785  inline int getRandomSeed() const {
1786  return randomSeed_;
1787  }
1789  inline void setMultipleRootTries(int value) {
1790  multipleRootTries_ = value;
1791  }
1793  inline int getMultipleRootTries() const {
1794  return multipleRootTries_;
1795  }
1797  inline void sayEventHappened()
1798  { eventHappened_=true;}
1800  inline bool normalSolver() const {
1801  return (specialOptions_&16) == 0;
1802  }
1807  inline bool waitingForMiniBranchAndBound() const {
1808  return (specialOptions_&1048576) != 0;
1809  }
1833  inline void setMoreSpecialOptions(int value) {
1834  moreSpecialOptions_ = value;
1835  }
1837  inline int moreSpecialOptions() const {
1838  return moreSpecialOptions_;
1839  }
1841  inline void setCutoffAsConstraint(bool yesNo) {
1842  cutoffRowNumber_ = (yesNo) ? -2 : -1;
1843  }
1845  inline void setUseElapsedTime(bool yesNo) {
1846  if (yesNo)
1847  moreSpecialOptions_ |= 131072;
1848  else
1849  moreSpecialOptions_ &= ~131072;
1850  }
1852  inline bool useElapsedTime() const {
1853  return (moreSpecialOptions_&131072)!=0;
1854  }
1856  inline void * temporaryPointer() const
1857  { return temporaryPointer_;}
1859  inline void setTemporaryPointer(void * pointer)
1860  { temporaryPointer_=pointer;}
1862  void goToDantzig(int numberNodes, ClpDualRowPivot *& savePivotMethod);
1864  inline bool ownObjects() const {
1865  return ownObjects_;
1866  }
1868  void checkModel();
1870  //---------------------------------------------------------------------------
1871 
1873 
1874  CbcModel();
1876 
1878  CbcModel(const OsiSolverInterface &);
1879 
1888  void assignSolver(OsiSolverInterface *&solver, bool deleteSolver = true);
1889 
1901  inline void setModelOwnsSolver (bool ourSolver) {
1902  ownership_ = ourSolver ? (ownership_ | 0x80000000) : (ownership_ & (~0x80000000)) ;
1903  }
1904 
1910  inline bool modelOwnsSolver () {
1911  return ((ownership_&0x80000000) != 0) ;
1912  }
1913 
1917  CbcModel(const CbcModel & rhs, bool cloneHandler = false);
1918 
1920  virtual CbcModel *clone (bool cloneHandler);
1921 
1923  CbcModel & operator=(const CbcModel& rhs);
1924 
1926  virtual ~CbcModel ();
1927 
1929  inline OsiSolverInterface * solver() const {
1930  return solver_;
1931  }
1932 
1934  inline OsiSolverInterface * swapSolver(OsiSolverInterface * solver) {
1935  OsiSolverInterface * returnSolver = solver_;
1936  solver_ = solver;
1937  return returnSolver;
1938  }
1939 
1941  inline OsiSolverInterface * continuousSolver() const {
1942  return continuousSolver_;
1943  }
1944 
1946  inline void createContinuousSolver() {
1947  continuousSolver_ = solver_->clone();
1948  }
1950  inline void clearContinuousSolver() {
1951  delete continuousSolver_;
1952  continuousSolver_ = NULL;
1953  }
1954 
1956  inline OsiSolverInterface * referenceSolver() const {
1957  return referenceSolver_;
1958  }
1959 
1961  void saveReferenceSolver();
1962 
1968  void resetToReferenceSolver();
1969 
1971  void gutsOfDestructor();
1974  void gutsOfDestructor2();
1977  void resetModel();
1983  void gutsOfCopy(const CbcModel & rhs, int mode = 0);
1985  void moveInfo(const CbcModel & rhs);
1987 
1989 
1990  static bool haveMultiThreadSupport();
1994  return masterThread_;
1995  }
1997  CbcNodeInfo ** walkback() const {
1998  return walkback_;
1999  }
2001  inline int getNumberThreads() const {
2002  return numberThreads_;
2003  }
2005  inline void setNumberThreads(int value) {
2006  numberThreads_ = value;
2007  }
2009  inline int getThreadMode() const {
2010  return threadMode_;
2011  }
2021  inline void setThreadMode(int value) {
2022  threadMode_ = value;
2023  }
2030  inline int parallelMode() const {
2031  if (!numberThreads_) {
2032  if ((threadMode_&1) == 0)
2033  return 0;
2034  else
2035  return -1;
2036  return 0;
2037  } else {
2038  if ((threadMode_&1) == 0)
2039  return 1;
2040  else
2041  return -2;
2042  }
2043  }
2045  inline CbcBaseModel * master() const
2046  { return master_;}
2049  bool isLocked() const;
2050 #ifdef CBC_THREAD
2051 
2055  void lockThread();
2059  void unlockThread();
2060 #else
2061  inline void lockThread() {}
2062  inline void unlockThread() {}
2063 #endif
2064 
2071  void setInfoInChild(int type, CbcThread * info);
2078  void moveToModel(CbcModel * baseModel, int mode);
2080  int splitModel(int numberModels, CbcModel ** model,
2081  int numberNodes);
2083  void startSplitModel(int numberIterations);
2085  void mergeModels(int numberModel, CbcModel ** model,
2086  int numberNodes);
2088 
2090 
2091  int getNodeCount2() const {
2093  return numberNodes2_;
2094  }
2096  void setPointers(const OsiSolverInterface * solver);
2102  int reducedCostFix() ;
2106  void synchronizeHandlers(int makeDefault);
2108  void saveExtraSolution(const double * solution, double objectiveValue);
2110  void saveBestSolution(const double * solution, double objectiveValue);
2112  void deleteSolutions();
2114  int resolve(OsiSolverInterface * solver);
2115 #ifdef CLP_RESOLVE
2116  int resolveClp(OsiClpSolverInterface * solver, int type);
2118 #endif
2119 
2123  int chooseBranch(CbcNode * & newNode, int numberPassesLeft,
2124  CbcNode * oldNode, OsiCuts & cuts,
2125  bool & resolved, CoinWarmStartBasis *lastws,
2126  const double * lowerBefore, const double * upperBefore,
2127  OsiSolverBranch * & branches);
2128  int chooseBranch(CbcNode * newNode, int numberPassesLeft, bool & resolved);
2129 
2136  CoinWarmStartBasis *getEmptyBasis(int ns = 0, int na = 0) const ;
2137 
2149  int takeOffCuts(OsiCuts &cuts,
2150  bool allowResolve, OsiCuts * saveCuts,
2151  int numberNewCuts = 0, const OsiRowCut ** newCuts = NULL) ;
2152 
2166  int addCuts(CbcNode * node, CoinWarmStartBasis *&lastws, bool canFix);
2167 
2184  bool addCuts1(CbcNode * node, CoinWarmStartBasis *&lastws);
2188  void previousBounds (CbcNode * node, CbcNodeInfo * where, int iColumn,
2189  double & lower, double & upper, int force);
2194  void setObjectiveValue(CbcNode * thisNode, const CbcNode * parentNode) const;
2195 
2199  void convertToDynamic();
2201  void synchronizeNumberBeforeTrust(int type = 0);
2203  void zapIntegerInformation(bool leaveObjects = true);
2205  int cliquePseudoCosts(int doStatistics);
2207  void pseudoShadow(int type);
2214  void fillPseudoCosts(double * downCosts, double * upCosts,
2215  int * priority = NULL,
2216  int * numberDown = NULL, int * numberUp = NULL,
2217  int * numberDownInfeasible = NULL,
2218  int * numberUpInfeasible = NULL) const;
2224  void doHeuristicsAtRoot(int deleteHeuristicsAfterwards = 0);
2226  void adjustHeuristics();
2228  inline const double * hotstartSolution() const {
2229  return hotstartSolution_;
2230  }
2232  inline const int * hotstartPriorities() const {
2233  return hotstartPriorities_;
2234  }
2235 
2237  inline CbcCountRowCut ** addedCuts() const {
2238  return addedCuts_;
2239  }
2241  inline int currentNumberCuts() const {
2242  return currentNumberCuts_;
2243  }
2245  inline CbcRowCuts * globalCuts() {
2246  return &globalCuts_;
2247  }
2249  void setNextRowCut(const OsiRowCut & cut);
2251  inline CbcNode * currentNode() const {
2252  return currentNode_;
2253  }
2255  inline CglTreeProbingInfo * probingInfo() const {
2256  return probingInfo_;
2257  }
2259  inline CoinThreadRandom * randomNumberGenerator() {
2260  return &randomNumberGenerator_;
2261  }
2263  inline void setNumberStrongIterations(int number) {
2264  numberStrongIterations_ = number;
2265  }
2267  inline int numberStrongIterations() const {
2268  return numberStrongIterations_;
2269  }
2271  inline int maximumNumberIterations() const {
2272  return maximumNumberIterations_;
2273  }
2275  inline void setMaximumNumberIterations(int value) {
2276  maximumNumberIterations_ = value;
2277  }
2279  inline void setFastNodeDepth(int value) {
2280  fastNodeDepth_ = value;
2281  }
2283  inline int fastNodeDepth() const {
2284  return fastNodeDepth_;
2285  }
2287  inline int continuousPriority() const {
2288  return continuousPriority_;
2289  }
2291  inline void setContinuousPriority(int value) {
2292  continuousPriority_ = value;
2293  }
2294  inline void incrementExtra(int nodes, int iterations) {
2295  numberExtraNodes_ += nodes;
2296  numberExtraIterations_ += iterations;
2297  }
2299  inline int numberExtraIterations() const {
2300  return numberExtraIterations_;
2301  }
2303  void incrementStrongInfo(int numberTimes, int numberIterations,
2304  int numberFixed, bool ifInfeasible);
2306  inline const int * strongInfo() const {
2307  return strongInfo_;
2308  }
2309 
2311  inline int * mutableStrongInfo() {
2312  return strongInfo_;
2313  }
2315  CglStored * storedRowCuts() const {
2316  return storedRowCuts_;
2317  }
2319  void setStoredRowCuts(CglStored * cuts) {
2320  storedRowCuts_ = cuts;
2321  }
2323  inline bool allDynamic () const {
2324  return ((ownership_&0x40000000) != 0) ;
2325  }
2327  void generateCpp( FILE * fp, int options);
2329  OsiBranchingInformation usefulInformation() const;
2336  inline void setBestSolutionBasis(const CoinWarmStartBasis & bestSolutionBasis) {
2337  bestSolutionBasis_ = bestSolutionBasis;
2338  }
2340  void redoWalkBack();
2342 
2343 //---------------------------------------------------------------------------
2344 
2345 private:
2347 
2348 
2350  OsiSolverInterface * solver_;
2351 
2357  unsigned int ownership_ ;
2358 
2360  OsiSolverInterface * continuousSolver_;
2361 
2363  OsiSolverInterface * referenceSolver_;
2364 
2366  CoinMessageHandler * handler_;
2367 
2373  bool defaultHandler_;
2374 
2376  CoinMessages messages_;
2377 
2379  int intParam_[CbcLastIntParam];
2380 
2382  double dblParam_[CbcLastDblParam];
2383 
2392  mutable CoinWarmStart *emptyWarmStart_ ;
2393 
2395  double bestObjective_;
2397  double bestPossibleObjective_;
2399  double sumChangeObjective1_;
2401  double sumChangeObjective2_;
2402 
2404  double * bestSolution_;
2406  double ** savedSolutions_;
2407 
2412  double * currentSolution_;
2416  mutable const double * testSolution_;
2423  CoinWarmStartBasis bestSolutionBasis_ ;
2425  CbcRowCuts globalCuts_;
2427  CbcRowCuts * globalConflictCuts_;
2428 
2430  double minimumDrop_;
2432  int numberSolutions_;
2434  int numberSavedSolutions_;
2436  int maximumSavedSolutions_;
2443  int stateOfSearch_;
2445  int whenCuts_;
2447  double * hotstartSolution_;
2449  int * hotstartPriorities_;
2451  int numberHeuristicSolutions_;
2453  int numberNodes_;
2457  int numberNodes2_;
2459  int numberIterations_;
2461  int numberSolves_;
2463  int status_;
2474  int secondaryStatus_;
2476  int numberIntegers_;
2478  int numberRowsAtContinuous_;
2484  int cutoffRowNumber_;
2486  int maximumNumberCuts_;
2495  int phase_;
2496 
2498  int currentNumberCuts_;
2499 
2504  int maximumDepth_;
2510  CbcNodeInfo ** walkback_;
2511  CbcNodeInfo ** lastNodeInfo_;
2512  const OsiRowCut ** lastCut_;
2513  int lastDepth_;
2514  int lastNumberCuts2_;
2515  int maximumCuts_;
2516  int * lastNumberCuts_;
2517 
2525  CbcCountRowCut ** addedCuts_;
2526 
2530  OsiRowCut * nextRowCut_;
2531 
2533  CbcNode * currentNode_;
2534 
2536  int * integerVariable_;
2538  char * integerInfo_;
2540  double * continuousSolution_;
2542  int * usedInSolution_;
2566  int specialOptions_;
2581  int moreSpecialOptions_;
2583  CbcCompareBase * nodeCompare_;
2585  CbcFeasibilityBase * problemFeasibility_;
2587  CbcTree * tree_;
2589  CbcFullNodeInfo * topOfTree_;
2591  CbcModel * subTreeModel_;
2593  CbcModel * heuristicModel_;
2595  int numberStoppedSubTrees_;
2597  CbcBranchDecision * branchingMethod_;
2599  CbcCutModifier * cutModifier_;
2601  CbcStrategy * strategy_;
2603  CbcModel * parentModel_;
2609  const double * cbcColLower_;
2612  const double * cbcColUpper_;
2614  const double * cbcRowLower_;
2616  const double * cbcRowUpper_;
2618  const double * cbcColSolution_;
2620  const double * cbcRowPrice_;
2622  const double * cbcReducedCost_;
2624  const double * cbcRowActivity_;
2626  void * appData_;
2628  int presolve_;
2632  int numberStrong_;
2638  int numberBeforeTrust_;
2642  int numberPenalties_;
2644  int stopNumberIterations_;
2647  double penaltyScaleFactor_;
2649  int numberAnalyzeIterations_;
2651  double * analyzeResults_;
2653  void * temporaryPointer_;
2655  int numberInfeasibleNodes_;
2662  int problemType_;
2664  int printFrequency_;
2666  int numberCutGenerators_;
2667  // Cut generators
2668  CbcCutGenerator ** generator_;
2669  // Cut generators before any changes
2670  CbcCutGenerator ** virginGenerator_;
2672  int numberHeuristics_;
2674  CbcHeuristic ** heuristic_;
2676  CbcHeuristic * lastHeuristic_;
2678  int fastNodeDepth_;
2680 # ifdef CBC_ONLY_CLP
2681  ClpEventHandler *eventHandler_ ;
2682 # else
2683  CbcEventHandler *eventHandler_ ;
2684 # endif
2685 
2687  int numberObjects_;
2688 
2699  OsiObject ** object_;
2701  bool ownObjects_;
2702 
2704  int * originalColumns_;
2706  int howOftenGlobalScan_;
2709  int numberGlobalViolations_;
2711  int numberExtraIterations_;
2713  int numberExtraNodes_;
2717  double continuousObjective_;
2720  double originalContinuousObjective_;
2722  int continuousInfeasibilities_;
2724  int maximumCutPassesAtRoot_;
2726  int maximumCutPasses_;
2728  int preferredWay_;
2730  int currentPassNumber_;
2732  int maximumWhich_;
2734  int maximumRows_;
2736  int randomSeed_;
2738  int multipleRootTries_;
2740  int currentDepth_;
2742  mutable CoinThreadRandom randomNumberGenerator_;
2744  CoinWarmStartBasis workingBasis_;
2746  int * whichGenerator_;
2748  int maximumStatistics_;
2750  CbcStatistics ** statistics_;
2752  int maximumDepthActual_;
2754  double numberDJFixed_;
2756  CglTreeProbingInfo * probingInfo_;
2758  int numberFixedAtRoot_;
2760  int numberFixedNow_;
2762  bool stoppedOnGap_;
2764  mutable bool eventHappened_;
2766  int numberLongStrong_;
2768  int numberOldActiveCuts_;
2770  int numberNewCuts_;
2772  int searchStrategy_;
2784  int strongStrategy_;
2786  int numberStrongIterations_;
2789  int strongInfo_[7];
2796  OsiBabSolver * solverCharacteristics_;
2798  bool resolveAfterTakeOffCuts_;
2800  int maximumNumberIterations_;
2802  int continuousPriority_;
2804  int numberUpdateItems_;
2806  int maximumNumberUpdateItems_;
2808  CbcObjectUpdateData * updateItems_;
2810  CglStored * storedRowCuts_;
2818  int numberThreads_;
2826  int threadMode_;
2828  CbcBaseModel * master_;
2830  CbcThread * masterThread_;
2832 };
2834 void getIntegerInformation(const OsiObject * object, double & originalLower,
2835  double & originalUpper) ;
2836 // So we can call from other programs
2837 // Real main program
2838 class OsiClpSolverInterface;
2839 int CbcMain (int argc, const char *argv[], OsiClpSolverInterface & solver, CbcModel ** babSolver);
2840 int CbcMain (int argc, const char *argv[], CbcModel & babSolver);
2841 // four ways of calling
2842 int callCbc(const char * input2, OsiClpSolverInterface& solver1);
2843 int callCbc(const char * input2);
2844 int callCbc(const std::string input2, OsiClpSolverInterface& solver1);
2845 int callCbc(const std::string input2) ;
2846 // When we want to load up CbcModel with options first
2847 void CbcMain0 (CbcModel & babSolver);
2848 int CbcMain1 (int argc, const char *argv[], CbcModel & babSolver);
2849 // two ways of calling
2850 int callCbc(const char * input2, CbcModel & babSolver);
2851 int callCbc(const std::string input2, CbcModel & babSolver);
2852 // And when CbcMain0 already called to initialize
2853 int callCbc1(const char * input2, CbcModel & babSolver);
2854 int callCbc1(const std::string input2, CbcModel & babSolver);
2855 // And when CbcMain0 already called to initialize (with call back) (see CbcMain1 for whereFrom)
2856 int callCbc1(const char * input2, CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom));
2857 int callCbc1(const std::string input2, CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom));
2858 int CbcMain1 (int argc, const char *argv[], CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom));
2859 // For uniform setting of cut and heuristic options
2860 void setCutAndHeuristicOptions(CbcModel & model);
2861 #endif
2862 
void flipModel()
Flip direction of optimization on all models.
CbcThread * masterThread() const
Get pointer to masterthread.
Definition: CbcModel.hpp:1993
void passInSolverCharacteristics(OsiBabSolver *solverCharacteristics)
For advanced applications you may wish to modify the behavior of Cbc e.g.
const double * testSolution() const
For testing infeasibilities - will point to currentSolution_ or solver–>getColSolution() ...
Definition: CbcModel.hpp:1222
void setProblemFeasibility(CbcFeasibilityBase *feasibility)
int addCuts(CbcNode *node, CoinWarmStartBasis *&lastws, bool canFix)
Determine and install the active cuts that need to be added for the current subproblem.
The objective is assumed to worsen by this amount for each integer infeasibility. ...
Definition: CbcModel.hpp:136
void resetToReferenceSolver()
Uses a copy of reference solver to be current solver.
Number of branches (may be more than number of nodes as may include strong branching) ...
Definition: CbcModel.hpp:125
void newLanguage(CoinMessages::Language language)
Set language.
CbcHeuristic * lastHeuristic() const
Pointer to heuristic solver which found last solution (or NULL)
Definition: CbcModel.hpp:1623
CbcModel * integerPresolve(bool weak=false)
Do integer presolve, creating a new (presolved) model.
void setPointers(const OsiSolverInterface *solver)
Set pointers for speed.
const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
Definition: CbcModel.hpp:1053
void setHowOftenGlobalScan(int number)
Set how often to scan global cuts.
Current objective value.
Definition: CbcModel.hpp:162
void setLastHeuristic(CbcHeuristic *last)
set last heuristic which found a solution
Definition: CbcModel.hpp:1627
Event handling for cbc.
CbcBranchDecision * branchingMethod() const
Get the current branching decision method.
Definition: CbcModel.hpp:1484
double getSolverObjValue() const
Get solver objective function value (as minimization)
Definition: CbcModel.hpp:1284
int * usedInSolution() const
Array marked whenever a solution is found if non-zero.
Definition: CbcModel.hpp:1177
void setOptionalInteger(int index)
int moreSpecialOptions() const
Get more special options.
Definition: CbcModel.hpp:1837
void * getApplicationData() const
Get application data.
void setRandomSeed(int value)
Set random seed.
Definition: CbcModel.hpp:1781
bool setAllowableFractionGap(double value)
Set the fraction allowable gap between the best known solution and the best possible solution...
Definition: CbcModel.hpp:658
bool isInitialSolveProvenOptimal() const
Is optimality proven (for initialSolve) ?
const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
Definition: CbcModel.hpp:1065
int getPrintingMode() const
Get the printing mode.
Definition: CbcModel.hpp:590
void incrementStrongInfo(int numberTimes, int numberIterations, int numberFixed, bool ifInfeasible)
Increment strong info.
int CbcMain(int argc, const char *argv[], OsiClpSolverInterface &solver, CbcModel **babSolver)
void setCutoffAsConstraint(bool yesNo)
Set cutoff as constraint.
Definition: CbcModel.hpp:1841
CbcModel & operator=(const CbcModel &rhs)
Assignment operator.
const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
Definition: CbcModel.hpp:1080
bool isAbandoned() const
Are there a numerical difficulties?
The maximum number of nodes before terminating.
Definition: CbcModel.hpp:106
bool isNodeLimitReached() const
Node limit reached?
const char * integerType() const
Whether or not integer.
Definition: CbcModel.hpp:1018
CbcModel * heuristicModel() const
A pointer to model from CbcHeuristic.
Definition: CbcModel.hpp:1411
void setFastNodeDepth(int value)
Set depth for fast nodes.
Definition: CbcModel.hpp:2279
void setNumberStrongIterations(int number)
Set the number of iterations done in strong branching.
Definition: CbcModel.hpp:2263
int getThreadMode() const
Get thread mode.
Definition: CbcModel.hpp:2009
int numberObjects() const
Get the number of objects.
Definition: CbcModel.hpp:462
bool isSolutionLimitReached() const
Solution limit reached?
bool setHeuristicFractionGap(double value)
Set the fraction heuristic gap between the best known solution and the best possible solution...
Definition: CbcModel.hpp:695
CoinBigIndex getNumElements() const
Get number of nonzero elements.
Definition: CbcModel.hpp:999
bool isIntegerNonBinary(int colIndex) const
Return true if variable is general integer.
Definition: CbcModel.hpp:1109
void setStrongStrategy(int value)
Set strong branching strategy.
Definition: CbcModel.hpp:1541
int * mutableStrongInfo()
Return mutable strong info.
Definition: CbcModel.hpp:2311
virtual CbcModel * clone(bool cloneHandler)
Clone.
const double * getCbcColUpper() const
Get pointer to array[getNumCols()] (for speed) of column upper bounds.
Definition: CbcModel.hpp:1137
void setHeuristicModel(CbcModel *model)
Set a pointer to model from CbcHeuristic.
Definition: CbcModel.hpp:1414
bool isBinary(int colIndex) const
Return true if variable is binary.
Definition: CbcModel.hpp:1096
void setResolveAfterTakeOffCuts(bool yesNo)
Definition: CbcModel.hpp:1391
int getIterationCount() const
Get how many iterations it took to solve the problem.
Definition: CbcModel.hpp:907
int numberHeuristics() const
Get the number of heuristics.
Definition: CbcModel.hpp:1615
int secondaryStatus() const
Secondary status of problem -1 unset (status_ will also be -1) 0 search completed with solution 1 lin...
Definition: CbcModel.hpp:953
void incrementNodeCount(int value)
Increment how many nodes it took to solve the problem.
Definition: CbcModel.hpp:919
void setContinuousPriority(int value)
Set anything with priority >= this can be treated as continuous.
Definition: CbcModel.hpp:2291
int maximumRows() const
Maximum number of rows.
Definition: CbcModel.hpp:1395
double rootObjectiveAfterCuts() const
Value of objective after root node cuts added.
Definition: CbcModel.hpp:1372
int getContinuousInfeasibilities() const
Number of infeasibilities at continuous.
Definition: CbcModel.hpp:1365
int callCbc(const char *input2, OsiClpSolverInterface &solver1)
CbcEventHandler * getEventHandler() const
Retrieve a pointer to the event handler.
Definition: CbcModel.hpp:1663
void lockThread()
Definition: CbcModel.hpp:2061
const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
Definition: CbcModel.hpp:1242
int getNumberHeuristicSolutions() const
Get number of heuristic solutions.
Definition: CbcModel.hpp:1343
Just a marker, so that a static sized array can store parameters.
Definition: CbcModel.hpp:193
const double * getCbcReducedCost() const
Get a pointer to array[getNumCols()] (for speed) of reduced costs.
Definition: CbcModel.hpp:1157
bool setInfeasibilityWeight(double value)
Set the weight per integer infeasibility .
Definition: CbcModel.hpp:631
void reserveCurrentSolution(const double *solution=NULL)
Make sure region there and optionally copy solution.
int getMultipleRootTries() const
Get multiple root tries.
Definition: CbcModel.hpp:1793
int numberRowsAtContinuous() const
Number of rows in continuous (root) problem.
Definition: CbcModel.hpp:984
bool setIntegerTolerance(double value)
Set the integrality tolerance .
Definition: CbcModel.hpp:617
int logLevel() const
Get log level.
Definition: CbcModel.hpp:1727
int searchStrategy() const
Strategy worked out - mainly at root node for use by CbcNode.
Definition: CbcModel.hpp:1529
const double * hotstartSolution() const
Get the hotstart solution.
Definition: CbcModel.hpp:2228
bool addCuts1(CbcNode *node, CoinWarmStartBasis *&lastws)
Traverse the tree from node to root and prep the model.
bool setMaximumSolutions(int value)
Set the maximum number of solutions desired.
Definition: CbcModel.hpp:574
bool isFreeBinary(int colIndex) const
Return true if variable is binary and not fixed at either bound.
Definition: CbcModel.hpp:1114
bool canStopOnGap() const
See if can stop on gap.
Cutoff - stored for speed.
Definition: CbcModel.hpp:158
bool isProvenOptimal() const
Is optimality proven?
CbcNodeInfo ** walkback() const
Get pointer to walkback.
Definition: CbcModel.hpp:1997
int howOftenGlobalScan() const
Get how often to scan global cuts.
Definition: CbcModel.hpp:858
bool integerPresolveThisModel(OsiSolverInterface *originalSolver, bool weak=false)
Do integer presolve, modifying the current model.
const CbcFullNodeInfo * topOfTree() const
Pointer to top of tree.
Definition: CbcModel.hpp:820
CoinWarmStartBasis & workingBasis()
Work basis for temporary use.
Definition: CbcModel.hpp:1399
CbcCountRowCut ** addedCuts() const
Return the list of cuts initially collected for this subproblem.
Definition: CbcModel.hpp:2237
void setStoredRowCuts(CglStored *cuts)
Set stored row cuts for donor/recipient CbcModel.
Definition: CbcModel.hpp:2319
bool setDblParam(CbcDblParam key, double value)
Set a double parameter.
Definition: CbcModel.hpp:534
void clearContinuousSolver()
Clear solver with continuous state.
Definition: CbcModel.hpp:1950
CoinMessages * messagesPointer()
Return pointer to messages.
Definition: CbcModel.hpp:1721
void makePartialCut(const OsiRowCut *cut, const OsiSolverInterface *solver=NULL)
Make partial cut into a global cut and save.
int getRandomSeed() const
Get random seed.
Definition: CbcModel.hpp:1785
void setNumberHeuristicSolutions(int value)
Set number of heuristic solutions.
Definition: CbcModel.hpp:1347
int getNodeCount2() const
Get how many Nodes it took to solve the problem.
Definition: CbcModel.hpp:2092
Sum of non-zero changes on a branch.
Definition: CbcModel.hpp:187
int phase() const
Current phase (so heuristics etc etc can find out).
Definition: CbcModel.hpp:1338
bool modelOwnsSolver()
Get ownership of solver.
Definition: CbcModel.hpp:1910
void setModelOwnsSolver(bool ourSolver)
Set ownership of solver.
Definition: CbcModel.hpp:1901
void setNumberAnalyzeIterations(int number)
Number of analyze iterations to do.
Definition: CbcModel.hpp:823
int currentNumberCuts() const
Number of entries in the list returned by addedCuts()
Definition: CbcModel.hpp:2241
void setThreadMode(int value)
Set thread mode always use numberThreads for branching 1 set then deterministic 2 set then use number...
Definition: CbcModel.hpp:2021
int takeOffCuts(OsiCuts &cuts, bool allowResolve, OsiCuts *saveCuts, int numberNewCuts=0, const OsiRowCut **newCuts=NULL)
Remove inactive cuts from the model.
double getCurrentObjValue() const
Get current objective function value.
Definition: CbcModel.hpp:1252
void setNumberThreads(int value)
Set number of threads.
Definition: CbcModel.hpp:2005
void saveReferenceSolver()
Save a copy of the current solver so can be reset to.
int strongStrategy() const
Stong branching strategy.
Definition: CbcModel.hpp:1537
void setPrintFrequency(int number)
Set the print frequency.
Definition: CbcModel.hpp:878
bool feasibleSolution(int &numberIntegerInfeasibilities, int &numberObjectInfeasibilities) const
Test the current solution for feasiblility.
bool normalSolver() const
Says if normal solver i.e. has well defined CoinPackedMatrix.
Definition: CbcModel.hpp:1800
virtual double checkSolution(double cutoff, double *solution, int fixVariables, double originalObjValue)
Call this to really test if a valid solution can be feasible Solution is number columns in size...
void passInEventHandler(const CbcEventHandler *eventHandler)
Set an event handler.
void setNumberStrong(int number)
Set the maximum number of candidates to be evaluated for strong branching.
void setLanguage(CoinMessages::Language language)
Definition: CbcModel.hpp:1709
OsiRowCut * conflictCut(const OsiSolverInterface *solver, bool &localCuts)
Create conflict cut (well - most of)
void passInTreeHandler(CbcTree &tree)
For modifying tree handling (original is cloned)
void incrementUsed(const double *solution)
Increases usedInSolution for nonzeros.
double savedSolutionObjective(int which) const
Return a saved solution objective (0==best) - COIN_DBL_MAX if off end.
void unlockThread()
Definition: CbcModel.hpp:2062
bool defaultHandler() const
Check default handler.
Definition: CbcModel.hpp:1739
void convertToDynamic()
If numberBeforeTrust >0 then we are going to use CbcBranchDynamic.
double getIntegerTolerance() const
Get the integrality tolerance .
Definition: CbcModel.hpp:623
int numberStrong() const
Get the maximum number of candidates to be evaluated for strong branching.
Definition: CbcModel.hpp:770
const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
Definition: CbcModel.hpp:1028
bool setAllowablePercentageGap(double value)
Set the percentage allowable gap between the best known solution and the best possible solution...
Definition: CbcModel.hpp:670
int numberIntegers() const
Number of integers in problem.
Definition: CbcModel.hpp:1004
void setBranchingMethod(CbcBranchDecision *method)
Set the branching decision method.
Definition: CbcModel.hpp:1488
void generateCpp(FILE *fp, int options)
Create C++ lines to get to current state.
void incrementExtra(int nodes, int iterations)
Definition: CbcModel.hpp:2294
int cliquePseudoCosts(int doStatistics)
Use cliques for pseudocost information - return nonzero if infeasible.
Adjusts printout 1 does different node message with number unsatisfied on last branch.
Definition: CbcModel.hpp:122
void setApplicationData(void *appData)
Set application data.
Stop when the gap between the objective value of the best known solution and the best bound on the ob...
Definition: CbcModel.hpp:153
void setStrategy(CbcStrategy &strategy)
Set the strategy. Clones.
void setSearchStrategy(int value)
Set strategy worked out - mainly at root node for use by CbcNode.
Definition: CbcModel.hpp:1533
bool isInitialSolveProvenPrimalInfeasible() const
Is primal infeasiblity proven (for initialSolve) ?
void setOriginalColumns(const int *originalColumns, int numberGood=COIN_INT_MAX)
Set original columns as created by preprocessing.
void deleteSolutions()
Delete best and saved solutions.
void makeGlobalCuts()
Make partial cuts into global cuts.
double * bestSolution() const
The best solution to the integer programming problem.
Definition: CbcModel.hpp:1294
bool isProvenInfeasible() const
Is infeasiblity proven (or none better than cutoff)?
CbcCutGenerator ** cutGenerators() const
Get the list of cut generators.
Definition: CbcModel.hpp:1550
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:1833
bool setPrintingMode(int value)
Set the printing mode.
Definition: CbcModel.hpp:585
void setDefaultHandler(bool yesNo)
Set flag to say if handler_ is the default handler.
Definition: CbcModel.hpp:1735
int numberGlobalViolations() const
Number of times global cuts violated.
Definition: CbcModel.hpp:1381
CbcNode * currentNode() const
Get a pointer to current node (be careful)
Definition: CbcModel.hpp:2251
void saveSolution(const OsiSolverInterface *osi, std::string fileName)
void setCutAndHeuristicOptions(CbcModel &model)
int getMaximumCutPasses() const
Get the maximum number of cut passes at other nodes (default 10)
Definition: CbcModel.hpp:752
void moveToModel(CbcModel *baseModel, int mode)
Move/copy information from one model to another -1 - initialization 0 - from base model 1 - to base m...
bool ownObjects() const
Now we may not own objects - just point to solver's objects.
Definition: CbcModel.hpp:1864
const double * getCbcColSolution() const
Get pointer to array[getNumCols()] (for speed) of primal solution vector.
Definition: CbcModel.hpp:1149
double getHeuristicGap() const
Get the heuristic gap between the best known solution and the best possible solution.
Definition: CbcModel.hpp:688
const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
Definition: CbcModel.hpp:1119
double getAllowablePercentageGap() const
Get the percentage allowable gap between the best known solution and the best possible solution...
Definition: CbcModel.hpp:676
bool maximumSecondsReached() const
Return true if maximum time reached.
Fathoming discipline.
Definition: CbcModel.hpp:118
double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
Definition: CbcModel.hpp:1085
bool isSecondsLimitReached() const
Time limit reached?
int whenCuts() const
Get at which depths to do cuts.
Definition: CbcModel.hpp:783
void incrementSubTreeStopped()
Says a sub tree was stopped.
Definition: CbcModel.hpp:1460
int getMaximumCutPassesAtRoot() const
Get the maximum number of cut passes at root node.
Definition: CbcModel.hpp:742
double getMinimumDrop() const
Get the minimum drop to continue cuts.
Definition: CbcModel.hpp:732
const double * getRowPrice() const
Get pointer to array[getNumRows()] of dual prices.
Definition: CbcModel.hpp:1237
void gutsOfCopy(const CbcModel &rhs, int mode=0)
Most of copy constructor mode - 0 copy but don't delete before 1 copy and delete before 2 copy and de...
bool isProvenDualInfeasible() const
Was continuous solution unbounded.
int printFrequency() const
Get the print frequency.
Definition: CbcModel.hpp:882
void setInfoInChild(int type, CbcThread *info)
Set information in a child -3 pass pointer to child thread info -2 just stop -1 delete simple child s...
CbcEventHandler::CbcAction dealWithEventHandler(CbcEventHandler::CbcEvent event, double objValue, const double *solution)
Deals with event handler and solution.
void branchAndBound(int doStatistics=0)
Invoke the branch & cut algorithm.
CbcEvent
Events known to cbc.
Current minimization objective value.
Definition: CbcModel.hpp:164
CoinWarmStartBasis * getEmptyBasis(int ns=0, int na=0) const
Return an empty basis object of the specified size.
double getAllowableFractionGap() const
Get the fraction allowable gap between the best known solution and the best possible solution...
Definition: CbcModel.hpp:664
CbcCutModifier * cutModifier() const
Get the current cut modifier method.
Definition: CbcModel.hpp:1501
void setBestSolutionBasis(const CoinWarmStartBasis &bestSolutionBasis)
Warm start object produced by heuristic or strong branching.
Definition: CbcModel.hpp:2336
void synchronizeHandlers(int makeDefault)
Makes all handlers same.
void setNumberPenalties(int number)
Set the number of variables for which to compute penalties in dynamic strong branching.
double getAllowableGap() const
Get the allowable gap between the best known solution and the best possible solution.
Definition: CbcModel.hpp:651
void setMinimizationObjValue(double value)
Set best objective function value as minimization.
Definition: CbcModel.hpp:1265
void startSplitModel(int numberIterations)
Start threads.
Using MS heap implementation.
Definition: CbcTree.hpp:53
const OsiObject * object(int which) const
Get the specified object.
Definition: CbcModel.hpp:476
Stop doing heuristics when the gap between the objective value of the best known solution and the bes...
Definition: CbcModel.hpp:183
void setLogLevel(int value)
Set log level.
int getCurrentPassNumber() const
Get current cut pass number in this round of cuts.
Definition: CbcModel.hpp:757
bool isInteger(int colIndex) const
Return true if column is integer.
Definition: CbcModel.hpp:1104
void setWhenCuts(int value)
Set at which depths to do cuts.
Definition: CbcModel.hpp:787
void setNumberBeforeTrust(int number)
Set the number of branches before pseudo costs believed in dynamic strong branching.
Base class for Cbc event handling.
int callCbc1(const char *input2, CbcModel &babSolver)
int typePresolve() const
Whether to automatically do presolve before branch and bound (subTrees).
Definition: CbcModel.hpp:1468
CoinMessageHandler * messageHandler() const
Return handler.
Definition: CbcModel.hpp:1713
void setHotstartSolution(const double *solution, const int *priorities=NULL)
Pass in target solution and optional priorities.
OsiObject ** objects() const
Get the array of objects.
Definition: CbcModel.hpp:471
double * currentSolution() const
Solution to the most recent lp relaxation.
Definition: CbcModel.hpp:1216
Just a marker, so that a static sized array can store parameters.
Definition: CbcModel.hpp:127
const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
Definition: CbcModel.hpp:1124
void setMaximumSavedSolutions(int value)
Set maximum number of extra saved solutions.
void setUseElapsedTime(bool yesNo)
Set time method.
Definition: CbcModel.hpp:1845
double * continuousSolution() const
Holds solution at continuous (after cuts if branchAndBound called)
Definition: CbcModel.hpp:1170
int numberCutGenerators() const
Get the number of cut generators.
Definition: CbcModel.hpp:1546
int getPreferredWay() const
Get the preferred way to branch (default 0)
Definition: CbcModel.hpp:779
double getInfinity() const
Get solver's value for infinity.
Definition: CbcModel.hpp:1129
int numberStoppedSubTrees() const
Returns number of times any subtree stopped on nodes, time etc.
Definition: CbcModel.hpp:1456
CbcHeuristic * heuristic(int i) const
Get the specified heuristic.
Definition: CbcModel.hpp:1611
OsiSolverInterface * continuousSolver() const
Returns solver with continuous state.
Definition: CbcModel.hpp:1941
void gutsOfDestructor2()
Clears out enough to reset CbcModel as if no branch and bound done.
const int * whichGenerator() const
Which cut generator generated this cut.
Definition: CbcModel.hpp:364
int getMaximumNodes() const
Get the maximum node limit .
Definition: CbcModel.hpp:566
const double * savedSolution(int which) const
Return a saved solution (0==best) - NULL if off end.
const double * getCbcRowUpper() const
Get pointer to array[getNumRows()] (for speed) of row upper bounds.
Definition: CbcModel.hpp:1145
void setBestObjectiveValue(double objectiveValue)
Just update objectiveValue.
void redoWalkBack()
Redo walkback arrays.
int fastNodeDepth() const
Get depth for fast nodes.
Definition: CbcModel.hpp:2283
void setStateOfSearch(int state)
Definition: CbcModel.hpp:1525
void setNodeComparison(CbcCompareBase *compare)
Stop doing heuristics when the gap between the objective value of the best known solution and the bes...
Definition: CbcModel.hpp:175
int chooseBranch(CbcNode *&newNode, int numberPassesLeft, CbcNode *oldNode, OsiCuts &cuts, bool &resolved, CoinWarmStartBasis *lastws, const double *lowerBefore, const double *upperBefore, OsiSolverBranch *&branches)
Encapsulates choosing a variable - anyAction -2, infeasible (-1 round again), 0 done.
void synchronizeModel()
Ensure attached objects point to this model.
int resolve(CbcNodeInfo *parent, int whereFrom, double *saveSolution=NULL, double *saveLower=NULL, double *saveUpper=NULL)
Reoptimise an LP relaxation.
void setBranchingMethod(CbcBranchDecision &method)
Set the branching method.
Definition: CbcModel.hpp:1496
The amount by which to tighten the objective function cutoff when a new solution is discovered...
Definition: CbcModel.hpp:139
virtual CbcBranchDecision * clone() const =0
Clone.
void setProblemType(int number)
Problem type as set by user or found by analysis.
Definition: CbcModel.hpp:844
void saveBestSolution(const double *solution, double objectiveValue)
Save a solution to best and move current to saved.
void clearNumberGlobalViolations()
Definition: CbcModel.hpp:1384
CbcModel * parentModel() const
Get the current parent model.
Definition: CbcModel.hpp:1592
void setCutoff(double value)
Set cutoff bound on the objective function.
const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
Definition: CbcModel.hpp:1232
CbcModel * subTreeModel(OsiSolverInterface *solver=NULL) const
For retrieving a copy of subtree model with given OsiSolver.
void passInPriorities(const int *priorities, bool ifNotSimpleIntegers)
Pass in branching priorities.
int numberBeforeTrust() const
get the number of branches before pseudo costs believed in dynamic strong branching.
Definition: CbcModel.hpp:805
OsiRowCut augmented with bookkeeping.
int stateOfSearch() const
State of search 0 - no solution 1 - only heuristic solutions 2 - branched to a solution 3 - no soluti...
Definition: CbcModel.hpp:1522
double getCurrentSeconds() const
Current time since start of branchAndbound.
bool tightenVubs(int type, bool allowMultipleBinary=false, double useCutoff=1.0e50)
For variables involved in VUB constraints, see if we can tighten bounds by solving lp's...
void setNumberObjects(int number)
Set the number of objects.
Definition: CbcModel.hpp:466
double getCurrentMinimizationObjValue() const
Get current minimization objective function value.
Definition: CbcModel.hpp:1256
double getContinuousObjective() const
Value of objective at continuous.
Definition: CbcModel.hpp:1358
void previousBounds(CbcNode *node, CbcNodeInfo *where, int iColumn, double &lower, double &upper, int force)
Returns bounds just before where - initially original bounds.
CbcBaseModel * master() const
Thread stuff for master.
Definition: CbcModel.hpp:2045
CbcModel()
Default Constructor.
int continuousPriority() const
Get anything with priority >= this can be treated as continuous.
Definition: CbcModel.hpp:2287
Optimization direction - stored for speed.
Definition: CbcModel.hpp:160
Information required while the node is live.
Definition: CbcNode.hpp:49
For gathering statistics.
const double * getCbcRowLower() const
Get pointer to array[getNumRows()] (for speed) of row lower bounds.
Definition: CbcModel.hpp:1141
int * originalColumns() const
Original columns as created by integerPresolve or preprocessing.
Definition: CbcModel.hpp:862
void setSolutionCount(int value)
Set number of solutions (so heuristics will be different)
Definition: CbcModel.hpp:1312
int getNumRows() const
Get number of rows.
Definition: CbcModel.hpp:994
double getCutoffIncrement() const
Get the CbcModel::CbcCutoffIncrement desired.
Definition: CbcModel.hpp:715
int parallelMode() const
Return -2 if deterministic threaded and main thread -1 if deterministic threaded and serial thread 0 ...
Definition: CbcModel.hpp:2030
CoinThreadRandom * randomNumberGenerator()
Thread specific random number generator.
Definition: CbcModel.hpp:2259
void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
Definition: CbcModel.hpp:1352
int currentDepth() const
Current depth.
Definition: CbcModel.hpp:851
void CbcMain0(CbcModel &babSolver)
The maximum number of solutions before terminating.
Definition: CbcModel.hpp:108
int getExtraNodeCount() const
Get how many Nodes were enumerated in complete fathoming B&B inside CLP.
Definition: CbcModel.hpp:923
CbcCompareBase * nodeComparison() const
Definition: CbcModel.hpp:1421
int getNumCols() const
Get number of columns.
Definition: CbcModel.hpp:989
CglStored * storedRowCuts() const
Get stored row cuts for donor/recipient CbcModel.
Definition: CbcModel.hpp:2315
const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
Definition: CbcModel.hpp:1075
void setStrategy(CbcStrategy *strategy)
Set the strategy. assigns.
Definition: CbcModel.hpp:1588
void incrementIterationCount(int value)
Increment how many iterations it took to solve the problem.
Definition: CbcModel.hpp:911
CBC_Message
This deals with Cbc messages (as against Clp messages etc).
Definition: CbcMessage.hpp:24
Smallest non-zero change on a branch.
Definition: CbcModel.hpp:185
int getNumberThreads() const
Get number of threads.
Definition: CbcModel.hpp:2001
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:738
void checkModel()
Check original model before it gets messed up.
int doOneNode(CbcModel *baseModel, CbcNode *&node, CbcNode *&newNode)
Do one node - broken out for clarity? also for parallel (when baseModel!=this) Returns 1 if solution ...
void setObjValue(double value)
Set best objective function value.
Definition: CbcModel.hpp:1280
The maximum number of seconds before terminating.
Definition: CbcModel.hpp:156
CoinMessages & messages()
Return messages.
Definition: CbcModel.hpp:1717
bool allDynamic() const
Says whether all dynamic integers.
Definition: CbcModel.hpp:2323
void initialSolve()
Solve the initial LP relaxation.
bool isContinuous(int colIndex) const
Return true if variable is continuous.
Definition: CbcModel.hpp:1091
const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels.
Definition: CbcModel.hpp:1247
CbcRowCuts * globalCuts()
Global cuts.
Definition: CbcModel.hpp:2245
int status() const
Final status of problem Some of these can be found out by is......
Definition: CbcModel.hpp:935
bool setMaximumNodes(int value)
Set the maximum node limit .
Definition: CbcModel.hpp:561
The time at start of model.
Definition: CbcModel.hpp:167
const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
Definition: CbcModel.hpp:1041
void addObjects(int numberObjects, OsiObject **objects)
Add in object information.
int getStopNumberIterations() const
Get number of "iterations" to stop after.
Definition: CbcModel.hpp:1403
OsiSolverInterface * solver() const
Returns solver - has current state.
Definition: CbcModel.hpp:1929
Heuristic base class.
bool isInitialSolveAbandoned() const
Are there numerical difficulties (for initialSolve) ?
int splitModel(int numberModels, CbcModel **model, int numberNodes)
Split up nodes.
void sayEventHappened()
Tell model to stop on event.
Definition: CbcModel.hpp:1797
Abstract cut modifier base class.
double getObjValue() const
Get best objective function value.
Definition: CbcModel.hpp:1270
bool isLocked() const
From here to end of section - code in CbcThread.cpp until class changed Returns true if locked...
Information required to recreate the subproblem at this node.
Definition: CbcNodeInfo.hpp:68
void setBestSolution(CBC_Message how, double &objectiveValue, const double *solution, int fixVariables=0)
Record a new incumbent solution and update objectiveValue.
void setParentModel(CbcModel &parentModel)
Set the parent model.
Definition: CbcModel.hpp:1596
bool isContinuousUnbounded() const
Was continuous solution unbounded.
int getNodeCount() const
Get how many Nodes it took to solve the problem (including those in complete fathoming B&B inside CLP...
Definition: CbcModel.hpp:915
void zapIntegerInformation(bool leaveObjects=true)
Zap integer information in problem (may leave object info)
void setPenaltyScaleFactor(double value)
Set scale factor to make penalties match strong.
Information required to recreate the subproblem at this node.
void setSecondaryStatus(int value)
Definition: CbcModel.hpp:956
void setMaximumNumberIterations(int value)
Set maximum number of iterations (designed to be used in heuristics)
Definition: CbcModel.hpp:2275
Base model.
Definition: CbcThread.hpp:437
void doHeuristicsAtRoot(int deleteHeuristicsAfterwards=0)
Do heuristics at root.
void setContinuousObjective(double value)
Definition: CbcModel.hpp:1361
void analyzeObjective()
Analyze problem to find a minimum change in the objective function.
int numberPenalties() const
get the number of variables for which to compute penalties in dynamic strong branching.
Definition: CbcModel.hpp:816
void setProblemStatus(int value)
Definition: CbcModel.hpp:938
int numberStrongIterations() const
Get the number of iterations done in strong branching.
Definition: CbcModel.hpp:2267
CbcAction
Action codes returned by the event handler.
Largest non-zero change on a branch.
Definition: CbcModel.hpp:189
int specialOptions() const
Get special options.
Definition: CbcModel.hpp:1777
const double * getCbcColLower() const
Get pointer to array[getNumCols()] (for speed) of column lower bounds.
Definition: CbcModel.hpp:1133
int getSolutionCount() const
Get number of solutions.
Definition: CbcModel.hpp:1307
bool useElapsedTime() const
Get time method.
Definition: CbcModel.hpp:1852
static bool haveMultiThreadSupport()
Indicates whether Cbc library has been compiled with multithreading support.
int CbcMain1(int argc, const char *argv[], CbcModel &babSolver)
void createContinuousSolver()
Create solver with continuous state.
Definition: CbcModel.hpp:1946
void setTestSolution(const double *solution)
Definition: CbcModel.hpp:1225
char integerType(int i) const
Whether or not integer.
Definition: CbcModel.hpp:1012
CbcTree * tree() const
Tree method e.g. heap (which may be overridden by inheritance)
Definition: CbcModel.hpp:1441
int numberSavedSolutions() const
Number of saved solutions (including best)
double penaltyScaleFactor() const
Get scale factor to make penalties match strong.
Definition: CbcModel.hpp:831
double getCutoff() const
Get the cutoff bound on the objective function - always as minimize.
Definition: CbcModel.hpp:554
double getMinimizationObjValue() const
Get best objective function value as minimization.
Definition: CbcModel.hpp:1261
void synchronizeNumberBeforeTrust(int type=0)
Set numberBeforeTrust in all objects.
const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
Definition: CbcModel.hpp:1023
void setNumberHeuristics(int value)
Set the number of heuristics.
Definition: CbcModel.hpp:1619
Small non-zero change on a branch to be used as guess.
Definition: CbcModel.hpp:191
int numberAnalyzeIterations() const
Definition: CbcModel.hpp:826
bool setAllowableGap(double value)
Set the allowable gap between the best known solution and the best possible solution.
Definition: CbcModel.hpp:645
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:748
void setMinimumDrop(double value)
Set the minimum drop to continue cuts.
Definition: CbcModel.hpp:728
int getIntParam(CbcIntParam key) const
Get an integer parameter.
Definition: CbcModel.hpp:539
void passInMessageHandler(CoinMessageHandler *handler)
Pass in Message handler (not deleted at end)
double getInfeasibilityWeight() const
Get the weight per integer infeasibility .
Definition: CbcModel.hpp:638
void addUpdateInformation(const CbcObjectUpdateData &data)
Adds an update information object.
int maximumNumberIterations() const
Get maximum number of iterations (designed to be used in heuristics)
Definition: CbcModel.hpp:2271
CbcCutGenerator * virginCutGenerator(int i) const
Get the specified cut generator before any changes.
Definition: CbcModel.hpp:1558
void resetModel()
Clears out enough to reset CbcModel cutoff etc.
void goToDantzig(int numberNodes, ClpDualRowPivot *&savePivotMethod)
Go to dantzig pivot selection if easy problem (clp only)
int problemType() const
Definition: CbcModel.hpp:847
OsiBranchingInformation usefulInformation() const
Generate an OsiBranchingInformation object.
void getIntegerInformation(const OsiObject *object, double &originalLower, double &originalUpper)
So we can use osiObject or CbcObject during transition.
void setTemporaryPointer(void *pointer)
Set useful temporary pointer.
Definition: CbcModel.hpp:1859
bool setIntParam(CbcIntParam key, int value)
Set an integer parameter.
Definition: CbcModel.hpp:529
void setMultipleRootTries(int value)
Set multiple root tries.
Definition: CbcModel.hpp:1789
void fillPseudoCosts(double *downCosts, double *upCosts, int *priority=NULL, int *numberDown=NULL, int *numberUp=NULL, int *numberDownInfeasible=NULL, int *numberUpInfeasible=NULL) const
Return pseudo costs If not all integers or not pseudo costs - returns all zero Length of arrays are n...
CglTreeProbingInfo * probingInfo() const
Get a pointer to probing info.
Definition: CbcModel.hpp:2255
int numberExtraIterations() const
Number of extra iterations.
Definition: CbcModel.hpp:2299
void makeGlobalCut(const OsiRowCut *cut)
Make given cut into a global cut.
void AddIntegers()
Add additional integers.
int maximumSavedSolutions() const
Maximum number of extra saved solutions.
Definition: CbcModel.hpp:1318
const OsiBabSolver * solverCharacteristics() const
Get solver characteristics.
Definition: CbcModel.hpp:1696
CbcStrategy * strategy() const
Get the current strategy.
Definition: CbcModel.hpp:1582
int getMaximumSolutions() const
Get the maximum number of solutions desired.
Definition: CbcModel.hpp:581
void setContinuousInfeasibilities(int value)
Definition: CbcModel.hpp:1368
int reducedCostFix()
Perform reduced cost fixing.
bool setMaximumSeconds(double value)
Set the maximum number of seconds desired.
Definition: CbcModel.hpp:598
Interface between Cbc and Cut Generation Library.
void deleteSavedSolution(int which)
Delete a saved solution and move others up.
void setObjectiveValue(CbcNode *thisNode, const CbcNode *parentNode) const
Set objective value in a node.
void setTypePresolve(int value)
Definition: CbcModel.hpp:1471
void deleteObjects(bool findIntegers=true)
Delete all object information (and just back to integers if true)
double getMaximumSeconds() const
Get the maximum number of seconds desired.
Definition: CbcModel.hpp:605
bool setCutoffIncrement(double value)
Set the CbcModel::CbcCutoffIncrement desired.
Definition: CbcModel.hpp:708
bool setHeuristicGap(double value)
Set the heuristic gap between the best known solution and the best possible solution.
Definition: CbcModel.hpp:682
CbcModel * findCliques(bool makeEquality, int atLeastThisMany, int lessThanThis, int defaultValue=1000)
Identify cliques and construct corresponding objects.
double getHeuristicFractionGap() const
Get the fraction heuristic gap between the best known solution and the best possible solution...
Definition: CbcModel.hpp:701
The maximum amount the value of an integer variable can vary from integer and still be considered fea...
Definition: CbcModel.hpp:133
void addCutGenerator(CglCutGenerator *generator, int howOften=1, const char *name=NULL, bool normal=true, bool atSolution=false, bool infeasible=false, int howOftenInSub=-100, int whatDepth=-1, int whatDepthInSub=-1)
Add one generator - up to user to delete generators.
Stop when the gap between the objective value of the best known solution and the best bound on the ob...
Definition: CbcModel.hpp:146
void addHeuristic(CbcHeuristic *generator, const char *name=NULL, int before=-1)
Add one heuristic - up to user to delete.
void assignSolver(OsiSolverInterface *&solver, bool deleteSolver=true)
Assign a solver to the model (model assumes ownership)
OsiSolverInterface * swapSolver(OsiSolverInterface *solver)
Returns current solver - sets new one.
Definition: CbcModel.hpp:1934
bool waitingForMiniBranchAndBound() const
Says if model is sitting there waiting for mini branch and bound to finish This is because an event h...
Definition: CbcModel.hpp:1807
double getDblParam(CbcDblParam key) const
Get a double parameter.
Definition: CbcModel.hpp:543
OsiObject * modifiableObject(int which) const
Get the specified object.
Definition: CbcModel.hpp:480
const double * getCbcRowPrice() const
Get pointer to array[getNumRows()] (for speed) of dual prices.
Definition: CbcModel.hpp:1153
void setPreferredWay(int value)
Set global preferred way to branch -1 down, +1 up, 0 no preference.
Definition: CbcModel.hpp:775
double getBestPossibleObjValue() const
Get best possible objective function value.
const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
Definition: CbcModel.hpp:1070
void gutsOfDestructor()
Clears out as much as possible (except solver)
const int * strongInfo() const
Return strong info.
Definition: CbcModel.hpp:2306
Simple Branch and bound class.
Definition: CbcModel.hpp:100
void saveExtraSolution(const double *solution, double objectiveValue)
Save a solution to saved list.
OsiSolverInterface * referenceSolver() const
A copy of the solver, taken at constructor or by saveReferenceSolver.
Definition: CbcModel.hpp:1956
void * temporaryPointer() const
Get useful temporary pointer.
Definition: CbcModel.hpp:1856
void findIntegers(bool startAgain, int type=0)
Identify integer variables and create corresponding objects.
bool resolveAfterTakeOffCuts() const
Whether to force a resolve after takeOffCuts.
Definition: CbcModel.hpp:1388
void setStopNumberIterations(int value)
Set number of "iterations" to stop after.
Definition: CbcModel.hpp:1407
void setCutModifier(CbcCutModifier *modifier)
Set the cut modifier method.
void setSpecialOptions(int value)
Set special options 0 bit (1) - check if cuts valid (if on debugger list) 1 bit (2) - use current bas...
Definition: CbcModel.hpp:1773
CbcFeasibilityBase * problemFeasibility() const
Definition: CbcModel.hpp:1431
void saveModel(OsiSolverInterface *saveSolver, double *checkCutoffForRestart, bool *feasible)
Save copy of the model.
const double * getCbcRowActivity() const
Get pointer to array[getNumRows()] (for speed) of row activity levels.
Definition: CbcModel.hpp:1161
void setNextRowCut(const OsiRowCut &cut)
Copy and set a pointer to a row cut which will be added instead of normal branching.
CbcCutGenerator * cutGenerator(int i) const
Get the specified cut generator.
Definition: CbcModel.hpp:1554
void originalModel(CbcModel *presolvedModel, bool weak)
Put back information into the original model after integer presolve.
Strategy base class.
Definition: CbcStrategy.hpp:18
void pseudoShadow(int type)
Fill in useful estimates.
bool doCutsNow(int allowForTopOfTree) const
Return true if we want to do cuts If allowForTopOfTree zero then just does on multiples of depth if 1...
void passInSubTreeModel(CbcModel &model)
For passing in an CbcModel to do a sub Tree (with derived tree handlers).
bool isInitialSolveProvenDualInfeasible() const
Is dual infeasiblity proven (for initialSolve) ?
virtual ~CbcModel()
Destructor.
A class to encapsulate thread stuff.
Definition: CbcThread.hpp:426
void mergeModels(int numberModel, CbcModel **model, int numberNodes)
Merge models.
const int * hotstartPriorities() const
Get the hotstart priorities.
Definition: CbcModel.hpp:2232
void adjustHeuristics()
Adjust heuristics based on model.
double sumChangeObjective() const
Sum of Changes to objective by first solve.
Definition: CbcModel.hpp:1376
const int * integerVariable() const
Definition: CbcModel.hpp:1008
void moveInfo(const CbcModel &rhs)
Move status, nodes etc etc across.
int priority(int sequence) const
Returns priority level for an object (or 1000 if no priorities exist)
Definition: CbcModel.hpp:1652