Cbc  2.9.8
CbcModel.hpp
Go to the documentation of this file.
1 /* $Id: CbcModel.hpp 2206 2015-07-07 20:44:40Z stefan $ */
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 CbcSymmetry;
37 class CbcFeasibilityBase;
38 class CbcStatistics;
39 class CbcFullNodeInfo;
40 class CbcEventHandler ;
41 class CglPreProcess;
42 class OsiClpSolverInterface;
43 class ClpNodeStuff;
44 
45 // #define CBC_CHECK_BASIS 1
46 
47 //#############################################################################
48 
101 class CbcModel {
102 
103 public:
104 
105  enum CbcIntParam {
129  };
130 
131  enum CbcDblParam {
195  };
196 
197  //---------------------------------------------------------------------------
198 
199 public:
201 
202 
206  void initialSolve();
207 
218  void branchAndBound(int doStatistics = 0);
219 private:
220 
228  bool solveWithCuts(OsiCuts & cuts, int numberTries, CbcNode * node);
236  int serialCuts(OsiCuts & cuts, CbcNode * node, OsiCuts & slackCuts, int lastNumberCuts);
244  int parallelCuts(CbcBaseModel * master, OsiCuts & cuts, CbcNode * node, OsiCuts & slackCuts, int lastNumberCuts);
251  CbcNode ** solveOneNode(int whichSolver, CbcNode * node,
252  int & numberNodesOutput, int & status) ;
254  void resizeWhichGenerator(int numberNow, int numberAfter);
255 public:
256 #ifdef CBC_KEEP_DEPRECATED
257  // See if anyone is using these any more!!
262  CbcModel * cleanModel(const double * lower, const double * upper);
279  int subBranchAndBound(CbcModel * model2,
280  CbcModel * presolvedModel,
281  int maximumNodes);
297  int subBranchAndBound(const double * lower, const double * upper,
298  int maximumNodes);
299 
306  OsiSolverInterface * strengthenedModel();
316  CglPreProcess * preProcess( int makeEquality = 0, int numberPasses = 5,
317  int tuning = 5);
320  void postProcess(CglPreProcess * process);
321 #endif
322  void addUpdateInformation(const CbcObjectUpdateData & data);
330  int doOneNode(CbcModel * baseModel, CbcNode * & node, CbcNode * & newNode);
331 
332 public:
346  int resolve(CbcNodeInfo * parent, int whereFrom,
347  double * saveSolution = NULL,
348  double * saveLower = NULL,
349  double * saveUpper = NULL);
351  void makeGlobalCuts(int numberRows, const int * which);
353  int makeGlobalCut(const OsiRowCut * cut);
355  int makeGlobalCut(const OsiRowCut & cut);
357  void makeGlobalCut(const OsiColCut * cut);
359  void makeGlobalCut(const OsiColCut & cut);
361  void makePartialCut(const OsiRowCut * cut, const OsiSolverInterface * solver=NULL);
363  void makeGlobalCuts();
365  inline const int * whichGenerator() const
366  { return whichGenerator_;}
368 
371 
383  CbcModel * findCliques(bool makeEquality, int atLeastThisMany,
384  int lessThanThis, int defaultValue = 1000);
385 
394  CbcModel * integerPresolve(bool weak = false);
395 
400  bool integerPresolveThisModel(OsiSolverInterface * originalSolver, bool weak = false);
401 
402 
404  void originalModel(CbcModel * presolvedModel, bool weak);
405 
426  bool tightenVubs(int type, bool allowMultipleBinary = false,
427  double useCutoff = 1.0e50);
428 
434  bool tightenVubs(int numberVubs, const int * which,
435  double useCutoff = 1.0e50);
439  void analyzeObjective();
440 
444  void AddIntegers();
448  void saveModel(OsiSolverInterface * saveSolver, double * checkCutoffForRestart, bool * feasible);
452  void flipModel();
453 
455 
461 
463  inline int numberObjects() const {
464  return numberObjects_;
465  }
467  inline void setNumberObjects(int number) {
468  numberObjects_ = number;
469  }
470 
472  inline OsiObject ** objects() const {
473  return object_;
474  }
475 
477  const inline OsiObject * object(int which) const {
478  return object_[which];
479  }
481  inline OsiObject * modifiableObject(int which) const {
482  return object_[which];
483  }
484 
485  void setOptionalInteger(int index);
486 
488  void deleteObjects(bool findIntegers = true);
489 
494  void addObjects(int numberObjects, OsiObject ** objects);
495 
500  void addObjects(int numberObjects, CbcObject ** objects);
501 
503  void synchronizeModel() ;
504 
514  void findIntegers(bool startAgain, int type = 0);
515 
516 #ifdef SWITCH_VARIABLES
517  int findSwitching();
520  int fixAssociated(OsiSolverInterface * solver,int cleanBasis);
522  int checkAssociated(const OsiSolverInterface * solver,
523  const double * solution, int printLevel);
524 #endif
525 
526 
527  //---------------------------------------------------------------------------
528 
538  inline bool setIntParam(CbcIntParam key, int value) {
540  intParam_[key] = value;
541  return true;
542  }
544  inline bool setDblParam(CbcDblParam key, double value) {
545  dblParam_[key] = value;
546  return true;
547  }
549  inline int getIntParam(CbcIntParam key) const {
550  return intParam_[key];
551  }
553  inline double getDblParam(CbcDblParam key) const {
554  return dblParam_[key];
555  }
561  void setCutoff(double value) ;
562 
564  inline double getCutoff() const { //double value ;
565  //solver_->getDblParam(OsiDualObjectiveLimit,value) ;
566  //assert( dblParam_[CbcCurrentCutoff]== value * solver_->getObjSense());
567  return dblParam_[CbcCurrentCutoff];
568  }
569 
571  inline bool setMaximumNodes( int value) {
572  return setIntParam(CbcMaxNumNode, value);
573  }
574 
576  inline int getMaximumNodes() const {
577  return getIntParam(CbcMaxNumNode);
578  }
579 
584  inline bool setMaximumSolutions( int value) {
585  return setIntParam(CbcMaxNumSol, value);
586  }
591  inline int getMaximumSolutions() const {
592  return getIntParam(CbcMaxNumSol);
593  }
595  inline bool setPrintingMode( int value) {
596  return setIntParam(CbcPrinting, value);
597  }
598 
600  inline int getPrintingMode() const {
601  return getIntParam(CbcPrinting);
602  }
603 
608  inline bool setMaximumSeconds( double value) {
609  return setDblParam(CbcMaximumSeconds, value);
610  }
615  inline double getMaximumSeconds() const {
617  }
619  double getCurrentSeconds() const ;
620 
622  bool maximumSecondsReached() const ;
623 
627  inline bool setIntegerTolerance( double value) {
628  return setDblParam(CbcIntegerTolerance, value);
629  }
633  inline double getIntegerTolerance() const {
635  }
636 
641  inline bool setInfeasibilityWeight( double value) {
642  return setDblParam(CbcInfeasibilityWeight, value);
643  }
648  inline double getInfeasibilityWeight() const {
650  }
651 
655  inline bool setAllowableGap( double value) {
656  return setDblParam(CbcAllowableGap, value);
657  }
661  inline double getAllowableGap() const {
663  }
664 
668  inline bool setAllowableFractionGap( double value) {
669  return setDblParam(CbcAllowableFractionGap, value);
670  }
674  inline double getAllowableFractionGap() const {
676  }
680  inline bool setAllowablePercentageGap( double value) {
681  return setDblParam(CbcAllowableFractionGap, value*0.01);
682  }
686  inline double getAllowablePercentageGap() const {
687  return 100.0*getDblParam(CbcAllowableFractionGap);
688  }
692  inline bool setHeuristicGap( double value) {
693  return setDblParam(CbcHeuristicGap, value);
694  }
698  inline double getHeuristicGap() const {
700  }
701 
705  inline bool setHeuristicFractionGap( double value) {
706  return setDblParam(CbcHeuristicFractionGap, value);
707  }
711  inline double getHeuristicFractionGap() const {
713  }
718  inline bool setCutoffIncrement( double value) {
719  return setDblParam(CbcCutoffIncrement, value);
720  }
725  inline double getCutoffIncrement() const {
727  }
729  bool canStopOnGap() const;
730 
735  void setHotstartSolution(const double * solution, const int * priorities = NULL) ;
736 
738  inline void setMinimumDrop(double value) {
739  minimumDrop_ = value;
740  }
742  inline double getMinimumDrop() const {
743  return minimumDrop_;
744  }
745 
748  inline void setMaximumCutPassesAtRoot(int value) {
749  maximumCutPassesAtRoot_ = value;
750  }
752  inline int getMaximumCutPassesAtRoot() const {
753  return maximumCutPassesAtRoot_;
754  }
755 
758  inline void setMaximumCutPasses(int value) {
759  maximumCutPasses_ = value;
760  }
762  inline int getMaximumCutPasses() const {
763  return maximumCutPasses_;
764  }
767  inline int getCurrentPassNumber() const {
768  return currentPassNumber_;
769  }
772  inline void setCurrentPassNumber(int value) {
773  currentPassNumber_ = value;
774  }
775 
781  void setNumberStrong(int number);
785  inline int numberStrong() const {
786  return numberStrong_;
787  }
790  inline void setPreferredWay(int value) {
791  preferredWay_ = value;
792  }
794  inline int getPreferredWay() const {
795  return preferredWay_;
796  }
798  inline int whenCuts() const {
799  return whenCuts_;
800  }
802  inline void setWhenCuts(int value) {
803  whenCuts_ = value;
804  }
810  bool doCutsNow(int allowForTopOfTree) const;
811 
817  void setNumberBeforeTrust(int number);
820  inline int numberBeforeTrust() const {
821  return numberBeforeTrust_;
822  }
828  void setNumberPenalties(int number);
831  inline int numberPenalties() const {
832  return numberPenalties_;
833  }
835  inline const CbcFullNodeInfo * topOfTree() const
836  { return topOfTree_;}
838  inline void setNumberAnalyzeIterations(int number) {
839  numberAnalyzeIterations_ = number;
840  }
841  inline int numberAnalyzeIterations() const {
842  return numberAnalyzeIterations_;
843  }
846  inline double penaltyScaleFactor() const {
847  return penaltyScaleFactor_;
848  }
851  void setPenaltyScaleFactor(double value);
859  void inline setProblemType(int number) {
860  problemType_ = number;
861  }
862  inline int problemType() const {
863  return problemType_;
864  }
866  inline int currentDepth() const {
867  return currentDepth_;
868  }
869 
871  void setHowOftenGlobalScan(int number);
873  inline int howOftenGlobalScan() const {
874  return howOftenGlobalScan_;
875  }
877  inline int * originalColumns() const {
878  return originalColumns_;
879  }
881  void setOriginalColumns(const int * originalColumns,
882  int numberGood=COIN_INT_MAX) ;
884  OsiRowCut * conflictCut(const OsiSolverInterface * solver, bool & localCuts);
885 
893  inline void setPrintFrequency(int number) {
894  printFrequency_ = number;
895  }
897  inline int printFrequency() const {
898  return printFrequency_;
899  }
901 
902  //---------------------------------------------------------------------------
904 
905  bool isAbandoned() const;
908  bool isProvenOptimal() const;
910  bool isProvenInfeasible() const;
912  bool isContinuousUnbounded() const;
914  bool isProvenDualInfeasible() const;
916  bool isNodeLimitReached() const;
918  bool isSecondsLimitReached() const;
920  bool isSolutionLimitReached() const;
922  inline int getIterationCount() const {
923  return numberIterations_;
924  }
926  inline void incrementIterationCount(int value) {
927  numberIterations_ += value;
928  }
930  inline int getNodeCount() const {
931  return numberNodes_;
932  }
934  inline void incrementNodeCount(int value) {
935  numberNodes_ += value;
936  }
938  inline int getExtraNodeCount() const {
939  return numberExtraNodes_;
940  }
942  inline int getFathomCount() const {
943  return numberFathoms_;
944  }
954  inline int status() const {
955  return status_;
956  }
957  inline void setProblemStatus(int value) {
958  status_ = value;
959  }
972  inline int secondaryStatus() const {
973  return secondaryStatus_;
974  }
975  inline void setSecondaryStatus(int value) {
976  secondaryStatus_ = value;
977  }
979  bool isInitialSolveAbandoned() const ;
981  bool isInitialSolveProvenOptimal() const ;
986 
988 
989  //---------------------------------------------------------------------------
1002  inline int numberRowsAtContinuous() const {
1004  return numberRowsAtContinuous_;
1005  }
1006 
1008  inline int getNumCols() const {
1009  return solver_->getNumCols();
1010  }
1011 
1013  inline int getNumRows() const {
1014  return solver_->getNumRows();
1015  }
1016 
1018  inline CoinBigIndex getNumElements() const {
1019  return solver_->getNumElements();
1020  }
1021 
1023  inline int numberIntegers() const {
1024  return numberIntegers_;
1025  }
1026  // Integer variables
1027  inline const int * integerVariable() const {
1028  return integerVariable_;
1029  }
1031  inline char integerType(int i) const {
1032  assert (integerInfo_);
1033  assert (integerInfo_[i] == 0 || integerInfo_[i] == 1);
1034  return integerInfo_[i];
1035  }
1037  inline const char * integerType() const {
1038  return integerInfo_;
1039  }
1040 
1042  inline const double * getColLower() const {
1043  return solver_->getColLower();
1044  }
1045 
1047  inline const double * getColUpper() const {
1048  return solver_->getColUpper();
1049  }
1050 
1060  inline const char * getRowSense() const {
1061  return solver_->getRowSense();
1062  }
1063 
1072  inline const double * getRightHandSide() const {
1073  return solver_->getRightHandSide();
1074  }
1075 
1084  inline const double * getRowRange() const {
1085  return solver_->getRowRange();
1086  }
1087 
1089  inline const double * getRowLower() const {
1090  return solver_->getRowLower();
1091  }
1092 
1094  inline const double * getRowUpper() const {
1095  return solver_->getRowUpper();
1096  }
1097 
1099  inline const double * getObjCoefficients() const {
1100  return solver_->getObjCoefficients();
1101  }
1102 
1104  inline double getObjSense() const {
1105  //assert (dblParam_[CbcOptimizationDirection]== solver_->getObjSense());
1106  return dblParam_[CbcOptimizationDirection];
1107  }
1108 
1110  inline bool isContinuous(int colIndex) const {
1111  return solver_->isContinuous(colIndex);
1112  }
1113 
1115  inline bool isBinary(int colIndex) const {
1116  return solver_->isBinary(colIndex);
1117  }
1118 
1123  inline bool isInteger(int colIndex) const {
1124  return solver_->isInteger(colIndex);
1125  }
1126 
1128  inline bool isIntegerNonBinary(int colIndex) const {
1129  return solver_->isIntegerNonBinary(colIndex);
1130  }
1131 
1133  inline bool isFreeBinary(int colIndex) const {
1134  return solver_->isFreeBinary(colIndex) ;
1135  }
1136 
1138  inline const CoinPackedMatrix * getMatrixByRow() const {
1139  return solver_->getMatrixByRow();
1140  }
1141 
1143  inline const CoinPackedMatrix * getMatrixByCol() const {
1144  return solver_->getMatrixByCol();
1145  }
1146 
1148  inline double getInfinity() const {
1149  return solver_->getInfinity();
1150  }
1152  inline const double * getCbcColLower() const {
1153  return cbcColLower_;
1154  }
1156  inline const double * getCbcColUpper() const {
1157  return cbcColUpper_;
1158  }
1160  inline const double * getCbcRowLower() const {
1161  return cbcRowLower_;
1162  }
1164  inline const double * getCbcRowUpper() const {
1165  return cbcRowUpper_;
1166  }
1168  inline const double * getCbcColSolution() const {
1169  return cbcColSolution_;
1170  }
1172  inline const double * getCbcRowPrice() const {
1173  return cbcRowPrice_;
1174  }
1176  inline const double * getCbcReducedCost() const {
1177  return cbcReducedCost_;
1178  }
1180  inline const double * getCbcRowActivity() const {
1181  return cbcRowActivity_;
1182  }
1184 
1185 
1188  inline double * continuousSolution() const {
1190  return continuousSolution_;
1191  }
1196  inline int * usedInSolution() const {
1197  return usedInSolution_;
1198  }
1200  void incrementUsed(const double * solution);
1202  void setBestSolution(CBC_Message how,
1203  double & objectiveValue, const double *solution,
1204  int fixVariables = 0);
1206  void setBestObjectiveValue( double objectiveValue);
1209  double objValue,
1210  const double * solution);
1211 
1219  virtual double checkSolution(double cutoff, double * solution,
1220  int fixVariables, double originalObjValue);
1227  bool feasibleSolution(int & numberIntegerInfeasibilities,
1228  int & numberObjectInfeasibilities) const;
1229 
1235  inline double * currentSolution() const {
1236  return currentSolution_;
1237  }
1241  inline const double * testSolution() const {
1242  return testSolution_;
1243  }
1244  inline void setTestSolution(const double * solution) {
1245  testSolution_ = solution;
1246  }
1248  void reserveCurrentSolution(const double * solution = NULL);
1249 
1251  inline const double * getColSolution() const {
1252  return solver_->getColSolution();
1253  }
1254 
1256  inline const double * getRowPrice() const {
1257  return solver_->getRowPrice();
1258  }
1259 
1261  inline const double * getReducedCost() const {
1262  return solver_->getReducedCost();
1263  }
1264 
1266  inline const double * getRowActivity() const {
1267  return solver_->getRowActivity();
1268  }
1269 
1271  inline double getCurrentObjValue() const {
1272  return dblParam_[CbcCurrentObjectiveValue];
1273  }
1275  inline double getCurrentMinimizationObjValue() const {
1276  return dblParam_[CbcCurrentMinimizationObjectiveValue];
1277  }
1278 
1280  inline double getMinimizationObjValue() const {
1281  return bestObjective_;
1282  }
1284  inline void setMinimizationObjValue(double value) {
1285  bestObjective_ = value;
1286  }
1287 
1289  inline double getObjValue() const {
1290  return bestObjective_ * solver_->getObjSense() ;
1291  }
1297  double getBestPossibleObjValue() const;
1299  inline void setObjValue(double value) {
1300  bestObjective_ = value * solver_->getObjSense() ;
1301  }
1303  inline double getSolverObjValue() const {
1304  return solver_->getObjValue() * solver_->getObjSense() ;
1305  }
1306 
1313  inline double * bestSolution() const {
1314  return bestSolution_;
1315  }
1322  void setBestSolution(const double * solution, int numberColumns,
1323  double objectiveValue, bool check = false);
1324 
1326  inline int getSolutionCount() const {
1327  return numberSolutions_;
1328  }
1329 
1331  inline void setSolutionCount(int value) {
1332  numberSolutions_ = value;
1333  }
1335  int numberSavedSolutions() const;
1337  inline int maximumSavedSolutions() const {
1338  return maximumSavedSolutions_;
1339  }
1341  void setMaximumSavedSolutions(int value);
1343  const double * savedSolution(int which) const;
1345  double savedSolutionObjective(int which) const;
1347  void deleteSavedSolution(int which);
1348 
1357  inline int phase() const {
1358  return phase_;
1359  }
1360 
1362  inline int getNumberHeuristicSolutions() const {
1363  return numberHeuristicSolutions_;
1364  }
1366  inline void setNumberHeuristicSolutions(int value) {
1367  numberHeuristicSolutions_ = value;
1368  }
1369 
1371  inline void setObjSense(double s) {
1372  dblParam_[CbcOptimizationDirection] = s;
1373  solver_->setObjSense(s);
1374  }
1375 
1377  inline double getContinuousObjective() const {
1378  return originalContinuousObjective_;
1379  }
1380  inline void setContinuousObjective(double value) {
1381  originalContinuousObjective_ = value;
1382  }
1384  inline int getContinuousInfeasibilities() const {
1385  return continuousInfeasibilities_;
1386  }
1387  inline void setContinuousInfeasibilities(int value) {
1388  continuousInfeasibilities_ = value;
1389  }
1391  inline double rootObjectiveAfterCuts() const {
1392  return continuousObjective_;
1393  }
1395  inline double sumChangeObjective() const {
1396  return sumChangeObjective1_;
1397  }
1400  inline int numberGlobalViolations() const {
1401  return numberGlobalViolations_;
1402  }
1404  numberGlobalViolations_ = 0;
1405  }
1407  inline bool resolveAfterTakeOffCuts() const {
1408  return resolveAfterTakeOffCuts_;
1409  }
1410  inline void setResolveAfterTakeOffCuts(bool yesNo) {
1411  resolveAfterTakeOffCuts_ = yesNo;
1412  }
1414  inline int maximumRows() const {
1415  return maximumRows_;
1416  }
1418  inline CoinWarmStartBasis & workingBasis() {
1419  return workingBasis_;
1420  }
1422  inline int getStopNumberIterations() const {
1423  return stopNumberIterations_;
1424  }
1426  inline void setStopNumberIterations(int value) {
1427  stopNumberIterations_ = value;
1428  }
1430  inline CbcModel * heuristicModel() const
1431  { return heuristicModel_;}
1433  inline void setHeuristicModel(CbcModel * model)
1434  { heuristicModel_ = model;}
1436 
1439  // Comparison functions (which may be overridden by inheritance)
1440  inline CbcCompareBase * nodeComparison() const {
1441  return nodeCompare_;
1442  }
1443  void setNodeComparison(CbcCompareBase * compare);
1444  void setNodeComparison(CbcCompareBase & compare);
1446 
1449  // Feasibility functions (which may be overridden by inheritance)
1451  return problemFeasibility_;
1452  }
1453  void setProblemFeasibility(CbcFeasibilityBase * feasibility);
1454  void setProblemFeasibility(CbcFeasibilityBase & feasibility);
1456 
1459  inline CbcTree * tree() const {
1461  return tree_;
1462  }
1464  void passInTreeHandler(CbcTree & tree);
1468  void passInSubTreeModel(CbcModel & model);
1473  CbcModel * subTreeModel(OsiSolverInterface * solver = NULL) const;
1475  inline int numberStoppedSubTrees() const {
1476  return numberStoppedSubTrees_;
1477  }
1479  inline void incrementSubTreeStopped() {
1480  numberStoppedSubTrees_++;
1481  }
1487  inline int typePresolve() const {
1488  return presolve_;
1489  }
1490  inline void setTypePresolve(int value) {
1491  presolve_ = value;
1492  }
1493 
1495 
1501 
1504  return branchingMethod_;
1505  }
1507  inline void setBranchingMethod(CbcBranchDecision * method) {
1508  delete branchingMethod_;
1509  branchingMethod_ = method->clone();
1510  }
1515  inline void setBranchingMethod(CbcBranchDecision & method) {
1516  delete branchingMethod_;
1517  branchingMethod_ = method.clone();
1518  }
1520  inline CbcCutModifier * cutModifier() const {
1521  return cutModifier_;
1522  }
1524  void setCutModifier(CbcCutModifier * modifier);
1529  void setCutModifier(CbcCutModifier & modifier);
1531 
1534 
1541  inline int stateOfSearch() const {
1542  return stateOfSearch_;
1543  }
1544  inline void setStateOfSearch(int state) {
1545  stateOfSearch_ = state;
1546  }
1548  inline int searchStrategy() const {
1549  return searchStrategy_;
1550  }
1552  inline void setSearchStrategy(int value) {
1553  searchStrategy_ = value;
1554  }
1556  inline int strongStrategy() const {
1557  return strongStrategy_;
1558  }
1560  inline void setStrongStrategy(int value) {
1561  strongStrategy_ = value;
1562  }
1563 
1565  inline int numberCutGenerators() const {
1566  return numberCutGenerators_;
1567  }
1569  inline CbcCutGenerator ** cutGenerators() const {
1570  return generator_;
1571  }
1573  inline CbcCutGenerator * cutGenerator(int i) const {
1574  return generator_[i];
1575  }
1577  inline CbcCutGenerator * virginCutGenerator(int i) const {
1578  return virginGenerator_[i];
1579  }
1588  void addCutGenerator(CglCutGenerator * generator,
1589  int howOften = 1, const char * name = NULL,
1590  bool normal = true, bool atSolution = false,
1591  bool infeasible = false, int howOftenInSub = -100,
1592  int whatDepth = -1, int whatDepthInSub = -1);
1594 
1599 
1601  inline CbcStrategy * strategy() const {
1602  return strategy_;
1603  }
1607  inline void setStrategy(CbcStrategy * strategy) {
1608  strategy_ = strategy;
1609  }
1611  inline CbcModel * parentModel() const {
1612  return parentModel_;
1613  }
1616  parentModel_ = &parentModel;
1617  }
1619 
1620 
1627  void addHeuristic(CbcHeuristic * generator, const char *name = NULL,
1628  int before = -1);
1630  inline CbcHeuristic * heuristic(int i) const {
1631  return heuristic_[i];
1632  }
1634  inline int numberHeuristics() const {
1635  return numberHeuristics_;
1636  }
1638  inline void setNumberHeuristics(int value) {
1639  numberHeuristics_ = value;
1640  }
1642  inline CbcHeuristic * lastHeuristic() const {
1643  return lastHeuristic_;
1644  }
1646  inline void setLastHeuristic(CbcHeuristic * last) {
1647  lastHeuristic_ = last;
1648  }
1649 
1668  void passInPriorities(const int * priorities, bool ifNotSimpleIntegers);
1669 
1671  inline int priority(int sequence) const {
1672  return object_[sequence]->priority();
1673  }
1674 
1679  void passInEventHandler(const CbcEventHandler *eventHandler) ;
1680 
1683  return (eventHandler_) ;
1684  }
1685 
1687 
1697  void setApplicationData (void * appData);
1698 
1700  void * getApplicationData() const;
1715  inline const OsiBabSolver * solverCharacteristics() const {
1716  return solverCharacteristics_;
1717  }
1719 
1720  //---------------------------------------------------------------------------
1721 
1724  void passInMessageHandler(CoinMessageHandler * handler);
1727  void newLanguage(CoinMessages::Language language);
1728  inline void setLanguage(CoinMessages::Language language) {
1729  newLanguage(language);
1730  }
1732  inline CoinMessageHandler * messageHandler() const {
1733  return handler_;
1734  }
1736  inline CoinMessages & messages() {
1737  return messages_;
1738  }
1740  inline CoinMessages * messagesPointer() {
1741  return &messages_;
1742  }
1744  void setLogLevel(int value);
1746  inline int logLevel() const {
1747  return handler_->logLevel();
1748  }
1754  inline void setDefaultHandler(bool yesNo) {
1755  defaultHandler_ = yesNo;
1756  }
1758  inline bool defaultHandler() const {
1759  return defaultHandler_;
1760  }
1762  //---------------------------------------------------------------------------
1764 
1765 
1793  inline void setSpecialOptions(int value) {
1794  specialOptions_ = value;
1795  }
1797  inline int specialOptions() const {
1798  return specialOptions_;
1799  }
1801  inline void setRandomSeed(int value) {
1802  randomSeed_ = value;
1803  }
1805  inline int getRandomSeed() const {
1806  return randomSeed_;
1807  }
1809  inline void setMultipleRootTries(int value) {
1810  multipleRootTries_ = value;
1811  }
1813  inline int getMultipleRootTries() const {
1814  return multipleRootTries_;
1815  }
1817  inline void sayEventHappened()
1818  { eventHappened_=true;}
1820  inline bool normalSolver() const {
1821  return (specialOptions_&16) == 0;
1822  }
1827  inline bool waitingForMiniBranchAndBound() const {
1828  return (specialOptions_&1048576) != 0;
1829  }
1853  inline void setMoreSpecialOptions(int value) {
1854  moreSpecialOptions_ = value;
1855  }
1857  inline int moreSpecialOptions() const {
1858  return moreSpecialOptions_;
1859  }
1874  inline void setMoreSpecialOptions2(int value) {
1875  moreSpecialOptions2_ = value;
1876  }
1878  inline int moreSpecialOptions2() const {
1879  return moreSpecialOptions2_;
1880  }
1882  inline void setCutoffAsConstraint(bool yesNo) {
1883  cutoffRowNumber_ = (yesNo) ? -2 : -1;
1884  }
1886  inline void setUseElapsedTime(bool yesNo) {
1887  if (yesNo)
1888  moreSpecialOptions_ |= 131072;
1889  else
1890  moreSpecialOptions_ &= ~131072;
1891  }
1893  inline bool useElapsedTime() const {
1894  return (moreSpecialOptions_&131072)!=0;
1895  }
1897  inline void * temporaryPointer() const
1898  { return temporaryPointer_;}
1900  inline void setTemporaryPointer(void * pointer)
1901  { temporaryPointer_=pointer;}
1903  void goToDantzig(int numberNodes, ClpDualRowPivot *& savePivotMethod);
1905  inline bool ownObjects() const {
1906  return ownObjects_;
1907  }
1909  void checkModel();
1911  //---------------------------------------------------------------------------
1912 
1914 
1915  CbcModel();
1917 
1919  CbcModel(const OsiSolverInterface &);
1920 
1929  void assignSolver(OsiSolverInterface *&solver, bool deleteSolver = true);
1930 
1942  inline void setModelOwnsSolver (bool ourSolver) {
1943  ownership_ = ourSolver ? (ownership_ | 0x80000000) : (ownership_ & (~0x80000000)) ;
1944  }
1945 
1951  inline bool modelOwnsSolver () {
1952  return ((ownership_&0x80000000) != 0) ;
1953  }
1954 
1958  CbcModel(const CbcModel & rhs, bool cloneHandler = false);
1959 
1961  virtual CbcModel *clone (bool cloneHandler);
1962 
1964  CbcModel & operator=(const CbcModel& rhs);
1965 
1967  virtual ~CbcModel ();
1968 
1970  inline OsiSolverInterface * solver() const {
1971  return solver_;
1972  }
1973 
1975  inline OsiSolverInterface * swapSolver(OsiSolverInterface * solver) {
1976  OsiSolverInterface * returnSolver = solver_;
1977  solver_ = solver;
1978  return returnSolver;
1979  }
1980 
1982  inline OsiSolverInterface * continuousSolver() const {
1983  return continuousSolver_;
1984  }
1985 
1987  inline void createContinuousSolver() {
1988  continuousSolver_ = solver_->clone();
1989  }
1991  inline void clearContinuousSolver() {
1992  delete continuousSolver_;
1993  continuousSolver_ = NULL;
1994  }
1995 
1997  inline OsiSolverInterface * referenceSolver() const {
1998  return referenceSolver_;
1999  }
2000 
2002  void saveReferenceSolver();
2003 
2009  void resetToReferenceSolver();
2010 
2012  void gutsOfDestructor();
2015  void gutsOfDestructor2();
2018  void resetModel();
2024  void gutsOfCopy(const CbcModel & rhs, int mode = 0);
2026  void moveInfo(const CbcModel & rhs);
2028 
2030 
2031  static bool haveMultiThreadSupport();
2035  return masterThread_;
2036  }
2038  CbcNodeInfo ** walkback() const {
2039  return walkback_;
2040  }
2042  inline int getNumberThreads() const {
2043  return numberThreads_;
2044  }
2046  inline void setNumberThreads(int value) {
2047  numberThreads_ = value;
2048  }
2050  inline int getThreadMode() const {
2051  return threadMode_;
2052  }
2062  inline void setThreadMode(int value) {
2063  threadMode_ = value;
2064  }
2071  inline int parallelMode() const {
2072  if (!numberThreads_) {
2073  if ((threadMode_&1) == 0)
2074  return 0;
2075  else
2076  return -1;
2077  return 0;
2078  } else {
2079  if ((threadMode_&1) == 0)
2080  return 1;
2081  else
2082  return -2;
2083  }
2084  }
2086  inline CbcBaseModel * master() const
2087  { return master_;}
2090  bool isLocked() const;
2091 #ifdef CBC_THREAD
2092 
2096  void lockThread();
2100  void unlockThread();
2101 #else
2102  inline void lockThread() {}
2103  inline void unlockThread() {}
2104 #endif
2105 
2112  void setInfoInChild(int type, CbcThread * info);
2119  void moveToModel(CbcModel * baseModel, int mode);
2121  int splitModel(int numberModels, CbcModel ** model,
2122  int numberNodes);
2124  void startSplitModel(int numberIterations);
2126  void mergeModels(int numberModel, CbcModel ** model,
2127  int numberNodes);
2129 
2131 
2132  int getNodeCount2() const {
2134  return numberNodes2_;
2135  }
2137  void setPointers(const OsiSolverInterface * solver);
2143  int reducedCostFix() ;
2147  void synchronizeHandlers(int makeDefault);
2149  void saveExtraSolution(const double * solution, double objectiveValue);
2151  void saveBestSolution(const double * solution, double objectiveValue);
2153  void deleteSolutions();
2155  int resolve(OsiSolverInterface * solver);
2156 #ifdef CLP_RESOLVE
2157  int resolveClp(OsiClpSolverInterface * solver, int type);
2159 #endif
2160 
2164  int chooseBranch(CbcNode * & newNode, int numberPassesLeft,
2165  CbcNode * oldNode, OsiCuts & cuts,
2166  bool & resolved, CoinWarmStartBasis *lastws,
2167  const double * lowerBefore, const double * upperBefore,
2168  OsiSolverBranch * & branches);
2169  int chooseBranch(CbcNode * newNode, int numberPassesLeft, bool & resolved);
2170 
2177  CoinWarmStartBasis *getEmptyBasis(int ns = 0, int na = 0) const ;
2178 
2190  int takeOffCuts(OsiCuts &cuts,
2191  bool allowResolve, OsiCuts * saveCuts,
2192  int numberNewCuts = 0, const OsiRowCut ** newCuts = NULL) ;
2193 
2206  int addCuts(CbcNode * node, CoinWarmStartBasis *&lastws);
2207 
2224  bool addCuts1(CbcNode * node, CoinWarmStartBasis *&lastws);
2228  void previousBounds (CbcNode * node, CbcNodeInfo * where, int iColumn,
2229  double & lower, double & upper, int force);
2234  void setObjectiveValue(CbcNode * thisNode, const CbcNode * parentNode) const;
2235 
2239  void convertToDynamic();
2241  void synchronizeNumberBeforeTrust(int type = 0);
2243  void zapIntegerInformation(bool leaveObjects = true);
2245  int cliquePseudoCosts(int doStatistics);
2247  void pseudoShadow(int type);
2254  void fillPseudoCosts(double * downCosts, double * upCosts,
2255  int * priority = NULL,
2256  int * numberDown = NULL, int * numberUp = NULL,
2257  int * numberDownInfeasible = NULL,
2258  int * numberUpInfeasible = NULL) const;
2264  void doHeuristicsAtRoot(int deleteHeuristicsAfterwards = 0);
2266  void adjustHeuristics();
2268  inline const double * hotstartSolution() const {
2269  return hotstartSolution_;
2270  }
2272  inline const int * hotstartPriorities() const {
2273  return hotstartPriorities_;
2274  }
2275 
2277  inline CbcCountRowCut ** addedCuts() const {
2278  return addedCuts_;
2279  }
2281  inline int currentNumberCuts() const {
2282  return currentNumberCuts_;
2283  }
2285  inline CbcRowCuts * globalCuts() {
2286  return &globalCuts_;
2287  }
2289  inline void zapGlobalCuts() {
2290  globalCuts_ = CbcRowCuts();
2291  }
2293  void setNextRowCut(const OsiRowCut & cut);
2295  inline CbcNode * currentNode() const {
2296  return currentNode_;
2297  }
2299  inline CglTreeProbingInfo * probingInfo() const {
2300  return probingInfo_;
2301  }
2303  inline CoinThreadRandom * randomNumberGenerator() {
2304  return &randomNumberGenerator_;
2305  }
2307  inline void setNumberStrongIterations(int number) {
2308  numberStrongIterations_ = number;
2309  }
2311  inline int numberStrongIterations() const {
2312  return numberStrongIterations_;
2313  }
2315  inline int maximumNumberIterations() const {
2316  return maximumNumberIterations_;
2317  }
2319  inline void setMaximumNumberIterations(int value) {
2320  maximumNumberIterations_ = value;
2321  }
2323  inline CbcSymmetry * symmetryInfo() const
2324  { return symmetryInfo_;}
2326  inline void setFastNodeDepth(int value) {
2327  fastNodeDepth_ = value;
2328  }
2330  inline int fastNodeDepth() const {
2331  return fastNodeDepth_;
2332  }
2334  inline int continuousPriority() const {
2335  return continuousPriority_;
2336  }
2338  inline void setContinuousPriority(int value) {
2339  continuousPriority_ = value;
2340  }
2341  inline void incrementExtra(int nodes, int iterations, int fathoms=1) {
2342  numberExtraNodes_ += nodes;
2343  numberExtraIterations_ += iterations;
2344  numberFathoms_ += fathoms;
2345  }
2347  inline void zeroExtra() {
2348  numberExtraNodes_ = 0;
2349  numberExtraIterations_ = 0;
2350  numberFathoms_ = 0;
2351  }
2353  inline int numberExtraIterations() const {
2354  return numberExtraIterations_;
2355  }
2357  void incrementStrongInfo(int numberTimes, int numberIterations,
2358  int numberFixed, bool ifInfeasible);
2360  inline const int * strongInfo() const {
2361  return strongInfo_;
2362  }
2363 
2365  inline int * mutableStrongInfo() {
2366  return strongInfo_;
2367  }
2369  CglStored * storedRowCuts() const {
2370  return storedRowCuts_;
2371  }
2373  void setStoredRowCuts(CglStored * cuts) {
2374  storedRowCuts_ = cuts;
2375  }
2377  inline bool allDynamic () const {
2378  return ((ownership_&0x40000000) != 0) ;
2379  }
2381  void generateCpp( FILE * fp, int options);
2383  OsiBranchingInformation usefulInformation() const;
2390  inline void setBestSolutionBasis(const CoinWarmStartBasis & bestSolutionBasis) {
2391  bestSolutionBasis_ = bestSolutionBasis;
2392  }
2394  void redoWalkBack();
2396 
2397  void setMIPStart( const std::vector< std::pair< std::string, double > > &mips ) {
2398  this->mipStart_ = mips;
2399  }
2400 
2401  const std::vector< std::pair< std::string, double > > &getMIPStart() {
2402  return this->mipStart_;
2403  }
2404 
2405 
2406 //---------------------------------------------------------------------------
2407 
2408 private:
2410 
2411 
2413  OsiSolverInterface * solver_;
2414 
2420  unsigned int ownership_ ;
2421 
2423  OsiSolverInterface * continuousSolver_;
2424 
2426  OsiSolverInterface * referenceSolver_;
2427 
2429  CoinMessageHandler * handler_;
2430 
2436  bool defaultHandler_;
2437 
2439  CoinMessages messages_;
2440 
2442  int intParam_[CbcLastIntParam];
2443 
2445  double dblParam_[CbcLastDblParam];
2446 
2455  mutable CoinWarmStart *emptyWarmStart_ ;
2456 
2458  double bestObjective_;
2460  double bestPossibleObjective_;
2462  double sumChangeObjective1_;
2464  double sumChangeObjective2_;
2465 
2467  double * bestSolution_;
2469  double ** savedSolutions_;
2470 
2475  double * currentSolution_;
2479  mutable const double * testSolution_;
2483  std::vector< std::pair< std::string, double > > mipStart_;
2490  CoinWarmStartBasis bestSolutionBasis_ ;
2492  CbcRowCuts globalCuts_;
2494  CbcRowCuts * globalConflictCuts_;
2495 
2497  double minimumDrop_;
2499  int numberSolutions_;
2501  int numberSavedSolutions_;
2503  int maximumSavedSolutions_;
2510  int stateOfSearch_;
2512  int whenCuts_;
2514  double * hotstartSolution_;
2516  int * hotstartPriorities_;
2518  int numberHeuristicSolutions_;
2520  int numberNodes_;
2524  int numberNodes2_;
2526  int numberIterations_;
2528  int numberSolves_;
2530  int status_;
2541  int secondaryStatus_;
2543  int numberIntegers_;
2545  int numberRowsAtContinuous_;
2551  int cutoffRowNumber_;
2553  int maximumNumberCuts_;
2562  int phase_;
2563 
2565  int currentNumberCuts_;
2566 
2571  int maximumDepth_;
2577  CbcNodeInfo ** walkback_;
2578  CbcNodeInfo ** lastNodeInfo_;
2579  const OsiRowCut ** lastCut_;
2580  int lastDepth_;
2581  int lastNumberCuts2_;
2582  int maximumCuts_;
2583  int * lastNumberCuts_;
2584 
2592  CbcCountRowCut ** addedCuts_;
2593 
2597  OsiRowCut * nextRowCut_;
2598 
2600  CbcNode * currentNode_;
2601 
2603  int * integerVariable_;
2605  char * integerInfo_;
2607  double * continuousSolution_;
2609  int * usedInSolution_;
2637  int specialOptions_;
2652  int moreSpecialOptions_;
2666  int moreSpecialOptions2_;
2668  CbcCompareBase * nodeCompare_;
2670  CbcFeasibilityBase * problemFeasibility_;
2672  CbcTree * tree_;
2674  CbcFullNodeInfo * topOfTree_;
2676  CbcModel * subTreeModel_;
2678  CbcModel * heuristicModel_;
2680  int numberStoppedSubTrees_;
2682  CbcBranchDecision * branchingMethod_;
2684  CbcCutModifier * cutModifier_;
2686  CbcStrategy * strategy_;
2688  CbcModel * parentModel_;
2694  const double * cbcColLower_;
2697  const double * cbcColUpper_;
2699  const double * cbcRowLower_;
2701  const double * cbcRowUpper_;
2703  const double * cbcColSolution_;
2705  const double * cbcRowPrice_;
2707  const double * cbcReducedCost_;
2709  const double * cbcRowActivity_;
2711  void * appData_;
2713  int presolve_;
2717  int numberStrong_;
2723  int numberBeforeTrust_;
2727  int numberPenalties_;
2729  int stopNumberIterations_;
2732  double penaltyScaleFactor_;
2734  int numberAnalyzeIterations_;
2736  double * analyzeResults_;
2738  void * temporaryPointer_;
2740  int numberInfeasibleNodes_;
2747  int problemType_;
2749  int printFrequency_;
2751  int numberCutGenerators_;
2752  // Cut generators
2753  CbcCutGenerator ** generator_;
2754  // Cut generators before any changes
2755  CbcCutGenerator ** virginGenerator_;
2757  int numberHeuristics_;
2759  CbcHeuristic ** heuristic_;
2761  CbcHeuristic * lastHeuristic_;
2763  int fastNodeDepth_;
2765 # ifdef CBC_ONLY_CLP
2766  ClpEventHandler *eventHandler_ ;
2767 # else
2768  CbcEventHandler *eventHandler_ ;
2769 # endif
2770  CbcSymmetry * symmetryInfo_;
2773  int numberObjects_;
2774 
2785  OsiObject ** object_;
2787  bool ownObjects_;
2788 
2790  int * originalColumns_;
2792  int howOftenGlobalScan_;
2795  int numberGlobalViolations_;
2797  int numberExtraIterations_;
2799  int numberExtraNodes_;
2801  int numberFathoms_;
2805  double continuousObjective_;
2808  double originalContinuousObjective_;
2810  int continuousInfeasibilities_;
2812  int maximumCutPassesAtRoot_;
2814  int maximumCutPasses_;
2816  int preferredWay_;
2818  int currentPassNumber_;
2820  int maximumWhich_;
2822  int maximumRows_;
2824  int randomSeed_;
2826  int multipleRootTries_;
2828  int currentDepth_;
2830  mutable CoinThreadRandom randomNumberGenerator_;
2832  CoinWarmStartBasis workingBasis_;
2834  int * whichGenerator_;
2836  int maximumStatistics_;
2838  CbcStatistics ** statistics_;
2840  int maximumDepthActual_;
2842  double numberDJFixed_;
2844  CglTreeProbingInfo * probingInfo_;
2846  int numberFixedAtRoot_;
2848  int numberFixedNow_;
2850  bool stoppedOnGap_;
2852  mutable bool eventHappened_;
2854  int numberLongStrong_;
2856  int numberOldActiveCuts_;
2858  int numberNewCuts_;
2860  int searchStrategy_;
2872  int strongStrategy_;
2874  int numberStrongIterations_;
2877  int strongInfo_[7];
2884  OsiBabSolver * solverCharacteristics_;
2886  bool resolveAfterTakeOffCuts_;
2888  int maximumNumberIterations_;
2890  int continuousPriority_;
2892  int numberUpdateItems_;
2894  int maximumNumberUpdateItems_;
2896  CbcObjectUpdateData * updateItems_;
2898  CglStored * storedRowCuts_;
2906  int numberThreads_;
2914  int threadMode_;
2916  int numberGlobalCutsIn_;
2918  CbcBaseModel * master_;
2920  CbcThread * masterThread_;
2922 };
2924 void getIntegerInformation(const OsiObject * object, double & originalLower,
2925  double & originalUpper) ;
2926 // So we can call from other programs
2927 // Real main program
2928 class OsiClpSolverInterface;
2929 int CbcMain (int argc, const char *argv[], OsiClpSolverInterface & solver, CbcModel ** babSolver);
2930 int CbcMain (int argc, const char *argv[], CbcModel & babSolver);
2931 // four ways of calling
2932 int callCbc(const char * input2, OsiClpSolverInterface& solver1);
2933 int callCbc(const char * input2);
2934 int callCbc(const std::string input2, OsiClpSolverInterface& solver1);
2935 int callCbc(const std::string input2) ;
2936 // When we want to load up CbcModel with options first
2937 void CbcMain0 (CbcModel & babSolver);
2938 int CbcMain1 (int argc, const char *argv[], CbcModel & babSolver);
2939 // two ways of calling
2940 int callCbc(const char * input2, CbcModel & babSolver);
2941 int callCbc(const std::string input2, CbcModel & babSolver);
2942 // And when CbcMain0 already called to initialize
2943 int callCbc1(const char * input2, CbcModel & babSolver);
2944 int callCbc1(const std::string input2, CbcModel & babSolver);
2945 // And when CbcMain0 already called to initialize (with call back) (see CbcMain1 for whereFrom)
2946 int callCbc1(const char * input2, CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom));
2947 int callCbc1(const std::string input2, CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom));
2948 int CbcMain1 (int argc, const char *argv[], CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom));
2949 // For uniform setting of cut and heuristic options
2950 void setCutAndHeuristicOptions(CbcModel & model);
2951 #endif
2952 
void flipModel()
Flip direction of optimization on all models.
bool isInitialSolveProvenOptimal() const
Is optimality proven (for initialSolve) ?
void passInSolverCharacteristics(OsiBabSolver *solverCharacteristics)
For advanced applications you may wish to modify the behavior of Cbc e.g.
const OsiObject * object(int which) const
Get the specified object.
Definition: CbcModel.hpp:477
void setProblemFeasibility(CbcFeasibilityBase *feasibility)
double getDblParam(CbcDblParam key) const
Get a double parameter.
Definition: CbcModel.hpp:553
The objective is assumed to worsen by this amount for each integer infeasibility. ...
Definition: CbcModel.hpp:137
int continuousPriority() const
Get anything with priority >= this can be treated as continuous.
Definition: CbcModel.hpp:2334
void resetToReferenceSolver()
Uses a copy of reference solver to be current solver.
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:1827
int getMaximumCutPasses() const
Get the maximum number of cut passes at other nodes (default 10)
Definition: CbcModel.hpp:762
Number of branches (may be more than number of nodes as may include strong branching) ...
Definition: CbcModel.hpp:126
void newLanguage(CoinMessages::Language language)
Set language.
const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
Definition: CbcModel.hpp:1047
int getExtraNodeCount() const
Get how many Nodes were enumerated in complete fathoming B&B inside CLP.
Definition: CbcModel.hpp:938
CbcModel * integerPresolve(bool weak=false)
Do integer presolve, creating a new (presolved) model.
void setPointers(const OsiSolverInterface *solver)
Set pointers for speed.
CbcModel * heuristicModel() const
A pointer to model from CbcHeuristic.
Definition: CbcModel.hpp:1430
CbcNodeInfo ** walkback() const
Get pointer to walkback.
Definition: CbcModel.hpp:2038
void setHowOftenGlobalScan(int number)
Set how often to scan global cuts.
Current objective value.
Definition: CbcModel.hpp:163
void setLastHeuristic(CbcHeuristic *last)
set last heuristic which found a solution
Definition: CbcModel.hpp:1646
double getCurrentObjValue() const
Get current objective function value.
Definition: CbcModel.hpp:1271
Event handling for cbc.
const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels.
Definition: CbcModel.hpp:1266
OsiBranchingInformation usefulInformation() const
Generate an OsiBranchingInformation object.
void setOptionalInteger(int index)
int logLevel() const
Get log level.
Definition: CbcModel.hpp:1746
CbcBranchDecision * branchingMethod() const
Get the current branching decision method.
Definition: CbcModel.hpp:1503
void setRandomSeed(int value)
Set random seed.
Definition: CbcModel.hpp:1801
bool setAllowableFractionGap(double value)
Set the fraction allowable gap between the best known solution and the best possible solution...
Definition: CbcModel.hpp:668
const std::vector< std::pair< std::string, double > > & getMIPStart()
Definition: CbcModel.hpp:2401
int getMaximumNodes() const
Get the maximum node limit .
Definition: CbcModel.hpp:576
int currentNumberCuts() const
Number of entries in the list returned by addedCuts()
Definition: CbcModel.hpp:2281
const double * getCbcRowLower() const
Get pointer to array[getNumRows()] (for speed) of row lower bounds.
Definition: CbcModel.hpp:1160
int priority(int sequence) const
Returns priority level for an object (or 1000 if no priorities exist)
Definition: CbcModel.hpp:1671
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:1882
const double * getCbcColUpper() const
Get pointer to array[getNumCols()] (for speed) of column upper bounds.
Definition: CbcModel.hpp:1156
CglTreeProbingInfo * probingInfo() const
Get a pointer to probing info.
Definition: CbcModel.hpp:2299
CbcModel & operator=(const CbcModel &rhs)
Assignment operator.
int numberRowsAtContinuous() const
Number of rows in continuous (root) problem.
Definition: CbcModel.hpp:1003
The maximum number of nodes before terminating.
Definition: CbcModel.hpp:107
void setFastNodeDepth(int value)
Set depth for fast nodes.
Definition: CbcModel.hpp:2326
int getMaximumSolutions() const
Get the maximum number of solutions desired.
Definition: CbcModel.hpp:591
double * currentSolution() const
Solution to the most recent lp relaxation.
Definition: CbcModel.hpp:1235
const double * testSolution() const
For testing infeasibilities - will point to currentSolution_ or solver–>getColSolution() ...
Definition: CbcModel.hpp:1241
void setNumberStrongIterations(int number)
Set the number of iterations done in strong branching.
Definition: CbcModel.hpp:2307
bool defaultHandler() const
Check default handler.
Definition: CbcModel.hpp:1758
double getInfinity() const
Get solver&#39;s value for infinity.
Definition: CbcModel.hpp:1148
bool setHeuristicFractionGap(double value)
Set the fraction heuristic gap between the best known solution and the best possible solution...
Definition: CbcModel.hpp:705
void setStrongStrategy(int value)
Set strong branching strategy.
Definition: CbcModel.hpp:1560
int * mutableStrongInfo()
Return mutable strong info.
Definition: CbcModel.hpp:2365
virtual CbcModel * clone(bool cloneHandler)
Clone.
CbcNode * currentNode() const
Get a pointer to current node (be careful)
Definition: CbcModel.hpp:2295
int maximumNumberIterations() const
Get maximum number of iterations (designed to be used in heuristics)
Definition: CbcModel.hpp:2315
int specialOptions() const
Get special options.
Definition: CbcModel.hpp:1797
void setHeuristicModel(CbcModel *model)
Set a pointer to model from CbcHeuristic.
Definition: CbcModel.hpp:1433
void setCurrentPassNumber(int value)
Set current cut pass number in this round of cuts.
Definition: CbcModel.hpp:772
bool isNodeLimitReached() const
Node limit reached?
void setResolveAfterTakeOffCuts(bool yesNo)
Definition: CbcModel.hpp:1410
const double * getCbcColSolution() const
Get pointer to array[getNumCols()] (for speed) of primal solution vector.
Definition: CbcModel.hpp:1168
const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
Definition: CbcModel.hpp:1094
int numberExtraIterations() const
Number of extra iterations.
Definition: CbcModel.hpp:2353
void incrementNodeCount(int value)
Increment how many nodes it took to solve the problem.
Definition: CbcModel.hpp:934
void setContinuousPriority(int value)
Set anything with priority >= this can be treated as continuous.
Definition: CbcModel.hpp:2338
double getIntegerTolerance() const
Get the integrality tolerance .
Definition: CbcModel.hpp:633
const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
Definition: CbcModel.hpp:1138
int callCbc(const char *input2, OsiClpSolverInterface &solver1)
void lockThread()
Definition: CbcModel.hpp:2102
Just a marker, so that a static sized array can store parameters.
Definition: CbcModel.hpp:194
bool setInfeasibilityWeight(double value)
Set the weight per integer infeasibility .
Definition: CbcModel.hpp:641
void reserveCurrentSolution(const double *solution=NULL)
Make sure region there and optionally copy solution.
bool setIntegerTolerance(double value)
Set the integrality tolerance .
Definition: CbcModel.hpp:627
double getInfeasibilityWeight() const
Get the weight per integer infeasibility .
Definition: CbcModel.hpp:648
bool isFreeBinary(int colIndex) const
Return true if variable is binary and not fixed at either bound.
Definition: CbcModel.hpp:1133
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:584
Cutoff - stored for speed.
Definition: CbcModel.hpp:159
int numberBeforeTrust() const
get the number of branches before pseudo costs believed in dynamic strong branching.
Definition: CbcModel.hpp:820
bool integerPresolveThisModel(OsiSolverInterface *originalSolver, bool weak=false)
Do integer presolve, modifying the current model.
const double * getRowPrice() const
Get pointer to array[getNumRows()] of dual prices.
Definition: CbcModel.hpp:1256
int getNumCols() const
Get number of columns.
Definition: CbcModel.hpp:1008
CoinWarmStartBasis & workingBasis()
Work basis for temporary use.
Definition: CbcModel.hpp:1418
int getPrintingMode() const
Get the printing mode.
Definition: CbcModel.hpp:600
void setStoredRowCuts(CglStored *cuts)
Set stored row cuts for donor/recipient CbcModel.
Definition: CbcModel.hpp:2373
bool setDblParam(CbcDblParam key, double value)
Set a double parameter.
Definition: CbcModel.hpp:544
void clearContinuousSolver()
Clear solver with continuous state.
Definition: CbcModel.hpp:1991
CoinMessages * messagesPointer()
Return pointer to messages.
Definition: CbcModel.hpp:1740
void makePartialCut(const OsiRowCut *cut, const OsiSolverInterface *solver=NULL)
Make partial cut into a global cut and save.
void setNumberHeuristicSolutions(int value)
Set number of heuristic solutions.
Definition: CbcModel.hpp:1366
int getMultipleRootTries() const
Get multiple root tries.
Definition: CbcModel.hpp:1813
Sum of non-zero changes on a branch.
Definition: CbcModel.hpp:188
double penaltyScaleFactor() const
Get scale factor to make penalties match strong.
Definition: CbcModel.hpp:846
bool modelOwnsSolver()
Get ownership of solver.
Definition: CbcModel.hpp:1951
void setModelOwnsSolver(bool ourSolver)
Set ownership of solver.
Definition: CbcModel.hpp:1942
void setNumberAnalyzeIterations(int number)
Number of analyze iterations to do.
Definition: CbcModel.hpp:838
int numberAnalyzeIterations() const
Definition: CbcModel.hpp:841
void setThreadMode(int value)
Set thread mode always use numberThreads for branching 1 set then deterministic 2 set then use number...
Definition: CbcModel.hpp:2062
int takeOffCuts(OsiCuts &cuts, bool allowResolve, OsiCuts *saveCuts, int numberNewCuts=0, const OsiRowCut **newCuts=NULL)
Remove inactive cuts from the model.
void setNumberThreads(int value)
Set number of threads.
Definition: CbcModel.hpp:2046
bool isProvenInfeasible() const
Is infeasiblity proven (or none better than cutoff)?
double * continuousSolution() const
Holds solution at continuous (after cuts if branchAndBound called)
Definition: CbcModel.hpp:1189
void * getApplicationData() const
Get application data.
void saveReferenceSolver()
Save a copy of the current solver so can be reset to.
void setPrintFrequency(int number)
Set the print frequency.
Definition: CbcModel.hpp:893
int problemType() const
Definition: CbcModel.hpp:862
CbcCutGenerator ** cutGenerators() const
Get the list of cut generators.
Definition: CbcModel.hpp:1569
CoinMessageHandler * messageHandler() const
Return handler.
Definition: CbcModel.hpp:1732
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:1728
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.
void unlockThread()
Definition: CbcModel.hpp:2103
void convertToDynamic()
If numberBeforeTrust >0 then we are going to use CbcBranchDynamic.
const double * getCbcRowActivity() const
Get pointer to array[getNumRows()] (for speed) of row activity levels.
Definition: CbcModel.hpp:1180
bool setAllowablePercentageGap(double value)
Set the percentage allowable gap between the best known solution and the best possible solution...
Definition: CbcModel.hpp:680
void setBranchingMethod(CbcBranchDecision *method)
Set the branching decision method.
Definition: CbcModel.hpp:1507
const double * getCbcColLower() const
Get pointer to array[getNumCols()] (for speed) of column lower bounds.
Definition: CbcModel.hpp:1152
void generateCpp(FILE *fp, int options)
Create C++ lines to get to current state.
int getIterationCount() const
Get how many iterations it took to solve the problem.
Definition: CbcModel.hpp:922
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:123
char integerType(int i) const
Whether or not integer.
Definition: CbcModel.hpp:1031
void setApplicationData(void *appData)
Set application data.
double getAllowablePercentageGap() const
Get the percentage allowable gap between the best known solution and the best possible solution...
Definition: CbcModel.hpp:686
Stop when the gap between the objective value of the best known solution and the best bound on the ob...
Definition: CbcModel.hpp:154
bool isSolutionLimitReached() const
Solution limit reached?
double getCutoffIncrement() const
Get the CbcModel::CbcCutoffIncrement desired.
Definition: CbcModel.hpp:725
int getFathomCount() const
Get how many times complete fathoming B&B was done.
Definition: CbcModel.hpp:942
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:1552
CbcSymmetry * symmetryInfo() const
Symmetry information.
Definition: CbcModel.hpp:2323
void setOriginalColumns(const int *originalColumns, int numberGood=COIN_INT_MAX)
Set original columns as created by preprocessing.
void deleteSolutions()
Delete best and saved solutions.
CbcModel * subTreeModel(OsiSolverInterface *solver=NULL) const
For retrieving a copy of subtree model with given OsiSolver.
bool canStopOnGap() const
See if can stop on gap.
double getContinuousObjective() const
Value of objective at continuous.
Definition: CbcModel.hpp:1377
const double * getCbcReducedCost() const
Get a pointer to array[getNumCols()] (for speed) of reduced costs.
Definition: CbcModel.hpp:1176
void makeGlobalCuts()
Make partial cuts into global cuts.
int getNumberHeuristicSolutions() const
Get number of heuristic solutions.
Definition: CbcModel.hpp:1362
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:1853
bool isContinuous(int colIndex) const
Return true if variable is continuous.
Definition: CbcModel.hpp:1110
bool setPrintingMode(int value)
Set the printing mode.
Definition: CbcModel.hpp:595
void setDefaultHandler(bool yesNo)
Set flag to say if handler_ is the default handler.
Definition: CbcModel.hpp:1754
double getCutoff() const
Get the cutoff bound on the objective function - always as minimize.
Definition: CbcModel.hpp:564
void saveSolution(const OsiSolverInterface *osi, std::string fileName)
double getObjValue() const
Get best objective function value.
Definition: CbcModel.hpp:1289
int numberStrong() const
Get the maximum number of candidates to be evaluated for strong branching.
Definition: CbcModel.hpp:785
void setCutAndHeuristicOptions(CbcModel &model)
void moveToModel(CbcModel *baseModel, int mode)
Move/copy information from one model to another -1 - initialization 0 - from base model 1 - to base m...
Fathoming discipline.
Definition: CbcModel.hpp:119
int numberSavedSolutions() const
Number of saved solutions (including best)
void incrementSubTreeStopped()
Says a sub tree was stopped.
Definition: CbcModel.hpp:1479
int getMaximumCutPassesAtRoot() const
Get the maximum number of cut passes at root node.
Definition: CbcModel.hpp:752
void zapGlobalCuts()
Get rid of global cuts.
Definition: CbcModel.hpp:2289
double getSolverObjValue() const
Get solver objective function value (as minimization)
Definition: CbcModel.hpp:1303
void gutsOfCopy(const CbcModel &rhs, int mode=0)
Most of copy constructor mode - 0 copy but don&#39;t delete before 1 copy and delete before 2 copy and de...
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...
bool isInitialSolveAbandoned() const
Are there numerical difficulties (for initialSolve) ?
int fastNodeDepth() const
Get depth for fast nodes.
Definition: CbcModel.hpp:2330
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:165
void setBestSolutionBasis(const CoinWarmStartBasis &bestSolutionBasis)
Warm start object produced by heuristic or strong branching.
Definition: CbcModel.hpp:2390
void synchronizeHandlers(int makeDefault)
Makes all handlers same.
int numberCutGenerators() const
Get the number of cut generators.
Definition: CbcModel.hpp:1565
void setNumberPenalties(int number)
Set the number of variables for which to compute penalties in dynamic strong branching.
void setMinimizationObjValue(double value)
Set best objective function value as minimization.
Definition: CbcModel.hpp:1284
void startSplitModel(int numberIterations)
Start threads.
Using MS heap implementation.
Definition: CbcTree.hpp:53
bool isInitialSolveProvenDualInfeasible() const
Is dual infeasiblity proven (for initialSolve) ?
Stop doing heuristics when the gap between the objective value of the best known solution and the bes...
Definition: CbcModel.hpp:184
void setLogLevel(int value)
Set log level.
int * originalColumns() const
Original columns as created by integerPresolve or preprocessing.
Definition: CbcModel.hpp:877
const char * integerType() const
Whether or not integer.
Definition: CbcModel.hpp:1037
void setWhenCuts(int value)
Set at which depths to do cuts.
Definition: CbcModel.hpp:802
void setNumberBeforeTrust(int number)
Set the number of branches before pseudo costs believed in dynamic strong branching.
Class to deal with symmetry.
Definition: CbcSymmetry.hpp:69
Base class for Cbc event handling.
int callCbc1(const char *input2, CbcModel &babSolver)
OsiObject * modifiableObject(int which) const
Get the specified object.
Definition: CbcModel.hpp:481
const int * hotstartPriorities() const
Get the hotstart priorities.
Definition: CbcModel.hpp:2272
int getContinuousInfeasibilities() const
Number of infeasibilities at continuous.
Definition: CbcModel.hpp:1384
const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
Definition: CbcModel.hpp:1251
int phase() const
Current phase (so heuristics etc etc can find out).
Definition: CbcModel.hpp:1357
void setHotstartSolution(const double *solution, const int *priorities=NULL)
Pass in target solution and optional priorities.
bool allDynamic() const
Says whether all dynamic integers.
Definition: CbcModel.hpp:2377
int addCuts(CbcNode *node, CoinWarmStartBasis *&lastws)
Determine and install the active cuts that need to be added for the current subproblem.
int numberStrongIterations() const
Get the number of iterations done in strong branching.
Definition: CbcModel.hpp:2311
Just a marker, so that a static sized array can store parameters.
Definition: CbcModel.hpp:128
int getNodeCount2() const
Get how many Nodes it took to solve the problem.
Definition: CbcModel.hpp:2133
double getCurrentMinimizationObjValue() const
Get current minimization objective function value.
Definition: CbcModel.hpp:1275
void setMaximumSavedSolutions(int value)
Set maximum number of extra saved solutions.
void setUseElapsedTime(bool yesNo)
Set time method.
Definition: CbcModel.hpp:1886
int numberPenalties() const
get the number of variables for which to compute penalties in dynamic strong branching.
Definition: CbcModel.hpp:831
int parallelMode() const
Return -2 if deterministic threaded and main thread -1 if deterministic threaded and serial thread 0 ...
Definition: CbcModel.hpp:2071
bool isBinary(int colIndex) const
Return true if variable is binary.
Definition: CbcModel.hpp:1115
void gutsOfDestructor2()
Clears out enough to reset CbcModel as if no branch and bound done.
const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
Definition: CbcModel.hpp:1261
void setBestObjectiveValue(double objectiveValue)
Just update objectiveValue.
void redoWalkBack()
Redo walkback arrays.
int stateOfSearch() const
State of search 0 - no solution 1 - only heuristic solutions 2 - branched to a solution 3 - no soluti...
Definition: CbcModel.hpp:1541
CbcHeuristic * lastHeuristic() const
Pointer to heuristic solver which found last solution (or NULL)
Definition: CbcModel.hpp:1642
void setStateOfSearch(int state)
Definition: CbcModel.hpp:1544
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:176
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:1515
int printFrequency() const
Get the print frequency.
Definition: CbcModel.hpp:897
int moreSpecialOptions2() const
Get more special options2.
Definition: CbcModel.hpp:1878
The amount by which to tighten the objective function cutoff when a new solution is discovered...
Definition: CbcModel.hpp:140
bool isIntegerNonBinary(int colIndex) const
Return true if variable is general integer.
Definition: CbcModel.hpp:1128
virtual CbcBranchDecision * clone() const =0
Clone.
void setProblemType(int number)
Problem type as set by user or found by analysis.
Definition: CbcModel.hpp:859
void saveBestSolution(const double *solution, double objectiveValue)
Save a solution to best and move current to saved.
void clearNumberGlobalViolations()
Definition: CbcModel.hpp:1403
void setCutoff(double value)
Set cutoff bound on the objective function.
bool isProvenOptimal() const
Is optimality proven?
bool isProvenDualInfeasible() const
Was continuous solution unbounded.
int getStopNumberIterations() const
Get number of "iterations" to stop after.
Definition: CbcModel.hpp:1422
void passInPriorities(const int *priorities, bool ifNotSimpleIntegers)
Pass in branching priorities.
OsiRowCut augmented with bookkeeping.
CbcCountRowCut ** addedCuts() const
Return the list of cuts initially collected for this subproblem.
Definition: CbcModel.hpp:2277
int numberIntegers() const
Number of integers in problem.
Definition: CbcModel.hpp:1023
int moreSpecialOptions() const
Get more special options.
Definition: CbcModel.hpp:1857
double getAllowableGap() const
Get the allowable gap between the best known solution and the best possible solution.
Definition: CbcModel.hpp:661
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&#39;s...
void setNumberObjects(int number)
Set the number of objects.
Definition: CbcModel.hpp:467
void previousBounds(CbcNode *node, CbcNodeInfo *where, int iColumn, double &lower, double &upper, int force)
Returns bounds just before where - initially original bounds.
void zeroExtra()
Zero extra.
Definition: CbcModel.hpp:2347
CbcModel()
Default Constructor.
bool isAbandoned() const
Are there a numerical difficulties?
double getAllowableFractionGap() const
Get the fraction allowable gap between the best known solution and the best possible solution...
Definition: CbcModel.hpp:674
Optimization direction - stored for speed.
Definition: CbcModel.hpp:161
bool resolveAfterTakeOffCuts() const
Whether to force a resolve after takeOffCuts.
Definition: CbcModel.hpp:1407
double getCurrentSeconds() const
Current time since start of branchAndbound.
Information required while the node is live.
Definition: CbcNode.hpp:49
For gathering statistics.
OsiSolverInterface * referenceSolver() const
A copy of the solver, taken at constructor or by saveReferenceSolver.
Definition: CbcModel.hpp:1997
double savedSolutionObjective(int which) const
Return a saved solution objective (0==best) - COIN_DBL_MAX if off end.
double getMaximumSeconds() const
Get the maximum number of seconds desired.
Definition: CbcModel.hpp:615
int numberObjects() const
Get the number of objects.
Definition: CbcModel.hpp:463
void setSolutionCount(int value)
Set number of solutions (so heuristics will be different)
Definition: CbcModel.hpp:1331
const double * hotstartSolution() const
Get the hotstart solution.
Definition: CbcModel.hpp:2268
bool isInitialSolveProvenPrimalInfeasible() const
Is primal infeasiblity proven (for initialSolve) ?
CbcCompareBase * nodeComparison() const
Definition: CbcModel.hpp:1440
OsiObject ** objects() const
Get the array of objects.
Definition: CbcModel.hpp:472
int maximumRows() const
Maximum number of rows.
Definition: CbcModel.hpp:1414
CoinThreadRandom * randomNumberGenerator()
Thread specific random number generator.
Definition: CbcModel.hpp:2303
bool maximumSecondsReached() const
Return true if maximum time reached.
void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
Definition: CbcModel.hpp:1371
void CbcMain0(CbcModel &babSolver)
The maximum number of solutions before terminating.
Definition: CbcModel.hpp:109
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...
const double * getCbcRowUpper() const
Get pointer to array[getNumRows()] (for speed) of row upper bounds.
Definition: CbcModel.hpp:1164
void setMoreSpecialOptions2(int value)
Set more more special options 0 bit (1) - find switching variables 1 bit (2) - using fake objective u...
Definition: CbcModel.hpp:1874
void setStrategy(CbcStrategy *strategy)
Set the strategy. assigns.
Definition: CbcModel.hpp:1607
int searchStrategy() const
Strategy worked out - mainly at root node for use by CbcNode.
Definition: CbcModel.hpp:1548
CoinWarmStartBasis * getEmptyBasis(int ns=0, int na=0) const
Return an empty basis object of the specified size.
void incrementIterationCount(int value)
Increment how many iterations it took to solve the problem.
Definition: CbcModel.hpp:926
const OsiBabSolver * solverCharacteristics() const
Get solver characteristics.
Definition: CbcModel.hpp:1715
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:186
CglStored * storedRowCuts() const
Get stored row cuts for donor/recipient CbcModel.
Definition: CbcModel.hpp:2369
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:748
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 ...
double sumChangeObjective() const
Sum of Changes to objective by first solve.
Definition: CbcModel.hpp:1395
void setObjValue(double value)
Set best objective function value.
Definition: CbcModel.hpp:1299
const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
Definition: CbcModel.hpp:1072
The maximum number of seconds before terminating.
Definition: CbcModel.hpp:157
CoinMessages & messages()
Return messages.
Definition: CbcModel.hpp:1736
CbcEventHandler * getEventHandler() const
Retrieve a pointer to the event handler.
Definition: CbcModel.hpp:1682
void initialSolve()
Solve the initial LP relaxation.
double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
Definition: CbcModel.hpp:1104
CbcRowCuts * globalCuts()
Global cuts.
Definition: CbcModel.hpp:2285
CoinBigIndex getNumElements() const
Get number of nonzero elements.
Definition: CbcModel.hpp:1018
bool setMaximumNodes(int value)
Set the maximum node limit .
Definition: CbcModel.hpp:571
The time at start of model.
Definition: CbcModel.hpp:168
int status() const
Final status of problem Some of these can be found out by is......
Definition: CbcModel.hpp:954
const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
Definition: CbcModel.hpp:1060
double * bestSolution() const
The best solution to the integer programming problem.
Definition: CbcModel.hpp:1313
void addObjects(int numberObjects, OsiObject **objects)
Add in object information.
void incrementExtra(int nodes, int iterations, int fathoms=1)
Definition: CbcModel.hpp:2341
Heuristic base class.
int splitModel(int numberModels, CbcModel **model, int numberNodes)
Split up nodes.
const int * whichGenerator() const
Which cut generator generated this cut.
Definition: CbcModel.hpp:365
void sayEventHappened()
Tell model to stop on event.
Definition: CbcModel.hpp:1817
Abstract cut modifier base class.
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.
int strongStrategy() const
Stong branching strategy.
Definition: CbcModel.hpp:1556
void setParentModel(CbcModel &parentModel)
Set the parent model.
Definition: CbcModel.hpp:1615
void setMIPStart(const std::vector< std::pair< std::string, double > > &mips)
Definition: CbcModel.hpp:2397
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:930
void zapIntegerInformation(bool leaveObjects=true)
Zap integer information in problem (may leave object info)
const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
Definition: CbcModel.hpp:1143
int getSolutionCount() const
Get number of solutions.
Definition: CbcModel.hpp:1326
void setPenaltyScaleFactor(double value)
Set scale factor to make penalties match strong.
int numberGlobalViolations() const
Number of times global cuts violated.
Definition: CbcModel.hpp:1400
OsiSolverInterface * continuousSolver() const
Returns solver with continuous state.
Definition: CbcModel.hpp:1982
Information required to recreate the subproblem at this node.
void setSecondaryStatus(int value)
Definition: CbcModel.hpp:975
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...
void setMaximumNumberIterations(int value)
Set maximum number of iterations (designed to be used in heuristics)
Definition: CbcModel.hpp:2319
Base model.
Definition: CbcThread.hpp:437
CbcHeuristic * heuristic(int i) const
Get the specified heuristic.
Definition: CbcModel.hpp:1630
void doHeuristicsAtRoot(int deleteHeuristicsAfterwards=0)
Do heuristics at root.
int getNumRows() const
Get number of rows.
Definition: CbcModel.hpp:1013
void setContinuousObjective(double value)
Definition: CbcModel.hpp:1380
double rootObjectiveAfterCuts() const
Value of objective after root node cuts added.
Definition: CbcModel.hpp:1391
void analyzeObjective()
Analyze problem to find a minimum change in the objective function.
void setProblemStatus(int value)
Definition: CbcModel.hpp:957
bool isLocked() const
From here to end of section - code in CbcThread.cpp until class changed Returns true if locked...
const int * strongInfo() const
Return strong info.
Definition: CbcModel.hpp:2360
CbcAction
Action codes returned by the event handler.
Largest non-zero change on a branch.
Definition: CbcModel.hpp:190
const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
Definition: CbcModel.hpp:1042
const double * getCbcRowPrice() const
Get pointer to array[getNumRows()] (for speed) of dual prices.
Definition: CbcModel.hpp:1172
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:1987
int getRandomSeed() const
Get random seed.
Definition: CbcModel.hpp:1805
void setTestSolution(const double *solution)
Definition: CbcModel.hpp:1244
int whenCuts() const
Get at which depths to do cuts.
Definition: CbcModel.hpp:798
int getPreferredWay() const
Get the preferred way to branch (default 0)
Definition: CbcModel.hpp:794
int getIntParam(CbcIntParam key) const
Get an integer parameter.
Definition: CbcModel.hpp:549
double getMinimizationObjValue() const
Get best objective function value as minimization.
Definition: CbcModel.hpp:1280
void synchronizeNumberBeforeTrust(int type=0)
Set numberBeforeTrust in all objects.
int numberHeuristics() const
Get the number of heuristics.
Definition: CbcModel.hpp:1634
void setNumberHeuristics(int value)
Set the number of heuristics.
Definition: CbcModel.hpp:1638
Small non-zero change on a branch to be used as guess.
Definition: CbcModel.hpp:192
bool setAllowableGap(double value)
Set the allowable gap between the best known solution and the best possible solution.
Definition: CbcModel.hpp:655
const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
Definition: CbcModel.hpp:1099
const int * integerVariable() const
Definition: CbcModel.hpp:1027
int getCurrentPassNumber() const
Get current cut pass number in this round of cuts.
Definition: CbcModel.hpp:767
CbcCutGenerator * virginCutGenerator(int i) const
Get the specified cut generator before any changes.
Definition: CbcModel.hpp:1577
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:758
CbcModel * parentModel() const
Get the current parent model.
Definition: CbcModel.hpp:1611
double getHeuristicFractionGap() const
Get the fraction heuristic gap between the best known solution and the best possible solution...
Definition: CbcModel.hpp:711
void setMinimumDrop(double value)
Set the minimum drop to continue cuts.
Definition: CbcModel.hpp:738
const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
Definition: CbcModel.hpp:1089
void passInMessageHandler(CoinMessageHandler *handler)
Pass in Message handler (not deleted at end)
int * usedInSolution() const
Array marked whenever a solution is found if non-zero.
Definition: CbcModel.hpp:1196
int typePresolve() const
Whether to automatically do presolve before branch and bound (subTrees).
Definition: CbcModel.hpp:1487
const double * savedSolution(int which) const
Return a saved solution (0==best) - NULL if off end.
void addUpdateInformation(const CbcObjectUpdateData &data)
Adds an update information object.
void resetModel()
Clears out enough to reset CbcModel cutoff etc.
double getBestPossibleObjValue() const
Get best possible objective function value.
void goToDantzig(int numberNodes, ClpDualRowPivot *&savePivotMethod)
Go to dantzig pivot selection if easy problem (clp only)
int getThreadMode() const
Get thread mode.
Definition: CbcModel.hpp:2050
const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
Definition: CbcModel.hpp:1084
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:1900
bool setIntParam(CbcIntParam key, int value)
Set an integer parameter.
Definition: CbcModel.hpp:539
void setMultipleRootTries(int value)
Set multiple root tries.
Definition: CbcModel.hpp:1809
bool normalSolver() const
Says if normal solver i.e. has well defined CoinPackedMatrix.
Definition: CbcModel.hpp:1820
void setObjectiveValue(CbcNode *thisNode, const CbcNode *parentNode) const
Set objective value in a node.
void AddIntegers()
Add additional integers.
bool ownObjects() const
Now we may not own objects - just point to solver&#39;s objects.
Definition: CbcModel.hpp:1905
void setContinuousInfeasibilities(int value)
Definition: CbcModel.hpp:1387
CbcFeasibilityBase * problemFeasibility() const
Definition: CbcModel.hpp:1450
int reducedCostFix()
Perform reduced cost fixing.
bool setMaximumSeconds(double value)
Set the maximum number of seconds desired.
Definition: CbcModel.hpp:608
CbcBaseModel * master() const
Thread stuff for master.
Definition: CbcModel.hpp:2086
Interface between Cbc and Cut Generation Library.
void deleteSavedSolution(int which)
Delete a saved solution and move others up.
double getMinimumDrop() const
Get the minimum drop to continue cuts.
Definition: CbcModel.hpp:742
const CbcFullNodeInfo * topOfTree() const
Pointer to top of tree.
Definition: CbcModel.hpp:835
void setTypePresolve(int value)
Definition: CbcModel.hpp:1490
int getNumberThreads() const
Get number of threads.
Definition: CbcModel.hpp:2042
void deleteObjects(bool findIntegers=true)
Delete all object information (and just back to integers if true)
int secondaryStatus() const
Secondary status of problem -1 unset (status_ will also be -1) 0 search completed with solution 1 lin...
Definition: CbcModel.hpp:972
bool setCutoffIncrement(double value)
Set the CbcModel::CbcCutoffIncrement desired.
Definition: CbcModel.hpp:718
bool setHeuristicGap(double value)
Set the heuristic gap between the best known solution and the best possible solution.
Definition: CbcModel.hpp:692
int numberStoppedSubTrees() const
Returns number of times any subtree stopped on nodes, time etc.
Definition: CbcModel.hpp:1475
bool isInteger(int colIndex) const
Return true if column is integer.
Definition: CbcModel.hpp:1123
CbcModel * findCliques(bool makeEquality, int atLeastThisMany, int lessThanThis, int defaultValue=1000)
Identify cliques and construct corresponding objects.
The maximum amount the value of an integer variable can vary from integer and still be considered fea...
Definition: CbcModel.hpp:134
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:147
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:1975
void setPreferredWay(int value)
Set global preferred way to branch -1 down, +1 up, 0 no preference.
Definition: CbcModel.hpp:790
void gutsOfDestructor()
Clears out as much as possible (except solver)
Simple Branch and bound class.
Definition: CbcModel.hpp:101
void saveExtraSolution(const double *solution, double objectiveValue)
Save a solution to saved list.
bool feasibleSolution(int &numberIntegerInfeasibilities, int &numberObjectInfeasibilities) const
Test the current solution for feasiblility.
void * temporaryPointer() const
Get useful temporary pointer.
Definition: CbcModel.hpp:1897
void findIntegers(bool startAgain, int type=0)
Identify integer variables and create corresponding objects.
void setStopNumberIterations(int value)
Set number of "iterations" to stop after.
Definition: CbcModel.hpp:1426
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:1793
void saveModel(OsiSolverInterface *saveSolver, double *checkCutoffForRestart, bool *feasible)
Save copy of the model.
int makeGlobalCut(const OsiRowCut *cut)
Make given cut into a global cut.
void setNextRowCut(const OsiRowCut &cut)
Copy and set a pointer to a row cut which will be added instead of normal branching.
CbcCutModifier * cutModifier() const
Get the current cut modifier method.
Definition: CbcModel.hpp:1520
bool useElapsedTime() const
Get time method.
Definition: CbcModel.hpp:1893
void originalModel(CbcModel *presolvedModel, bool weak)
Put back information into the original model after integer presolve.
OsiSolverInterface * solver() const
Returns solver - has current state.
Definition: CbcModel.hpp:1970
Strategy base class.
Definition: CbcStrategy.hpp:18
bool isSecondsLimitReached() const
Time limit reached?
int howOftenGlobalScan() const
Get how often to scan global cuts.
Definition: CbcModel.hpp:873
void pseudoShadow(int type)
Fill in useful estimates.
CbcTree * tree() const
Tree method e.g. heap (which may be overridden by inheritance)
Definition: CbcModel.hpp:1460
void passInSubTreeModel(CbcModel &model)
For passing in an CbcModel to do a sub Tree (with derived tree handlers).
virtual ~CbcModel()
Destructor.
int maximumSavedSolutions() const
Maximum number of extra saved solutions.
Definition: CbcModel.hpp:1337
A class to encapsulate thread stuff.
Definition: CbcThread.hpp:426
void mergeModels(int numberModel, CbcModel **model, int numberNodes)
Merge models.
CbcThread * masterThread() const
Get pointer to masterthread.
Definition: CbcModel.hpp:2034
void adjustHeuristics()
Adjust heuristics based on model.
bool isContinuousUnbounded() const
Was continuous solution unbounded.
double getHeuristicGap() const
Get the heuristic gap between the best known solution and the best possible solution.
Definition: CbcModel.hpp:698
void moveInfo(const CbcModel &rhs)
Move status, nodes etc etc across.
CbcCutGenerator * cutGenerator(int i) const
Get the specified cut generator.
Definition: CbcModel.hpp:1573
CbcStrategy * strategy() const
Get the current strategy.
Definition: CbcModel.hpp:1601
int currentDepth() const
Current depth.
Definition: CbcModel.hpp:866