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  * Ted Ralphs, Lehigh University *
11  * *
12  * Conceptual Design: *
13  * *
14  * Yan Xu, Lehigh University *
15  * Ted Ralphs, Lehigh University *
16  * Laszlo Ladanyi, IBM T.J. Watson Research Center *
17  * Matthew Saltzman, Clemson University *
18  * *
19  * *
20  * Copyright (C) 2001-2013, Lehigh University, Yan Xu, and Ted Ralphs. *
21  *===========================================================================*/
22 
23 #ifndef AbcModel_h_
24 #define AbcModel_h_
25 
26 //#############################################################################
27 // This file is modified from SbbModel.hpp
28 //#############################################################################
29 
30 #include <cmath>
31 
32 #include "CoinMessageHandler.hpp"
33 #include "CoinWarmStartBasis.hpp"
34 #include "OsiCuts.hpp"
35 #include "OsiSolverInterface.hpp"
36 
37 #include "AbcBranchActual.h"
38 #include "AbcCutGenerator.h"
39 #include "AbcHeuristic.h"
40 #include "AbcMessage.h"
41 #include "AlpsModel.h"
42 
43 #include "AbcParams.h"
44 
45 class CglCutGenerator;
46 
47 class AbcBranchDecision;
48 class AlpsTreeNode;
49 class AbcNodeDesc;
50 class AbcTreeNode;
51 
52 //#############################################################################
53 
55 class AbcModel : public AlpsModel {
56 
57  public:
58  enum AbcIntParam {
73  };
74 
75  enum AbcDblParam {
97  };
98 
99  private:
113 
116 
122 
125 
128 
131 
134 
140 
143 
146 
149 
151  double minimumDrop_;
152 
155 
157  double * bestSolution_;
158 
163 
166 
172  int status_;
179 
185 
193  // Cut generators
197  // Heuristic solvers
199 
204 
212  int * priority_;
217 
220 
221  public:
223  {
224  init();
225  }
226 
228  {
229  init();
230  solver_ = rhs.clone();
231  ourSolver_ = true ;
232  continuousSolver_ = 0;
233  int numberColumns = solver_->getNumCols();
234  int iColumn;
235  if (numberColumns) {
236  // Space for current solution
237  currentSolution_ = new double[numberColumns];
238  for (iColumn = 0; iColumn < numberColumns; ++iColumn) {
239  if( solver_->isInteger(iColumn))
240  numberIntegers_++;
241  }
242  } else {
243  // empty model
244  currentSolution_=NULL;
245  }
246  if (numberIntegers_) {
247  integerVariable_ = new int [numberIntegers_];
248  numberIntegers_=0;
249  for (iColumn=0;iColumn<numberColumns;iColumn++) {
250  if( solver_->isInteger(iColumn))
252  }
253  } else {
254  integerVariable_ = NULL;
255  }
256  }
257 
259  {
260  if ( handler_ != 0){
261  delete handler_;
262  handler_ = 0;
263  }
264  if (priority_ != 0) {
265  delete [] priority_;
266  priority_ = 0;
267  }
268  if (currentSolution_ != 0) {
269  delete [] currentSolution_;
270  currentSolution_ = 0;
271  }
272  if (bestSolution_ != 0) {
273  delete [] bestSolution_;
274  bestSolution_ = 0;
275  }
276  if (generator_ != 0) {
277  for (int i = 0; i < numberCutGenerators_; ++i)
278  delete generator_[i];
279  delete [] generator_;
280  generator_ = 0;
281  }
282  if (heuristic_ != 0) {
283  //for (int i = 0; i < numberHeuristics_; ++i) {
284  // if (heuristic_[i] != 0) {
285  //delete heuristic_[i];
286  //heuristic_[i] = 0;
287  // }
288  //}
289  delete [] heuristic_;
290  heuristic_ = 0;
291  }
292 
293  if (integerVariable_ != 0) {
294  delete [] integerVariable_;
295  integerVariable_ = 0;
296  }
297  if (sharedBasis_ != 0) {
298  delete sharedBasis_;
299  sharedBasis_ = 0;
300  }
301  if (basis_ != 0) {
302  delete basis_;
303  basis_ = 0;
304  }
305  if (pseudoList_ != NULL) {
306  int i = getNumCols() - 1;
307  for (; i >= 0; --i) {
308  //printf("i = %d\n", i);
309  delete pseudoList_[i];
310  }
311  delete [] pseudoList_;
312  }
313  if (pseudoIndices_ != NULL) {
314  delete [] pseudoIndices_;
315  }
316  /* Last thing is to delete solver */
317  if (ourSolver_) {
318  delete solver_ ;
319  solver_ = 0;
320  }
321  if (continuousSolver_ != 0) {
322  delete continuousSolver_ ;
323  continuousSolver_ = 0;
324  }
325  delete AbcPar_;
326  }
327 
329  void init()
330  {
332  numberIntegers_ = 0;
333  integerVariable_ = NULL;
334  sharedBasis_ = NULL;
336  handler_->setLogLevel(2);
337  defaultHandler_ = true;
338  messages_ = AbcMessage();
339  solver_ = NULL;
340  ourSolver_ = false;
341  basis_ = 0;
342  minimumDrop_ = 1.0e-4;
343  bestObjective_ = 1.0e100;
344  bestSolution_ = 0;
345  currentSolution_ = 0;
346  numberNodes_ = 0;
347  numberIterations_ = 0;
348  status_ = 0;
349  currentNumberCuts_ = 0;
350  maximumNumberCuts_ = 1000;
352  numberStrong_ = 0;
354  generator_ = NULL;
355  numberHeuristics_ = 0;
356  heuristic_ = NULL;
358  maximumCutPasses_ = 10;
359  branchingMethod_ = NULL;
360  numberSolutions_ = 0;
362  priority_ = NULL;
363  pseudoList_ = NULL;
364  pseudoIndices_ = NULL;
365 
366  continuousSolver_ = 0;
367 
368  // Set values for parameters
369  intParam_[AbcMaxNumNode] = 9999999;
370  intParam_[AbcMaxNumSol] = 9999999;
372 
376  dblParam_[AbcAllowableGap] = 1.0e-10;
377  dblParam_[AbcMaximumSeconds] = 1.0e100;
378  AbcPar_ = new AbcParams;
379  }
380 
382  virtual void readInstance(const char* dataFile)
383  {
384  solver()->readMps(dataFile, "");
385  }
386 
388  void readParameters(const int argnum, const char * const * arglist) {
389  std::cout << "Reading in ALPS parameters ..." << std::endl;
390  AlpsPar_->readFromArglist(argnum, arglist);
391  std::cout << "Reading in ABC parameters ..." << std::endl;
392  AbcPar_->readFromArglist(argnum, arglist);
393  }
394 
395  AbcParams *AbcPar() { return AbcPar_; }
396 
399  { return solver_; }
400 
406 
411  CoinWarmStartBasis *getEmptyBasis(int ns = 0, int na = 0) const;
412 
414  inline int numberIntegers() const
415  { return numberIntegers_; }
416 
418  inline const int * integerVariable() const
419  { return integerVariable_; }
420 
421  //-------------------------------------------------------------------------
423 
424 
427  void initialSolve();
428 
435  bool solveWithCuts( OsiCuts & cuts, int numberTries,
436  AbcTreeNode * node, int & numberOldActiveCuts,
437  int & numberNewCuts, int & maximumWhich,
438  int *& whichGenerator, const bool cutDuringRampup,
439  int & found );
440 
444  bool resolve();
446 
447  //-------------------------------------------------------------------------
449 
450  bool isAbandoned() const;
453  bool isProvenOptimal() const;
455  bool isProvenInfeasible() const;
457  bool isNodeLimitReached() const;
459  bool isSolutionLimitReached() const;
461  int getIterationCount() const
462  { return solver_->getIterationCount(); }
464  int getNodeCount() const
465  { return numberNodes_; }
467  void incrementNodeCount(int s = 1)
468  { numberNodes_ += s; }
469 
473  inline int status() const
474  { return status_; }
476 
477  //-------------------------------------------------------------------------
490  int numberRowsAtContinuous() const
492  { return numberRowsAtContinuous_; }
493 
494  void setNumberRowsAtContinous(const int value)
495  {
496  numberRowsAtContinuous_ = value;
497  }
498 
499 
501  int getNumCols() const
502  { return solver_->getNumCols(); }
503 
505  int getNumRows() const
506  { return solver_->getNumRows(); }
507 
509  int getNumElements() const
510  { return solver_->getNumElements(); }
511 
513  const double * getColLower() const
514  { return solver_->getColLower(); }
515 
517  const double * getColUpper() const
518  { return solver_->getColUpper(); }
519 
529  const char * getRowSense() const
530  { return solver_->getRowSense(); }
531 
540  const double * getRightHandSide() const
541  { return solver_->getRightHandSide(); }
542 
551  const double * getRowRange() const
552  { return solver_->getRowRange(); }
553 
555  const double * getRowLower() const
556  { return solver_->getRowLower(); }
557 
559  const double * getRowUpper() const
560  { return solver_->getRowUpper(); }
561 
563  const double * getObjCoefficients() const
564  { return solver_->getObjCoefficients(); }
565 
567  double getObjSense() const
568  { return solver_->getObjSense(); }
571 
573  int *getPseudoIndices() { return pseudoIndices_; }
574 
576  bool isContinuous(int colIndex) const
577  { return solver_->isContinuous(colIndex); }
578 
580  bool isBinary(int colIndex) const
581  { return solver_->isBinary(colIndex); }
582 
587  bool isInteger(int colIndex) const
588  { return solver_->isInteger(colIndex); }
589 
591  bool isIntegerNonBinary(int colIndex) const
592  { return solver_->isIntegerNonBinary(colIndex); }
593 
595  bool isFreeBinary(int colIndex) const
596  { return solver_->isFreeBinary(colIndex); }
597 
600  { return solver_->getMatrixByRow(); }
601 
604  { return solver_->getMatrixByCol(); }
605 
607  double getInfinity() const
608  { return solver_->getInfinity(); }
610 
618  double checkSolution(double cutoff,
619  const double * solution,
620  bool fixVariables);
621 
623  bool setBestSolution(ABC_Message how,
624  double & objectiveValue,
625  const double *solution,
626  bool fixVariables = false);
627 
633  bool feasibleSolution(int & numberIntegerInfeasibilities);
634 
639  inline double * currentSolution() const
640  { return currentSolution_; }
641 
643  const double * getColSolution() const
644  { return solver_->getColSolution(); }
645 
647  const double * getRowPrice() const
648  { return solver_->getRowPrice(); }
649 
651  const double * getReducedCost() const
652  { return solver_->getReducedCost(); }
653 
655  const double * getRowActivity() const
656  { return solver_->getRowActivity(); }
657 
659  double getCurrentObjValue() const
660  { return solver_->getObjValue(); }
661 
663  double getObjValue() const
664  { return bestObjective_; }
665 
668  void setObjValue(double obj)
669  { bestObjective_ = obj; }
670 
676  const double * bestSolution() const
677  { return bestSolution_; }
678 
680  int getSolutionCount() const
681  { return numberSolutions_; }
682 
684  void setSolutionCount(int value)
685  { numberSolutions_=value; }
686 
689  { return numberHeuristicSolutions_; }
690 
692  void setObjSense(double s) { solver_->setObjSense(s); }
693 
696  inline void setMaximumCutPassesAtRoot(int value)
697  {maximumCutPassesAtRoot_ = value; }
699  inline int getMaximumCutPassesAtRoot() const
700  { return maximumCutPassesAtRoot_; }
701 
704  inline void setMaximumCutPasses(int value)
705  { maximumCutPasses_ = value; }
707  inline int getMaximumCutPasses() const
708  { return maximumCutPasses_; }
710  int currentNumberCuts() const
711  { return currentNumberCuts_; }
712  void setCurrentNumberCuts(int value)
713  {
714  currentNumberCuts_ += value;
715  }
716 
718 
719  //-------------------------------------------------------------------------
720 
726  inline AbcBranchDecision * branchingMethod() const
728  { return branchingMethod_; }
730  inline void setBranchingMethod(AbcBranchDecision * method)
731  { branchingMethod_ = method; }
735  inline void setBranchingMethod(AbcBranchDecision & method)
736  { branchingMethod_ = &method; }
738 
739  //-------------------------------------------------------------------------
740 
745  {
746  if (defaultHandler_) {
747  delete handler_;
748  handler_ = NULL;
749  }
750  defaultHandler_ = false;
751  handler_ = handler;
752  }
753 
756  { messages_ = AbcMessage(language); }
758  { newLanguage(language); }
761  { return handler_; }
764  { return messages_; }
767  { return &messages_; }
769 
770  //-------------------------------------------------------------------------
771 
772  bool checkInteger(double value) const
773  {
774  double integerTolerance =
776  double nearest = floor(value + 0.5);
777  if (fabs(value - nearest) <= integerTolerance)
778  return true;
779  else
780  return false;
781  }
782 
789  void findIntegers(bool startAgain);
790 
798  void addCutGenerator(CglCutGenerator * generator,
799  int howOften=1, const char * name=NULL,
800  bool normal=true, bool atSolution=false,
801  bool infeasible=false);
804  void addHeuristic(AbcHeuristic * generator);
807 
812  void reducedCostFix() ;
813 
822  //void takeOffCuts(OsiCuts &cuts, int *whichGenerator,
823 // int &numberOldActiveCuts, int &numberNewCuts,
824  // bool allowResolve);
825  void takeOffCuts();
826 
828  inline bool setIntParam(AbcIntParam key, int value) {
829  intParam_[key] = value;
830  return true;
831  }
832 
834  inline bool setDblParam(AbcDblParam key, double value) {
835  dblParam_[key] = value;
836  return true;
837  }
838 
840  inline int getIntParam(AbcIntParam key) const {
841  return intParam_[key];
842  }
843 
845  inline double getDblParam(AbcDblParam key) const {
846  return dblParam_[key];
847  }
848 
853  void setCutoff(double value);
854 
856  inline double getCutoff() const
857  {
858  double value ;
860  return value * solver_->getObjSense() ;
861  }
862 
864  inline bool setMaximumNodes( int value)
865  { return setIntParam(AbcMaxNumNode,value); }
866 
868  inline int getMaximumNodes() const
869  { return getIntParam(AbcMaxNumNode); }
870 
875  inline bool setMaximumSolutions( int value) {
876  return setIntParam(AbcMaxNumSol,value);
877  }
882  inline int getMaximumSolutions() const {
883  return getIntParam(AbcMaxNumSol);
884  }
885 
889  inline bool setIntegerTolerance( double value) {
890  return setDblParam(AbcIntegerTolerance,value);
891  }
895  inline double getIntegerTolerance() const {
897  }
898 
903  inline bool setInfeasibilityWeight( double value) {
904  return setDblParam(AbcInfeasibilityWeight,value);
905  }
910  inline double getInfeasibilityWeight() const {
912  }
913 
917  inline bool setAllowableGap( double value) {
918  return setDblParam(AbcAllowableGap,value);
919  }
923  inline double getAllowableGap() const {
925  }
926 
928  inline void setMinimumDrop(double value)
929  { minimumDrop_=value; }
931  inline double getMinimumDrop() const
932  { return minimumDrop_; }
933 
934  //-------------------------------------------------------------------------
935 
937  virtual bool setupSelf();
938 
939  int numberStrong() const
940  { return numberStrong_; }
941 
942  void setNumberStrong(int number)
943  {
944  if (number<0)
945  numberStrong_=0;
946  else
947  numberStrong_=number;
948  }
949 
951  inline const int * priority() const { return priority_;}
952 
954  inline int priority(int sequence) const
955  {
956  if (priority_)
957  return priority_[sequence];
958  else
959  return 1000;
960  }
961 
963  virtual AlpsEncoded* encode() const;
964 
966  virtual void decodeToSelf(AlpsEncoded&);
967 
968 };
969 
970 //#############################################################################
971 
972 #endif
int numberHeuristics_
Number of heuristics.
Definition: AbcModel.h:196
int numberRowsAtContinuous() const
Number of rows in continuous (root) problem.
Definition: AbcModel.h:491
bool defaultHandler_
Flag to say if handler_ is the default handler.
Definition: AbcModel.h:121
bool setIntParam(AbcIntParam key, int value)
Set an integer parameter.
Definition: AbcModel.h:828
double getCurrentObjValue() const
Get current objective function value.
Definition: AbcModel.h:659
CoinMessages * messagesPointer()
Return pointer to messages.
Definition: AbcModel.h:766
virtual void setObjSense(double s)=0
Set the objective function sense.
void setSolutionCount(int value)
Set number of solutions (so heuristics will be different)
Definition: AbcModel.h:684
int getNumCols() const
Get number of columns.
Definition: AbcModel.h:501
int maximumNumberCuts_
Maximum number of cuts.
Definition: AbcModel.h:176
virtual const double * getReducedCost() const =0
Get a pointer to an array[getNumCols()] of reduced costs.
virtual const char * getRowSense() const =0
Get a pointer to an array[getNumRows()] of row constraint senses.
const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
Definition: AbcModel.h:599
virtual bool setupSelf()
Do necessary work to make model usable.
CoinMessageHandler * messageHandler() const
Return handler.
Definition: AbcModel.h:760
int getNumElements() const
Get number of nonzero elements.
Definition: AbcModel.h:509
double * currentSolution_
Array holding the current solution.
Definition: AbcModel.h:162
Base class for message handling.
const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
Definition: AbcModel.h:551
virtual const double * getRowLower() const =0
Get a pointer to an array[getNumRows()] of row lower bounds.
void setLanguage(CoinMessages::Language language)
Pass in Message handler (not deleted at end)
Definition: AbcModel.h:757
int getMaximumCutPasses() const
Get the maximum number of cut passes at other nodes (default 10)
Definition: AbcModel.h:707
int getSolutionCount() const
Get number of solutions.
Definition: AbcModel.h:680
bool isAbandoned() const
Are there a numerical difficulties?
virtual const double * getRowUpper() const =0
Get a pointer to an array[getNumRows()] of row upper bounds.
int maximumCutPassesAtRoot_
Maximum number of cut passes at root.
Definition: AbcModel.h:201
int * integerVariable_
Indices of integer variables.
Definition: AbcModel.h:109
void readParameters(const int argnum, const char *const *arglist)
Read in Alps and Abc parameters.
Definition: AbcModel.h:388
virtual const CoinPackedMatrix * getMatrixByRow() const =0
Get a pointer to a row-wise copy of the matrix.
virtual const double * getRightHandSide() const =0
Get a pointer to an array[getNumRows()] of row right-hand sides.
int * pseudoIndices_
Definition: AbcModel.h:216
int priority(int sequence) const
Returns priority level for an object (or 1000 if no priorities exist)
Definition: AbcModel.h:954
bool setIntegerTolerance(double value)
Set the integrality tolerance .
Definition: AbcModel.h:889
double getInfinity() const
Get solver&#39;s value for infinity.
Definition: AbcModel.h:607
virtual const double * getRowActivity() const =0
Get a pointer to array[getNumRows()] of row activity levels.
int getNodeCount() const
Get how many Nodes it took to solve the problem.
Definition: AbcModel.h:464
bool resolve()
Reoptimise an LP relaxation Invoke the solver&#39;s resolve() method.
AbcBranchDecision * branchingMethod_
Variable selection function.
Definition: AbcModel.h:206
int status() const
Final status of problem 0 finished, 1 stopped, 2 difficulties.
Definition: AbcModel.h:473
virtual const double * getColUpper() const =0
Get a pointer to an array[getNumCols()] of column upper bounds.
virtual int getNumCols() const =0
Get the number of columns.
int howOftenGlobalScan_
How often to scan global cuts.
Definition: AbcModel.h:178
Just a marker, so that a static sized array can store parameters.
Definition: AbcModel.h:96
double getIntegerTolerance() const
Get the integrality tolerance .
Definition: AbcModel.h:895
OsiCuts globalCuts_
Global cuts.
Definition: AbcModel.h:165
bool setBestSolution(ABC_Message how, double &objectiveValue, const double *solution, bool fixVariables=false)
Record a new incumbent solution and update objectiveValue.
CoinWarmStartBasis * lastws_
Pointer to last warm basis.
Definition: AbcModel.h:148
ABC_Message
This deals with Abc messages (as against Clp messages etc).
Definition: AbcMessage.h:46
const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
Definition: AbcModel.h:540
double minimumDrop_
Minimum degradation in objective value to continue cut generation.
Definition: AbcModel.h:151
CoinMessageHandler * handler_
Message handler.
Definition: AbcModel.h:115
Just a marker, so that a static sized array can store parameters.
Definition: AbcModel.h:72
virtual const double * getObjCoefficients() const =0
Get a pointer to an array[getNumCols()] of objective function coefficients.
const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
Definition: AbcModel.h:513
Sparse Matrix Base Class.
int maximumDepth_
Current limit on search tree depth.
Definition: AbcModel.h:184
virtual const double * getRowRange() const =0
Get a pointer to an array[getNumRows()] of row ranges.
CoinMessages messages()
Return messages.
Definition: AbcModel.h:763
Heuristic base class.
Definition: AbcHeuristic.h:41
void setBranchingMethod(AbcBranchDecision &method)
Set the branching method This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition: AbcModel.h:735
double getInfeasibilityWeight() const
Get the weight per integer infeasibility .
Definition: AbcModel.h:910
void incrementNodeCount(int s=1)
Increment the count of nodes.
Definition: AbcModel.h:467
AbcDblParam
Definition: AbcModel.h:75
virtual double getObjSense() const =0
Get the objective function sense.
int status_
Status of problem - 0 finished, 1 stopped, 2 difficulties.
Definition: AbcModel.h:172
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...
Collections of row cuts and column cuts.
Definition: OsiCuts.hpp:19
Stop when the gap between the objective value of the best known solution and the best bound on the ob...
Definition: AbcModel.h:91
bool isContinuous(int colIndex) const
Return true if variable is continuous.
Definition: AbcModel.h:576
int numberStrong() const
Definition: AbcModel.h:939
This data structure is to contain the packed form of an encodable knowledge.
Definition: AlpsEncoded.h:25
void takeOffCuts()
Remove inactive cuts from the model.
int numberSolutions_
Number of solutions.
Definition: AbcModel.h:208
AbcHeuristic ** heuristic_
Definition: AbcModel.h:198
virtual int readMps(const char *filename, const char *extension="mps")
Read a problem in MPS format from the given filename.
virtual int getNumElements() const =0
Get the number of nonzero elements.
AbcModel()
Definition: AbcModel.h:222
virtual bool getDblParam(OsiDblParam key, double &value) const
Get a double parameter.
The amount by which to tighten the objective function cutoff when a new solution is discovered...
Definition: AbcModel.h:84
bool isProvenInfeasible() const
Is infeasiblity proven (or none better than cutoff)?
OsiSolverInterface * solver_
The solver associated with this model.
Definition: AbcModel.h:133
void findIntegers(bool startAgain)
Identify integer variables and create corresponding objects.
AbcParams * AbcPar()
Definition: AbcModel.h:395
int numberNodes_
Cumulative number of nodes.
Definition: AbcModel.h:168
bool isInteger(int colIndex) const
Return true if column is integer.
Definition: AbcModel.h:587
int numberCutGenerators_
Number of cut generators.
Definition: AbcModel.h:192
const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
Definition: AbcModel.h:555
bool setMaximumSolutions(int value)
Set the maximum number of solutions desired.
Definition: AbcModel.h:875
int numberIntegers() const
Number of integers in problem.
Definition: AbcModel.h:414
CoinWarmStartBasis * basis_
Pointer to a warm start basis.
Definition: AbcModel.h:145
virtual double getObjValue() const =0
Get the objective function value.
int getMaximumCutPassesAtRoot() const
Get the maximum number of cut passes at root node.
Definition: AbcModel.h:699
int numberIntegers_
Number of integers in problem.
Definition: AbcModel.h:107
bool feasibleSolution(int &numberIntegerInfeasibilities)
Test the current solution for feasiblility.
virtual int getIterationCount() const =0
Get the number of iterations it took to solve the problem (whatever `iteration&#39; means to the solver)...
This class holds one node of the search tree.
Definition: AlpsTreeNode.h:50
void initialSolve()
Solve the initial LP relaxation Invoke the solver&#39;s initialSolve() method.
double * bestSolution_
Array holding the incumbent (best) solution.
Definition: AbcModel.h:157
virtual int getNumRows() const =0
Get the number of rows.
The maximum number of solutions before terminating.
Definition: AbcModel.h:62
int numberHeuristicSolutions_
Number of heuristic solutions.
Definition: AbcModel.h:210
void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
Definition: AbcModel.h:692
virtual bool isContinuous(int colIndex) const =0
Return true if the variable is continuous.
virtual const double * getColLower() const =0
Get a pointer to an array[getNumCols()] of column lower bounds.
const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
Definition: AbcModel.h:651
void passInMessageHandler(CoinMessageHandler *handler)
Pass in Message handler (not deleted at end)
Definition: AbcModel.h:744
CoinWarmStartBasis * sharedBasis_
Pointer to a warm start basis.
Definition: AbcModel.h:111
virtual const CoinPackedMatrix * getMatrixByCol() const =0
Get a pointer to a column-wise copy of the matrix.
const double * getRowPrice() const
Get pointer to array[getNumRows()] of dual prices.
Definition: AbcModel.h:647
int numberIterations_
Cumulative number of iterations.
Definition: AbcModel.h:170
virtual const double * getColSolution() const =0
Get a pointer to an array[getNumCols()] of primal variable values.
void setObjValue(double obj)
Set the best objective value.
Definition: AbcModel.h:668
bool ourSolver_
Ownership of the solver object The convention is that AbcModel owns the null solver.
Definition: AbcModel.h:139
virtual bool isBinary(int colIndex) const
Return true if the variable is binary.
AbcModel(const OsiSolverInterface &rhs)
Definition: AbcModel.h:227
AbcIntParam
Definition: AbcModel.h:58
const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
Definition: AbcModel.h:529
void addHeuristic(AbcHeuristic *generator)
Add one heuristic.
void readFromArglist(const int argnum, const char *const *arglist)
Read parameters from the command line.
This is a first attempt at a message handler.
const double * bestSolution() const
The best solution to the integer programming problem.
Definition: AbcModel.h:676
void setMinimumDrop(double value)
Set the minimum drop to continue cuts.
Definition: AbcModel.h:928
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.
double getMinimumDrop() const
Get the minimum drop to continue cuts.
Definition: AbcModel.h:931
Abstract Base Class for describing an interface to a solver.
int getNumberHeuristicSolutions() const
Get number of heuristic solutions.
Definition: AbcModel.h:688
const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
Definition: AbcModel.h:643
const int * integerVariable() const
Integer variables.
Definition: AbcModel.h:418
virtual AlpsEncoded * encode() const
The method that encodes the model into a encoded object.
int getIntParam(AbcIntParam key) const
Get an integer parameter.
Definition: AbcModel.h:840
bool isNodeLimitReached() const
Node limit reached?
Cut Generator Base Class.
The maximum number of nodes before terminating.
Definition: AbcModel.h:60
int intParam_[AbcLastIntParam]
Array for integer parameters.
Definition: AbcModel.h:127
bool setAllowableGap(double value)
Set the allowable gap between the best known solution and the best possible solution.
Definition: AbcModel.h:917
double * currentSolution() const
Solution to the most recent lp relaxation.
Definition: AbcModel.h:639
double getDblParam(AbcDblParam key) const
Get a double parameter.
Definition: AbcModel.h:845
OsiSolverInterface * solver() const
Returns solver - has current state.
Definition: AbcModel.h:398
bool isBinary(int colIndex) const
Return true if variable is binary.
Definition: AbcModel.h:580
const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
Definition: AbcModel.h:517
const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels.
Definition: AbcModel.h:655
OsiSolverInterface * continuousSolver_
A copy of the solver, taken at the continuous (root) node.
Definition: AbcModel.h:142
AbcCutGenerator ** generator_
Definition: AbcModel.h:194
Class to hold and manipulate an array of massaged messages.
AlpsParams * AlpsPar_
The parameter set that is used in Alps.
Definition: AlpsModel.h:52
int getNumRows() const
Get number of rows.
Definition: AbcModel.h:505
void setBranchingMethod(AbcBranchDecision *method)
Set the branching decision method.
Definition: AbcModel.h:730
Fathoming discipline Controls objective function comparisons for purposes of fathoming by bound or de...
Definition: AbcModel.h:70
bool checkInteger(double value) const
Definition: AbcModel.h:772
int numberStrong_
Maximum number of candidates to consider for strong branching.
Definition: AbcModel.h:190
virtual double getInfinity() const =0
Get the solver&#39;s value for infinity.
double bestObjective_
Best objective.
Definition: AbcModel.h:154
The objective is assumed to worsen by this amount for each integer infeasibility. ...
Definition: AbcModel.h:81
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:704
virtual OsiSolverInterface * clone(bool copyData=true) const =0
Clone.
AbcBranchDecision * branchingMethod() const
Get the current branching decision method.
Definition: AbcModel.h:727
int maximumCutPasses_
Maximum number of cut passes.
Definition: AbcModel.h:203
virtual void decodeToSelf(AlpsEncoded &)
The method that decodes the model from a encoded object.
int currentNumberCuts() const
Number of entries in the list returned by #addedCuts()
Definition: AbcModel.h:710
double getObjValue() const
Get best objective function value.
Definition: AbcModel.h:663
void setNumberRowsAtContinous(const int value)
Number of rows in continuous (root) problem.
Definition: AbcModel.h:494
int getIterationCount() const
Get how many iterations it took to solve the problem.
Definition: AbcModel.h:461
void setLogLevel(int value)
Set current log (detail) level.
virtual const double * getRowPrice() const =0
Get pointer to array[getNumRows()] of dual variable values.
virtual bool isInteger(int colIndex) const
Return true if the variable is integer.
int currentNumberCuts_
Number of entries in #addedCuts_.
Definition: AbcModel.h:174
virtual bool isFreeBinary(int colIndex) const
Return true if the variable is binary and not fixed.
void setCutoff(double value)
Set cutoff bound on the objective function. When using strict comparison, the bound is adjusted by a ...
CoinMessages messages_
Abc messages.
Definition: AbcModel.h:124
bool isIntegerNonBinary(int colIndex) const
Return true if variable is general integer.
Definition: AbcModel.h:591
void init()
Initialize member data.
Definition: AbcModel.h:329
virtual void readInstance(const char *dataFile)
Read in the problem data.
Definition: AbcModel.h:382
int getMaximumNodes() const
Get the maximum node limit .
Definition: AbcModel.h:868
const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
Definition: AbcModel.h:563
AbcPseudocost ** pseudoList_
Definition: AbcModel.h:214
void setCurrentNumberCuts(int value)
Call this to really test if a valid solution can be feasible Solution is number columns in size...
Definition: AbcModel.h:712
bool setInfeasibilityWeight(double value)
Set the weight per integer infeasibility .
Definition: AbcModel.h:903
The maximum number of seconds before terminating.
Definition: AbcModel.h:94
The maximum amount the value of an integer variable can vary from integer and still be considered fea...
Definition: AbcModel.h:78
double getCutoff() const
Get the cutoff bound on the objective function - always as minimize.
Definition: AbcModel.h:856
const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
Definition: AbcModel.h:603
const int * priority() const
Priorities.
Definition: AbcModel.h:951
double dblParam_[AbcLastDblParam]
Array for double parameters.
Definition: AbcModel.h:130
void newLanguage(CoinMessages::Language language)
Set language.
Definition: AbcModel.h:755
int * getPseudoIndices()
Number of rows in continuous (root) problem.
Definition: AbcModel.h:573
const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
Definition: AbcModel.h:559
Interface between Abc and Cut Generation Library.
void setNumberStrong(int number)
Definition: AbcModel.h:942
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:696
bool isSolutionLimitReached() const
Solution limit reached?
Abstract branching decision base class.
Definition: AbcBranchBase.h:50
bool isFreeBinary(int colIndex) const
Return true if variable is binary and not fixed at either bound.
Definition: AbcModel.h:595
bool setMaximumNodes(int value)
Set the maximum node limit .
Definition: AbcModel.h:864
bool isProvenOptimal() const
Is optimality proven?
virtual bool isIntegerNonBinary(int colIndex) const
Return true if the variable is general integer.
Language
Supported languages.
int * priority_
Priorities.
Definition: AbcModel.h:212
AbcParams * AbcPar_
Abc parameters.
Definition: AbcModel.h:219
~AbcModel()
Definition: AbcModel.h:258
Dual objective limit.
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...
AbcPseudocost ** getPseudoList()
Number of rows in continuous (root) problem.
Definition: AbcModel.h:570
The default COIN simplex (basis-oriented) warm start class.
Model class for ALPS Branch and Cut.
Definition: AbcModel.h:55
int numberRowsAtContinuous_
Number of rows at continuous.
Definition: AbcModel.h:105
bool setDblParam(AbcDblParam key, double value)
Set a double parameter.
Definition: AbcModel.h:834
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...
int getMaximumSolutions() const
Get the maximum number of solutions desired.
Definition: AbcModel.h:882
void reducedCostFix()
Perform reduced cost fixing Fixes integer variables at their current value based on reduced cost pena...
void assignSolver(OsiSolverInterface *&solver)
Assign a solver to the model (model assumes ownership) On return, solver will be NULL.
double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
Definition: AbcModel.h:567
double getAllowableGap() const
Get the allowable gap between the best known solution and the best possible solution.
Definition: AbcModel.h:923