Alps  2.0.2
AbcModel.h
Go to the documentation of this file.
1 /*===========================================================================*
2  * This file is part of the Abstract Library for Parallel Search (ALPS). *
3  * *
4  * ALPS is distributed under the Eclipse Public License as part of the *
5  * COIN-OR repository (http://www.coin-or.org). *
6  * *
7  * Authors: *
8  * *
9  * Yan Xu, Lehigh University *
10  * Aykut Bulut, Lehigh University *
11  * Ted Ralphs, Lehigh University *
12  * *
13  * Conceptual Design: *
14  * *
15  * Yan Xu, Lehigh University *
16  * Ted Ralphs, Lehigh University *
17  * Laszlo Ladanyi, IBM T.J. Watson Research Center *
18  * Matthew Saltzman, Clemson University *
19  * *
20  * *
21  * Copyright (C) 2001-2019, Lehigh University, Yan Xu, Aykut Bulut, and *
22  * Ted Ralphs. *
23  * All Rights Reserved. *
24  *===========================================================================*/
25 
26 
27 #ifndef AbcModel_h_
28 #define AbcModel_h_
29 
30 //#############################################################################
31 // This file is modified from SbbModel.hpp
32 //#############################################################################
33 
34 #include <cmath>
35 
36 #include "CoinMessageHandler.hpp"
37 #include "CoinWarmStartBasis.hpp"
38 #include "OsiCuts.hpp"
39 #include "OsiSolverInterface.hpp"
40 
41 #include "AbcBranchActual.h"
42 #include "AbcCutGenerator.h"
43 #include "AbcHeuristic.h"
44 #include "AbcMessage.h"
45 #include "AlpsModel.h"
46 
47 #include "AbcParams.h"
48 
49 class CglCutGenerator;
50 
51 class AbcBranchDecision;
52 class AlpsTreeNode;
53 class AbcNodeDesc;
54 class AbcTreeNode;
55 
56 //#############################################################################
57 
59 class AbcModel : public AlpsModel {
60 
61  public:
62  enum AbcIntParam {
64  AbcMaxNumNode=0,
77  };
78 
79  enum AbcDblParam {
101  };
102 
103  private:
111  int numberIntegers_;
113  int* integerVariable_;
115  CoinWarmStartBasis* sharedBasis_;
117 
119  CoinMessageHandler * handler_;
120 
125  bool defaultHandler_;
126 
128  CoinMessages messages_;
129 
132 
134  double dblParam_[AbcLastDblParam];
135 
137  OsiSolverInterface* solver_;
138 
143  bool ourSolver_;
144 
146  OsiSolverInterface * continuousSolver_;
147 
149  CoinWarmStartBasis* basis_;
150 
152  CoinWarmStartBasis* lastws_;
153 
155  double minimumDrop_;
156 
158  double bestObjective_;
159 
161  double * bestSolution_;
162 
166  double * currentSolution_;
167 
169  OsiCuts globalCuts_;
170 
172  int numberNodes_;
174  int numberIterations_;
176  int status_;
178  int currentNumberCuts_;
180  int maximumNumberCuts_;
183 
188  int maximumDepth_;
189 
194  int numberStrong_;
197  // Cut generators
200  int numberHeuristics_;
201  // Heuristic solvers
203 
207  int maximumCutPasses_;
208 
212  int numberSolutions_;
216  int * priority_;
220  int *pseudoIndices_;
221 
224 
225  public:
227  {
228  init();
229  }
230 
231  AbcModel(const OsiSolverInterface &rhs)
232  {
233  init();
234  solver_ = rhs.clone();
235  ourSolver_ = true ;
236  continuousSolver_ = 0;
237  int numberColumns = solver_->getNumCols();
238  int iColumn;
239  if (numberColumns) {
240  // Space for current solution
241  currentSolution_ = new double[numberColumns];
242  for (iColumn = 0; iColumn < numberColumns; ++iColumn) {
243  if( solver_->isInteger(iColumn))
244  numberIntegers_++;
245  }
246  } else {
247  // empty model
248  currentSolution_=NULL;
249  }
250  if (numberIntegers_) {
251  integerVariable_ = new int [numberIntegers_];
252  numberIntegers_=0;
253  for (iColumn=0;iColumn<numberColumns;iColumn++) {
254  if( solver_->isInteger(iColumn))
256  }
257  } else {
258  integerVariable_ = NULL;
259  }
260  }
261 
262  virtual ~AbcModel()
263  {
264  if ( handler_ != 0){
265  delete handler_;
266  handler_ = 0;
267  }
268  if (priority_ != 0) {
269  delete [] priority_;
270  priority_ = 0;
271  }
272  if (currentSolution_ != 0) {
273  delete [] currentSolution_;
274  currentSolution_ = 0;
275  }
276  if (bestSolution_ != 0) {
277  delete [] bestSolution_;
278  bestSolution_ = 0;
279  }
280  if (generator_ != 0) {
281  for (int i = 0; i < numberCutGenerators_; ++i)
282  delete generator_[i];
283  delete [] generator_;
284  generator_ = 0;
285  }
286  if (heuristic_ != 0) {
287  //for (int i = 0; i < numberHeuristics_; ++i) {
288  // if (heuristic_[i] != 0) {
289  //delete heuristic_[i];
290  //heuristic_[i] = 0;
291  // }
292  //}
293  delete [] heuristic_;
294  heuristic_ = 0;
295  }
296 
297  if (integerVariable_ != 0) {
298  delete [] integerVariable_;
299  integerVariable_ = 0;
300  }
301  if (sharedBasis_ != 0) {
302  delete sharedBasis_;
303  sharedBasis_ = 0;
304  }
305  if (basis_ != 0) {
306  delete basis_;
307  basis_ = 0;
308  }
309  if (pseudoList_ != NULL) {
310  int i = getNumCols() - 1;
311  for (; i >= 0; --i) {
312  //printf("i = %d\n", i);
313  delete pseudoList_[i];
314  }
315  delete [] pseudoList_;
316  }
317  if (pseudoIndices_ != NULL) {
318  delete [] pseudoIndices_;
319  }
320  /* Last thing is to delete solver */
321  if (ourSolver_) {
322  delete solver_ ;
323  solver_ = 0;
324  }
325  if (continuousSolver_ != 0) {
326  delete continuousSolver_ ;
327  continuousSolver_ = 0;
328  }
329  delete AbcPar_;
330  }
331 
333  void init()
334  {
336  numberIntegers_ = 0;
337  integerVariable_ = NULL;
338  sharedBasis_ = NULL;
339  handler_ = new CoinMessageHandler();
340  handler_->setLogLevel(2);
341  defaultHandler_ = true;
342  messages_ = AbcMessage();
343  solver_ = NULL;
344  ourSolver_ = false;
345  basis_ = 0;
346  minimumDrop_ = 1.0e-4;
347  bestObjective_ = 1.0e100;
348  bestSolution_ = 0;
349  currentSolution_ = 0;
350  numberNodes_ = 0;
351  numberIterations_ = 0;
352  status_ = 0;
353  currentNumberCuts_ = 0;
354  maximumNumberCuts_ = 1000;
356  numberStrong_ = 0;
358  generator_ = NULL;
359  numberHeuristics_ = 0;
360  heuristic_ = NULL;
362  maximumCutPasses_ = 10;
363  branchingMethod_ = NULL;
364  numberSolutions_ = 0;
366  priority_ = NULL;
367  pseudoList_ = NULL;
368  pseudoIndices_ = NULL;
369 
370  continuousSolver_ = 0;
371 
372  // Set values for parameters
373  intParam_[AbcMaxNumNode] = 9999999;
374  intParam_[AbcMaxNumSol] = 9999999;
376 
380  dblParam_[AbcAllowableGap] = 1.0e-10;
381  dblParam_[AbcMaximumSeconds] = 1.0e100;
382  AbcPar_ = new AbcParams;
383  }
384 
386  virtual void readInstance(const char* dataFile)
387  {
388  solver()->readMps(dataFile, "");
389  }
390 
392  void readParameters(const int argnum, const char * const * arglist) {
393  std::cout << "Reading in ALPS parameters ..." << std::endl;
394  AlpsPar_->readFromArglist(argnum, arglist);
395  std::cout << "Reading in ABC parameters ..." << std::endl;
396  AbcPar_->readFromArglist(argnum, arglist);
397  }
398 
399  AbcParams *AbcPar() { return AbcPar_; }
400 
402  OsiSolverInterface * solver() const
403  { return solver_; }
404 
409  void assignSolver(OsiSolverInterface *&solver);
410 
415  CoinWarmStartBasis *getEmptyBasis(int ns = 0, int na = 0) const;
416 
418  inline int numberIntegers() const
419  { return numberIntegers_; }
420 
422  inline const int * integerVariable() const
423  { return integerVariable_; }
424 
425  //-------------------------------------------------------------------------
427 
428 
431  void initialSolve();
432 
439  bool solveWithCuts( OsiCuts & cuts, int numberTries,
440  AbcTreeNode * node, int & numberOldActiveCuts,
441  int & numberNewCuts, int & maximumWhich,
442  int *& whichGenerator, const bool cutDuringRampup,
443  int & found );
444 
448  bool resolve();
450 
451  //-------------------------------------------------------------------------
453 
454  bool isAbandoned() const;
457  bool isProvenOptimal() const;
459  bool isProvenInfeasible() const;
461  bool isNodeLimitReached() const;
463  bool isSolutionLimitReached() const;
465  int getIterationCount() const
466  { return solver_->getIterationCount(); }
468  int getNodeCount() const
469  { return numberNodes_; }
471  void incrementNodeCount(int s = 1)
472  { numberNodes_ += s; }
473 
477  inline int status() const
478  { return status_; }
480 
481  //-------------------------------------------------------------------------
494  int numberRowsAtContinuous() const
496  { return numberRowsAtContinuous_; }
497 
498  void setNumberRowsAtContinous(const int value)
499  {
500  numberRowsAtContinuous_ = value;
501  }
502 
503 
505  int getNumCols() const
506  { return solver_->getNumCols(); }
507 
509  int getNumRows() const
510  { return solver_->getNumRows(); }
511 
513  int getNumElements() const
514  { return solver_->getNumElements(); }
515 
517  const double * getColLower() const
518  { return solver_->getColLower(); }
519 
521  const double * getColUpper() const
522  { return solver_->getColUpper(); }
523 
533  const char * getRowSense() const
534  { return solver_->getRowSense(); }
535 
544  const double * getRightHandSide() const
545  { return solver_->getRightHandSide(); }
546 
555  const double * getRowRange() const
556  { return solver_->getRowRange(); }
557 
559  const double * getRowLower() const
560  { return solver_->getRowLower(); }
561 
563  const double * getRowUpper() const
564  { return solver_->getRowUpper(); }
565 
567  const double * getObjCoefficients() const
568  { return solver_->getObjCoefficients(); }
569 
571  double getObjSense() const
572  { return solver_->getObjSense(); }
575 
577  int *getPseudoIndices() { return pseudoIndices_; }
578 
580  bool isContinuous(int colIndex) const
581  { return solver_->isContinuous(colIndex); }
582 
584  bool isBinary(int colIndex) const
585  { return solver_->isBinary(colIndex); }
586 
591  bool isInteger(int colIndex) const
592  { return solver_->isInteger(colIndex); }
593 
595  bool isIntegerNonBinary(int colIndex) const
596  { return solver_->isIntegerNonBinary(colIndex); }
597 
599  bool isFreeBinary(int colIndex) const
600  { return solver_->isFreeBinary(colIndex); }
601 
603  const CoinPackedMatrix * getMatrixByRow() const
604  { return solver_->getMatrixByRow(); }
605 
607  const CoinPackedMatrix * getMatrixByCol() const
608  { return solver_->getMatrixByCol(); }
609 
611  double getInfinity() const
612  { return solver_->getInfinity(); }
614 
622  double checkSolution(double cutoff,
623  const double * solution,
624  bool fixVariables);
625 
627  bool setBestSolution(ABC_Message how,
628  double & objectiveValue,
629  const double *solution,
630  bool fixVariables = false);
631 
637  bool feasibleSolution(int & numberIntegerInfeasibilities);
638 
643  inline double * currentSolution() const
644  { return currentSolution_; }
645 
647  const double * getColSolution() const
648  { return solver_->getColSolution(); }
649 
651  const double * getRowPrice() const
652  { return solver_->getRowPrice(); }
653 
655  const double * getReducedCost() const
656  { return solver_->getReducedCost(); }
657 
659  const double * getRowActivity() const
660  { return solver_->getRowActivity(); }
661 
663  double getCurrentObjValue() const
664  { return solver_->getObjValue(); }
665 
667  double getObjValue() const
668  { return bestObjective_; }
669 
672  void setObjValue(double obj)
673  { bestObjective_ = obj; }
674 
680  const double * bestSolution() const
681  { return bestSolution_; }
682 
684  int getSolutionCount() const
685  { return numberSolutions_; }
686 
688  void setSolutionCount(int value)
689  { numberSolutions_=value; }
690 
693  { return numberHeuristicSolutions_; }
694 
696  void setObjSense(double s) { solver_->setObjSense(s); }
697 
700  inline void setMaximumCutPassesAtRoot(int value)
701  {maximumCutPassesAtRoot_ = value; }
703  inline int getMaximumCutPassesAtRoot() const
704  { return maximumCutPassesAtRoot_; }
705 
708  inline void setMaximumCutPasses(int value)
709  { maximumCutPasses_ = value; }
711  inline int getMaximumCutPasses() const
712  { return maximumCutPasses_; }
714  int currentNumberCuts() const
715  { return currentNumberCuts_; }
716  void setCurrentNumberCuts(int value)
717  {
718  currentNumberCuts_ += value;
719  }
720 
722 
723  //-------------------------------------------------------------------------
724 
730  inline AbcBranchDecision * branchingMethod() const
732  { return branchingMethod_; }
734  inline void setBranchingMethod(AbcBranchDecision * method)
735  { branchingMethod_ = method; }
739  inline void setBranchingMethod(AbcBranchDecision & method)
740  { branchingMethod_ = &method; }
742 
743  //-------------------------------------------------------------------------
744 
747  void passInMessageHandler(CoinMessageHandler * handler)
749  {
750  if (defaultHandler_) {
751  delete handler_;
752  handler_ = NULL;
753  }
754  defaultHandler_ = false;
755  handler_ = handler;
756  }
757 
759  void newLanguage(CoinMessages::Language language)
760  { messages_ = AbcMessage(language); }
761  void setLanguage(CoinMessages::Language language)
762  { newLanguage(language); }
764  CoinMessageHandler * messageHandler() const
765  { return handler_; }
767  CoinMessages messages()
768  { return messages_; }
770  CoinMessages * messagesPointer()
771  { return &messages_; }
773 
774  //-------------------------------------------------------------------------
775 
776  bool checkInteger(double value) const
777  {
778  double integerTolerance =
780  double nearest = floor(value + 0.5);
781  if (fabs(value - nearest) <= integerTolerance)
782  return true;
783  else
784  return false;
785  }
786 
793  void findIntegers(bool startAgain);
794 
802  void addCutGenerator(CglCutGenerator * generator,
803  int howOften=1, const char * name=NULL,
804  bool normal=true, bool atSolution=false,
805  bool infeasible=false);
808  void addHeuristic(AbcHeuristic * generator);
811 
816  void reducedCostFix() ;
817 
826  //void takeOffCuts(OsiCuts &cuts, int *whichGenerator,
827 // int &numberOldActiveCuts, int &numberNewCuts,
828  // bool allowResolve);
829  void takeOffCuts();
830 
832  inline bool setIntParam(AbcIntParam key, int value) {
833  intParam_[key] = value;
834  return true;
835  }
836 
838  inline bool setDblParam(AbcDblParam key, double value) {
839  dblParam_[key] = value;
840  return true;
841  }
842 
844  inline int getIntParam(AbcIntParam key) const {
845  return intParam_[key];
846  }
847 
849  inline double getDblParam(AbcDblParam key) const {
850  return dblParam_[key];
851  }
852 
857  void setCutoff(double value);
858 
860  inline double getCutoff() const
861  {
862  double value ;
863  solver_->getDblParam(OsiDualObjectiveLimit, value) ;
864  return value * solver_->getObjSense() ;
865  }
866 
868  inline bool setMaximumNodes( int value)
869  { return setIntParam(AbcMaxNumNode,value); }
870 
872  inline int getMaximumNodes() const
873  { return getIntParam(AbcMaxNumNode); }
874 
879  inline bool setMaximumSolutions( int value) {
880  return setIntParam(AbcMaxNumSol,value);
881  }
886  inline int getMaximumSolutions() const {
887  return getIntParam(AbcMaxNumSol);
888  }
889 
893  inline bool setIntegerTolerance( double value) {
894  return setDblParam(AbcIntegerTolerance,value);
895  }
899  inline double getIntegerTolerance() const {
901  }
902 
907  inline bool setInfeasibilityWeight( double value) {
908  return setDblParam(AbcInfeasibilityWeight,value);
909  }
914  inline double getInfeasibilityWeight() const {
916  }
917 
921  inline bool setAllowableGap( double value) {
922  return setDblParam(AbcAllowableGap,value);
923  }
927  inline double getAllowableGap() const {
929  }
930 
932  inline void setMinimumDrop(double value)
933  { minimumDrop_=value; }
935  inline double getMinimumDrop() const
936  { return minimumDrop_; }
937 
938  //-------------------------------------------------------------------------
939 
940  virtual AlpsTreeNode * createRoot();
941 
943  virtual bool setupSelf();
944 
945  int numberStrong() const
946  { return numberStrong_; }
947 
948  void setNumberStrong(int number)
949  {
950  if (number<0)
951  numberStrong_=0;
952  else
953  numberStrong_=number;
954  }
955 
957  inline const int * priority() const { return priority_;}
958 
960  inline int priority(int sequence) const
961  {
962  if (priority_)
963  return priority_[sequence];
964  else
965  return 1000;
966  }
967 
968  using AlpsKnowledge::encode;
970  virtual AlpsReturnStatus encode(AlpsEncoded * encoded) const;
972  virtual AlpsReturnStatus decodeToSelf(AlpsEncoded & encoded);
976  virtual AlpsKnowledge * decode(AlpsEncoded & encoded) const;
977 
978 private:
980  AbcModel(AbcModel const &);
982  AbcModel & operator=(AbcModel const &);
983 
984 };
985 
986 //#############################################################################
987 
988 #endif
AbcModel::AbcInfeasibilityWeight
@ AbcInfeasibilityWeight
The objective is assumed to worsen by this amount for each integer infeasibility.
Definition: AbcModel.h:85
AbcModel::~AbcModel
virtual ~AbcModel()
Definition: AbcModel.h:262
AbcModel::setDblParam
bool setDblParam(AbcDblParam key, double value)
Set a double parameter.
Definition: AbcModel.h:838
AbcModel::addCutGenerator
void addCutGenerator(CglCutGenerator *generator, int howOften=1, const char *name=NULL, bool normal=true, bool atSolution=false, bool infeasible=false)
Add one generator - up to user to delete generators.
AbcModel::numberStrong
int numberStrong() const
Definition: AbcModel.h:945
AlpsModel.h
AbcModel::getPseudoIndices
int * getPseudoIndices()
Definition: AbcModel.h:577
AbcModel::isNodeLimitReached
bool isNodeLimitReached() const
Node limit reached?
AbcModel::decodeToSelf
virtual AlpsReturnStatus decodeToSelf(AlpsEncoded &encoded)
Decode the given AlpsEncoded object into this.
AbcModel::bestObjective_
double bestObjective_
Best objective.
Definition: AbcModel.h:158
AlpsParameterSet::readFromArglist
void readFromArglist(const int argnum, const char *const *arglist)
Read parameters from the command line.
AbcBranchDecision
Abstract branching decision base class.
Definition: AbcBranchBase.h:54
AbcModel::AbcMaxNumSol
@ AbcMaxNumSol
The maximum number of solutions before terminating.
Definition: AbcModel.h:66
AbcModel::setMaximumCutPassesAtRoot
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: AbcModel.h:700
AbcModel::isProvenOptimal
bool isProvenOptimal() const
Is optimality proven?
AbcModel::heuristic_
AbcHeuristic ** heuristic_
Definition: AbcModel.h:202
AlpsModel
AlpsModel is a base class for user application problem data.
Definition: AlpsModel.h:132
AbcModel::currentSolution
double * currentSolution() const
Solution to the most recent lp relaxation.
Definition: AbcModel.h:643
AbcParams
Definition: AbcParams.h:37
AbcModel::getDblParam
double getDblParam(AbcDblParam key) const
Get a double parameter.
Definition: AbcModel.h:849
AbcPseudocost
Definition: AbcBranchActual.h:115
AlpsReturnStatus
AlpsReturnStatus
Definition: Alps.h:261
AbcModel::getInfinity
double getInfinity() const
Get solver's value for infinity.
Definition: AbcModel.h:611
AbcModel::dblParam_
double dblParam_[AbcLastDblParam]
Array for double parameters.
Definition: AbcModel.h:134
AbcModel::getMinimumDrop
double getMinimumDrop() const
Get the minimum drop to continue cuts.
Definition: AbcModel.h:935
AbcModel::AbcMaxNumNode
@ AbcMaxNumNode
The maximum number of nodes before terminating.
Definition: AbcModel.h:64
AbcModel::getObjSense
double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
Definition: AbcModel.h:571
AbcModel::numberRowsAtContinuous_
int numberRowsAtContinuous_
Number of rows at continuous.
Definition: AbcModel.h:109
AbcCutGenerator.h
AbcModel::getMaximumCutPasses
int getMaximumCutPasses() const
Get the maximum number of cut passes at other nodes (default 10)
Definition: AbcModel.h:711
AbcModel::ourSolver_
bool ourSolver_
Ownership of the solver object The convention is that AbcModel owns the null solver.
Definition: AbcModel.h:143
AbcModel::setObjSense
void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
Definition: AbcModel.h:696
AbcModel::currentSolution_
double * currentSolution_
Array holding the current solution.
Definition: AbcModel.h:166
AbcModel::bestSolution
const double * bestSolution() const
The best solution to the integer programming problem.
Definition: AbcModel.h:680
AbcModel::passInMessageHandler
void passInMessageHandler(CoinMessageHandler *handler)
Pass in Message handler (not deleted at end)
Definition: AbcModel.h:748
AbcModel::status
int status() const
Final status of problem 0 finished, 1 stopped, 2 difficulties.
Definition: AbcModel.h:477
AbcModel::getColUpper
const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
Definition: AbcModel.h:521
AbcModel::getNumberHeuristicSolutions
int getNumberHeuristicSolutions() const
Get number of heuristic solutions.
Definition: AbcModel.h:692
AbcModel::getInfeasibilityWeight
double getInfeasibilityWeight() const
Get the weight per integer infeasibility .
Definition: AbcModel.h:914
AbcModel::getRowSense
const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
Definition: AbcModel.h:533
AbcModel::setNumberRowsAtContinous
void setNumberRowsAtContinous(const int value)
Definition: AbcModel.h:498
AbcModel::getRowUpper
const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
Definition: AbcModel.h:563
AbcModel::takeOffCuts
void takeOffCuts()
Remove inactive cuts from the model.
AbcModel::bestSolution_
double * bestSolution_
Array holding the incumbent (best) solution.
Definition: AbcModel.h:161
AbcModel::lastws_
CoinWarmStartBasis * lastws_
Pointer to last warm basis.
Definition: AbcModel.h:152
AlpsEncoded
Definition: AlpsEncoded.h:64
AbcModel::pseudoIndices_
int * pseudoIndices_
Definition: AbcModel.h:220
AbcModel::getMatrixByRow
const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
Definition: AbcModel.h:603
AbcModel::status_
int status_
Status of problem - 0 finished, 1 stopped, 2 difficulties.
Definition: AbcModel.h:176
AbcModel::maximumDepth_
int maximumDepth_
Current limit on search tree depth.
Definition: AbcModel.h:188
ABC_Message
ABC_Message
This deals with Abc messages (as against Clp messages etc).
Definition: AbcMessage.h:50
AbcModel::getIntegerTolerance
double getIntegerTolerance() const
Get the integrality tolerance .
Definition: AbcModel.h:899
AbcModel::getMaximumSolutions
int getMaximumSolutions() const
Get the maximum number of solutions desired.
Definition: AbcModel.h:886
AbcModel::currentNumberCuts_
int currentNumberCuts_
Number of entries in #addedCuts_.
Definition: AbcModel.h:178
AbcModel::maximumCutPasses_
int maximumCutPasses_
Maximum number of cut passes.
Definition: AbcModel.h:207
AbcBranchActual.h
AbcModel::generator_
AbcCutGenerator ** generator_
Definition: AbcModel.h:198
AbcModel::priority
int priority(int sequence) const
Returns priority level for an object (or 1000 if no priorities exist)
Definition: AbcModel.h:960
AbcModel::getNodeCount
int getNodeCount() const
Get how many Nodes it took to solve the problem.
Definition: AbcModel.h:468
AbcModel::isContinuous
bool isContinuous(int colIndex) const
Return true if variable is continuous.
Definition: AbcModel.h:580
AbcModel::operator=
AbcModel & operator=(AbcModel const &)
Disable copy assignment operator.
AbcModel::getMaximumCutPassesAtRoot
int getMaximumCutPassesAtRoot() const
Get the maximum number of cut passes at root node.
Definition: AbcModel.h:703
AbcModel::getRowRange
const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
Definition: AbcModel.h:555
AlpsTreeNode
This class holds one node of the search tree.
Definition: AlpsTreeNode.h:52
AbcModel::numberIntegers_
int numberIntegers_
Number of integers in problem.
Definition: AbcModel.h:111
AbcModel::numberHeuristicSolutions_
int numberHeuristicSolutions_
Number of heuristic solutions.
Definition: AbcModel.h:214
AbcModel::addHeuristic
void addHeuristic(AbcHeuristic *generator)
Add one heuristic.
AbcModel::isIntegerNonBinary
bool isIntegerNonBinary(int colIndex) const
Return true if variable is general integer.
Definition: AbcModel.h:595
AbcModel::reducedCostFix
void reducedCostFix()
Perform reduced cost fixing Fixes integer variables at their current value based on reduced cost pena...
AbcModel::numberCutGenerators_
int numberCutGenerators_
Number of cut generators.
Definition: AbcModel.h:196
AbcModel::setMaximumNodes
bool setMaximumNodes(int value)
Set the maximum node limit .
Definition: AbcModel.h:868
AbcModel::resolve
bool resolve()
Reoptimise an LP relaxation Invoke the solver's resolve() method.
AbcModel::setCurrentNumberCuts
void setCurrentNumberCuts(int value)
Definition: AbcModel.h:716
AbcModel::setIntParam
bool setIntParam(AbcIntParam key, int value)
Set an integer parameter.
Definition: AbcModel.h:832
AbcModel::sharedBasis_
CoinWarmStartBasis * sharedBasis_
Pointer to a warm start basis.
Definition: AbcModel.h:115
AbcModel::setLanguage
void setLanguage(CoinMessages::Language language)
Definition: AbcModel.h:761
AbcModel::getEmptyBasis
CoinWarmStartBasis * getEmptyBasis(int ns=0, int na=0) const
Return an empty basis object of the specified size A useful utility when constructing a basis for a s...
AbcModel::getRightHandSide
const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
Definition: AbcModel.h:544
AbcModel::numberSolutions_
int numberSolutions_
Number of solutions.
Definition: AbcModel.h:212
AbcModel::getRowLower
const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
Definition: AbcModel.h:559
AbcModel::priority_
int * priority_
Priorities.
Definition: AbcModel.h:216
AbcModel::getIterationCount
int getIterationCount() const
Get how many iterations it took to solve the problem.
Definition: AbcModel.h:465
AbcModel::AbcAllowableGap
@ AbcAllowableGap
Stop when the gap between the objective value of the best known solution and the best bound on the ob...
Definition: AbcModel.h:95
AbcModel::setMinimumDrop
void setMinimumDrop(double value)
Set the minimum drop to continue cuts.
Definition: AbcModel.h:932
AbcModel::numberRowsAtContinuous
int numberRowsAtContinuous() const
Number of rows in continuous (root) problem.
Definition: AbcModel.h:495
AbcModel::intParam_
int intParam_[AbcLastIntParam]
Array for integer parameters.
Definition: AbcModel.h:131
AbcModel::getColLower
const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
Definition: AbcModel.h:517
AbcModel::maximumCutPassesAtRoot_
int maximumCutPassesAtRoot_
Maximum number of cut passes at root.
Definition: AbcModel.h:205
AbcModel::setIntegerTolerance
bool setIntegerTolerance(double value)
Set the integrality tolerance .
Definition: AbcModel.h:893
AbcMessage.h
AbcModel::messages
CoinMessages messages()
Return messages.
Definition: AbcModel.h:767
AbcModel::setBranchingMethod
void setBranchingMethod(AbcBranchDecision &method)
Set the branching method This is an overloaded member function, provided for convenience....
Definition: AbcModel.h:739
AbcModel::getSolutionCount
int getSolutionCount() const
Get number of solutions.
Definition: AbcModel.h:684
AbcModel::findIntegers
void findIntegers(bool startAgain)
Identify integer variables and create corresponding objects.
AbcModel::solver
OsiSolverInterface * solver() const
Returns solver - has current state.
Definition: AbcModel.h:402
AbcModel::assignSolver
void assignSolver(OsiSolverInterface *&solver)
Assign a solver to the model (model assumes ownership) On return, solver will be NULL.
AbcModel::priority
const int * priority() const
Priorities.
Definition: AbcModel.h:957
AbcModel::isInteger
bool isInteger(int colIndex) const
Return true if column is integer.
Definition: AbcModel.h:591
AbcModel::getObjValue
double getObjValue() const
Get best objective function value.
Definition: AbcModel.h:667
AlpsModel::AlpsPar_
AlpsParams * AlpsPar_
The parameter set that is used in Alps.
Definition: AlpsModel.h:143
AbcModel::messagesPointer
CoinMessages * messagesPointer()
Return pointer to messages.
Definition: AbcModel.h:770
AbcModel::AbcLastIntParam
@ AbcLastIntParam
Just a marker, so that a static sized array can store parameters.
Definition: AbcModel.h:76
AbcModel::getAllowableGap
double getAllowableGap() const
Get the allowable gap between the best known solution and the best possible solution.
Definition: AbcModel.h:927
AbcModel::getRowPrice
const double * getRowPrice() const
Get pointer to array[getNumRows()] of dual prices.
Definition: AbcModel.h:651
AbcModel::numberNodes_
int numberNodes_
Cumulative number of nodes.
Definition: AbcModel.h:172
AlpsKnowledge
The abstract base class of Alps knowledges generated during the search.
Definition: AlpsKnowledge.h:63
AbcModel::integerVariable_
int * integerVariable_
Indices of integer variables.
Definition: AbcModel.h:113
AbcModel::readParameters
void readParameters(const int argnum, const char *const *arglist)
Read in Alps and Abc parameters.
Definition: AbcModel.h:392
AbcModel::setBestSolution
bool setBestSolution(ABC_Message how, double &objectiveValue, const double *solution, bool fixVariables=false)
Record a new incumbent solution and update objectiveValue.
AbcModel::isSolutionLimitReached
bool isSolutionLimitReached() const
Solution limit reached?
AbcModel::AbcLastDblParam
@ AbcLastDblParam
Just a marker, so that a static sized array can store parameters.
Definition: AbcModel.h:100
AbcModel::numberStrong_
int numberStrong_
Maximum number of candidates to consider for strong branching.
Definition: AbcModel.h:194
AbcModel::getNumCols
int getNumCols() const
Get number of columns.
Definition: AbcModel.h:505
AbcModel::AbcFathomDiscipline
@ AbcFathomDiscipline
Fathoming discipline Controls objective function comparisons for purposes of fathoming by bound or de...
Definition: AbcModel.h:74
AlpsKnowledge::encode
AlpsEncoded * encode() const
Encode the content of this into an AlpsEncoded object and return a pointer to it.
AbcModel::getRowActivity
const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels.
Definition: AbcModel.h:659
AbcModel::globalCuts_
OsiCuts globalCuts_
Global cuts.
Definition: AbcModel.h:169
AbcModel::decode
virtual AlpsKnowledge * decode(AlpsEncoded &encoded) const
Decode the given AlpsEncoded object into a new AlpsKnowledge object and.
AbcTreeNode
Definition: AbcTreeNode.h:47
AbcModel::getCutoff
double getCutoff() const
Get the cutoff bound on the objective function - always as minimize.
Definition: AbcModel.h:860
AbcModel::AbcModel
AbcModel(const OsiSolverInterface &rhs)
Definition: AbcModel.h:231
AbcModel::setMaximumSolutions
bool setMaximumSolutions(int value)
Set the maximum number of solutions desired.
Definition: AbcModel.h:879
AbcModel::handler_
CoinMessageHandler * handler_
Message handler.
Definition: AbcModel.h:119
AbcModel::checkInteger
bool checkInteger(double value) const
Definition: AbcModel.h:776
AbcModel::isFreeBinary
bool isFreeBinary(int colIndex) const
Return true if variable is binary and not fixed at either bound.
Definition: AbcModel.h:599
AbcModel::AbcMaximumSeconds
@ AbcMaximumSeconds
The maximum number of seconds before terminating.
Definition: AbcModel.h:98
AbcModel::solveWithCuts
bool solveWithCuts(OsiCuts &cuts, int numberTries, AbcTreeNode *node, int &numberOldActiveCuts, int &numberNewCuts, int &maximumWhich, int *&whichGenerator, const bool cutDuringRampup, int &found)
Evaluate a subproblem using cutting planes and heuristics The method invokes a main loop which genera...
AbcModel::getMatrixByCol
const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
Definition: AbcModel.h:607
AbcNodeDesc
Definition: AbcNodeDesc.h:52
AbcModel::isBinary
bool isBinary(int colIndex) const
Return true if variable is binary.
Definition: AbcModel.h:584
AbcModel::setInfeasibilityWeight
bool setInfeasibilityWeight(double value)
Set the weight per integer infeasibility .
Definition: AbcModel.h:907
AbcHeuristic
Heuristic base class.
Definition: AbcHeuristic.h:45
AbcModel::messageHandler
CoinMessageHandler * messageHandler() const
Return handler.
Definition: AbcModel.h:764
AbcModel::numberIntegers
int numberIntegers() const
Number of integers in problem.
Definition: AbcModel.h:418
AbcModel
Model class for ALPS Branch and Cut.
Definition: AbcModel.h:59
AbcModel::basis_
CoinWarmStartBasis * basis_
Pointer to a warm start basis.
Definition: AbcModel.h:149
AbcModel::continuousSolver_
OsiSolverInterface * continuousSolver_
A copy of the solver, taken at the continuous (root) node.
Definition: AbcModel.h:146
AbcModel::getColSolution
const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
Definition: AbcModel.h:647
AbcModel::getReducedCost
const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
Definition: AbcModel.h:655
AbcModel::branchingMethod
AbcBranchDecision * branchingMethod() const
Get the current branching decision method.
Definition: AbcModel.h:731
AbcModel::numberHeuristics_
int numberHeuristics_
Number of heuristics.
Definition: AbcModel.h:200
AbcModel::setMaximumCutPasses
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: AbcModel.h:708
AbcModel::minimumDrop_
double minimumDrop_
Minimum degradation in objective value to continue cut generation.
Definition: AbcModel.h:155
AbcModel::getObjCoefficients
const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
Definition: AbcModel.h:567
AbcModel::branchingMethod_
AbcBranchDecision * branchingMethod_
Variable selection function.
Definition: AbcModel.h:210
AbcModel::currentNumberCuts
int currentNumberCuts() const
Number of entries in the list returned by #addedCuts()
Definition: AbcModel.h:714
AbcModel::integerVariable
const int * integerVariable() const
Integer variables.
Definition: AbcModel.h:422
AbcModel::initialSolve
void initialSolve()
Solve the initial LP relaxation Invoke the solver's initialSolve() method.
AbcModel::readInstance
virtual void readInstance(const char *dataFile)
Read in the problem data.
Definition: AbcModel.h:386
AbcModel::feasibleSolution
bool feasibleSolution(int &numberIntegerInfeasibilities)
Test the current solution for feasiblility.
AbcModel::defaultHandler_
bool defaultHandler_
Flag to say if handler_ is the default handler.
Definition: AbcModel.h:125
AbcModel::incrementNodeCount
void incrementNodeCount(int s=1)
Increment the count of nodes.
Definition: AbcModel.h:471
AbcHeuristic.h
AbcModel::setSolutionCount
void setSolutionCount(int value)
Set number of solutions (so heuristics will be different)
Definition: AbcModel.h:688
AbcModel::AbcModel
AbcModel()
Definition: AbcModel.h:226
AbcModel::howOftenGlobalScan_
int howOftenGlobalScan_
How often to scan global cuts.
Definition: AbcModel.h:182
AbcModel::getNumElements
int getNumElements() const
Get number of nonzero elements.
Definition: AbcModel.h:513
AbcModel::AbcPar_
AbcParams * AbcPar_
Abc parameters.
Definition: AbcModel.h:223
AbcCutGenerator
Interface between Abc and Cut Generation Library.
Definition: AbcCutGenerator.h:73
AbcModel::checkSolution
double checkSolution(double cutoff, const double *solution, bool fixVariables)
Call this to really test if a valid solution can be feasible Solution is number columns in size.
AbcModel::AbcDblParam
AbcDblParam
Definition: AbcModel.h:79
AbcModel::maximumNumberCuts_
int maximumNumberCuts_
Maximum number of cuts.
Definition: AbcModel.h:180
AbcModel::setupSelf
virtual bool setupSelf()
Do necessary work to make model usable.
AbcModel::getIntParam
int getIntParam(AbcIntParam key) const
Get an integer parameter.
Definition: AbcModel.h:844
AbcModel::newLanguage
void newLanguage(CoinMessages::Language language)
Set language.
Definition: AbcModel.h:759
AbcModel::AbcIntParam
AbcIntParam
Definition: AbcModel.h:62
AbcModel::setNumberStrong
void setNumberStrong(int number)
Definition: AbcModel.h:948
AbcModel::getPseudoList
AbcPseudocost ** getPseudoList()
Definition: AbcModel.h:574
AbcModel::init
void init()
Initialize member data.
Definition: AbcModel.h:333
AbcModel::getMaximumNodes
int getMaximumNodes() const
Get the maximum node limit .
Definition: AbcModel.h:872
AbcModel::getCurrentObjValue
double getCurrentObjValue() const
Get current objective function value.
Definition: AbcModel.h:663
AbcModel::setObjValue
void setObjValue(double obj)
Set the best objective value.
Definition: AbcModel.h:672
AbcModel::messages_
CoinMessages messages_
Abc messages.
Definition: AbcModel.h:128
AbcModel::AbcCutoffIncrement
@ AbcCutoffIncrement
The amount by which to tighten the objective function cutoff when a new solution is discovered.
Definition: AbcModel.h:88
AbcParams.h
AbcModel::getNumRows
int getNumRows() const
Get number of rows.
Definition: AbcModel.h:509
AbcModel::isProvenInfeasible
bool isProvenInfeasible() const
Is infeasiblity proven (or none better than cutoff)?
AbcModel::solver_
OsiSolverInterface * solver_
The solver associated with this model.
Definition: AbcModel.h:137
AbcModel::AbcPar
AbcParams * AbcPar()
Definition: AbcModel.h:399
AbcModel::AbcIntegerTolerance
@ AbcIntegerTolerance
The maximum amount the value of an integer variable can vary from integer and still be considered fea...
Definition: AbcModel.h:82
AbcModel::pseudoList_
AbcPseudocost ** pseudoList_
Definition: AbcModel.h:218
AbcModel::setAllowableGap
bool setAllowableGap(double value)
Set the allowable gap between the best known solution and the best possible solution.
Definition: AbcModel.h:921
AbcModel::numberIterations_
int numberIterations_
Cumulative number of iterations.
Definition: AbcModel.h:174
AbcModel::setCutoff
void setCutoff(double value)
Set cutoff bound on the objective function.
AbcModel::isAbandoned
bool isAbandoned() const
Are there a numerical difficulties?
AbcMessage
Definition: AbcMessage.h:81
AbcModel::createRoot
virtual AlpsTreeNode * createRoot()
Create the root node.
AbcModel::setBranchingMethod
void setBranchingMethod(AbcBranchDecision *method)
Set the branching decision method.
Definition: AbcModel.h:734