- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 {
60 AbcMaxNumNode=0,
62 AbcMaxNumSol,
70 AbcFathomDiscipline,
72 AbcLastIntParam
73 };
74
75 enum AbcDblParam {
78 AbcIntegerTolerance = 0,
81 AbcInfeasibilityWeight,
84 AbcCutoffIncrement,
91 AbcAllowableGap,
94 AbcMaximumSeconds,
96 AbcLastDblParam
97 };
98
99 private:
103 int numberRowsAtContinuous_;
107 int numberIntegers_;
109 int* integerVariable_;
111 CoinWarmStartBasis* sharedBasis_;
113
115 CoinMessageHandler * handler_;
116
121 bool defaultHandler_;
122
124 CoinMessages messages_;
125
127 int intParam_[AbcLastIntParam];
128
130 double dblParam_[AbcLastDblParam];
131
133 OsiSolverInterface* solver_;
134
139 bool ourSolver_;
140
142 OsiSolverInterface * continuousSolver_;
143
145 CoinWarmStartBasis* basis_;
146
148 CoinWarmStartBasis* lastws_;
149
151 double minimumDrop_;
152
154 double bestObjective_;
155
157 double * bestSolution_;
158
162 double * currentSolution_;
163
165 OsiCuts globalCuts_;
166
168 int numberNodes_;
170 int numberIterations_;
172 int status_;
174 int currentNumberCuts_;
176 int maximumNumberCuts_;
178 int howOftenGlobalScan_;
179
184 int maximumDepth_;
185
190 int numberStrong_;
192 int numberCutGenerators_;
193 // Cut generators
194 AbcCutGenerator ** generator_;
196 int numberHeuristics_;
197 // Heuristic solvers
198 AbcHeuristic ** heuristic_;
199
201 int maximumCutPassesAtRoot_;
203 int maximumCutPasses_;
204
206 AbcBranchDecision * branchingMethod_;
208 int numberSolutions_;
210 int numberHeuristicSolutions_;
212 int * priority_;
214 AbcPseudocost **pseudoList_;
216 int *pseudoIndices_;
217
219 AbcParams *AbcPar_;
220
221 public:
222 AbcModel()
223 {
224 init();
225 }
226
227 AbcModel(const OsiSolverInterface &rhs)
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))
251 integerVariable_[numberIntegers_++]=iColumn;
252 }
253 } else {
254 integerVariable_ = NULL;
255 }
256 }
257
258 ~AbcModel()
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 {
331 numberRowsAtContinuous_ = 0;
332 numberIntegers_ = 0;
333 integerVariable_ = NULL;
334 sharedBasis_ = NULL;
335 handler_ = new CoinMessageHandler();
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;
351 howOftenGlobalScan_ = 1;
352 numberStrong_ = 0;
353 numberCutGenerators_ =0;
354 generator_ = NULL;
355 numberHeuristics_ = 0;
356 heuristic_ = NULL;
357 maximumCutPassesAtRoot_ = 20;
358 maximumCutPasses_ = 10;
359 branchingMethod_ = NULL;
360 numberSolutions_ = 0;
361 numberHeuristicSolutions_ = 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;
371 intParam_[AbcFathomDiscipline] = 0;
372
373 dblParam_[AbcIntegerTolerance] = 1e-6;
374 dblParam_[AbcInfeasibilityWeight] = 0.0;
375 dblParam_[AbcCutoffIncrement] = 1e-5;
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
398 OsiSolverInterface * solver() const
399 { return solver_; }
400
405 void assignSolver(OsiSolverInterface *&solver);
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(); }
570 AbcPseudocost ** getPseudoList() { return pseudoList_; }
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
599 const CoinPackedMatrix * getMatrixByRow() const
600 { return solver_->getMatrixByRow(); }
601
603 const CoinPackedMatrix * getMatrixByCol() const
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
688 int getNumberHeuristicSolutions() const
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
743 void passInMessageHandler(CoinMessageHandler * handler)
745 {
746 if (defaultHandler_) {
747 delete handler_;
748 handler_ = NULL;
749 }
750 defaultHandler_ = false;
751 handler_ = handler;
752 }
753
755 void newLanguage(CoinMessages::Language language)
756 { messages_ = AbcMessage(language); }
757 void setLanguage(CoinMessages::Language language)
758 { newLanguage(language); }
760 CoinMessageHandler * messageHandler() const
761 { return handler_; }
763 CoinMessages messages()
764 { return messages_; }
766 CoinMessages * messagesPointer()
767 { return &messages_; }
769
770 //-------------------------------------------------------------------------
771
772 bool checkInteger(double value) const
773 {
774 double integerTolerance =
775 getDblParam(AbcModel::AbcIntegerTolerance);
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 ;
859 solver_->getDblParam(OsiDualObjectiveLimit, 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 {
896 return getDblParam(AbcIntegerTolerance);
897 }
898
903 inline bool setInfeasibilityWeight( double value) {
904 return setDblParam(AbcInfeasibilityWeight,value);
905 }
910 inline double getInfeasibilityWeight() const {
911 return getDblParam(AbcInfeasibilityWeight);
912 }
913
917 inline bool setAllowableGap( double value) {
918 return setDblParam(AbcAllowableGap,value);
919 }
923 inline double getAllowableGap() const {
924 return getDblParam(AbcAllowableGap);
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
AbcModel::numberHeuristics_
int numberHeuristics_
Number of heuristics.
Definition: AbcModel.h:196
AbcModel::numberRowsAtContinuous
int numberRowsAtContinuous() const
Number of rows in continuous (root) problem.
Definition: AbcModel.h:491
AbcModel::defaultHandler_
bool defaultHandler_
Flag to say if handler_ is the default handler.
Definition: AbcModel.h:121
AbcModel::setIntParam
bool setIntParam(AbcIntParam key, int value)
Set an integer parameter.
Definition: AbcModel.h:828
AbcModel::getCurrentObjValue
double getCurrentObjValue() const
Get current objective function value.
Definition: AbcModel.h:659
AbcModel::messagesPointer
CoinMessages * messagesPointer()
Return pointer to messages.
Definition: AbcModel.h:766
OsiSolverInterface::setObjSense
virtual void setObjSense(double s)=0
Set the objective function sense.
AbcModel::setSolutionCount
void setSolutionCount(int value)
Set number of solutions (so heuristics will be different)
Definition: AbcModel.h:684
AbcModel::getNumCols
int getNumCols() const
Get number of columns.
Definition: AbcModel.h:501
AbcModel::maximumNumberCuts_
int maximumNumberCuts_
Maximum number of cuts.
Definition: AbcModel.h:176
OsiSolverInterface::getReducedCost
virtual const double * getReducedCost() const =0
Get a pointer to an array[getNumCols()] of reduced costs.
OsiSolverInterface::getRowSense
virtual const char * getRowSense() const =0
Get a pointer to an array[getNumRows()] of row constraint senses.
AbcModel::getMatrixByRow
const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
Definition: AbcModel.h:599
AbcModel::setupSelf
virtual bool setupSelf()
Do necessary work to make model usable.
AbcModel::messageHandler
CoinMessageHandler * messageHandler() const
Return handler.
Definition: AbcModel.h:760
AbcModel::getNumElements
int getNumElements() const
Get number of nonzero elements.
Definition: AbcModel.h:509
AbcModel::currentSolution_
double * currentSolution_
Array holding the current solution.
Definition: AbcModel.h:162
CoinMessageHandler
Base class for message handling.
Definition: CoinMessageHandler.hpp:327
AbcModel::getRowRange
const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
Definition: AbcModel.h:551
AbcHeuristic.h
OsiSolverInterface::getRowLower
virtual const double * getRowLower() const =0
Get a pointer to an array[getNumRows()] of row lower bounds.
AbcModel::setLanguage
void setLanguage(CoinMessages::Language language)
Pass in Message handler (not deleted at end)
Definition: AbcModel.h:757
AbcModel::getMaximumCutPasses
int getMaximumCutPasses() const
Get the maximum number of cut passes at other nodes (default 10)
Definition: AbcModel.h:707
AbcModel::getSolutionCount
int getSolutionCount() const
Get number of solutions.
Definition: AbcModel.h:680
AbcModel::isAbandoned
bool isAbandoned() const
Are there a numerical difficulties?
OsiSolverInterface::getRowUpper
virtual const double * getRowUpper() const =0
Get a pointer to an array[getNumRows()] of row upper bounds.
AbcModel::maximumCutPassesAtRoot_
int maximumCutPassesAtRoot_
Maximum number of cut passes at root.
Definition: AbcModel.h:201
AbcModel::integerVariable_
int * integerVariable_
Indices of integer variables.
Definition: AbcModel.h:109
AbcModel::readParameters
void readParameters(const int argnum, const char *const *arglist)
Read in Alps and Abc parameters.
Definition: AbcModel.h:388
OsiSolverInterface::getMatrixByRow
virtual const CoinPackedMatrix * getMatrixByRow() const =0
Get a pointer to a row-wise copy of the matrix.
AbcTreeNode
Definition: AbcTreeNode.h:43
OsiSolverInterface::getRightHandSide
virtual const double * getRightHandSide() const =0
Get a pointer to an array[getNumRows()] of row right-hand sides.
AbcModel::pseudoIndices_
int * pseudoIndices_
Definition: AbcModel.h:216
AbcModel::priority
int priority(int sequence) const
Returns priority level for an object (or 1000 if no priorities exist)
Definition: AbcModel.h:954
AbcModel::setIntegerTolerance
bool setIntegerTolerance(double value)
Set the integrality tolerance .
Definition: AbcModel.h:889
AbcModel::getInfinity
double getInfinity() const
Get solver&#39;s value for infinity.
Definition: AbcModel.h:607
OsiSolverInterface::getRowActivity
virtual const double * getRowActivity() const =0
Get a pointer to array[getNumRows()] of row activity levels.
AbcModel::getNodeCount
int getNodeCount() const
Get how many Nodes it took to solve the problem.
Definition: AbcModel.h:464
AbcModel::resolve
bool resolve()
Reoptimise an LP relaxation Invoke the solver&#39;s resolve() method.
AbcModel::branchingMethod_
AbcBranchDecision * branchingMethod_
Variable selection function.
Definition: AbcModel.h:206
AbcModel::status
int status() const
Final status of problem 0 finished, 1 stopped, 2 difficulties.
Definition: AbcModel.h:473
OsiSolverInterface::getColUpper
virtual const double * getColUpper() const =0
Get a pointer to an array[getNumCols()] of column upper bounds.
OsiSolverInterface::getNumCols
virtual int getNumCols() const =0
Get the number of columns.
AbcModel::howOftenGlobalScan_
int howOftenGlobalScan_
How often to scan global cuts.
Definition: AbcModel.h:178
AbcParams
Definition: AbcParams.h:33
AbcModel::AbcLastDblParam
Just a marker, so that a static sized array can store parameters.
Definition: AbcModel.h:96
AbcModel::getIntegerTolerance
double getIntegerTolerance() const
Get the integrality tolerance .
Definition: AbcModel.h:895
AlpsModel.h
AbcModel::globalCuts_
OsiCuts globalCuts_
Global cuts.
Definition: AbcModel.h:165
AbcBranchActual.h
AbcModel::setBestSolution
bool setBestSolution(ABC_Message how, double &objectiveValue, const double *solution, bool fixVariables=false)
Record a new incumbent solution and update objectiveValue.
AbcModel::lastws_
CoinWarmStartBasis * lastws_
Pointer to last warm basis.
Definition: AbcModel.h:148
ABC_Message
ABC_Message
This deals with Abc messages (as against Clp messages etc).
Definition: AbcMessage.h:46
AbcModel::getRightHandSide
const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
Definition: AbcModel.h:540
AbcModel::minimumDrop_
double minimumDrop_
Minimum degradation in objective value to continue cut generation.
Definition: AbcModel.h:151
AbcModel::handler_
CoinMessageHandler * handler_
Message handler.
Definition: AbcModel.h:115
AbcModel::AbcLastIntParam
Just a marker, so that a static sized array can store parameters.
Definition: AbcModel.h:72
OsiSolverInterface::getObjCoefficients
virtual const double * getObjCoefficients() const =0
Get a pointer to an array[getNumCols()] of objective function coefficients.
AbcModel::getColLower
const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
Definition: AbcModel.h:513
AlpsModel
Definition: AlpsModel.h:36
CoinPackedMatrix
Sparse Matrix Base Class.
Definition: CoinPackedMatrix.hpp:79
AbcModel::maximumDepth_
int maximumDepth_
Current limit on search tree depth.
Definition: AbcModel.h:184
OsiSolverInterface::getRowRange
virtual const double * getRowRange() const =0
Get a pointer to an array[getNumRows()] of row ranges.
AbcModel::messages
CoinMessages messages()
Return messages.
Definition: AbcModel.h:763
AbcHeuristic
Heuristic base class.
Definition: AbcHeuristic.h:41
AbcModel::setBranchingMethod
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
AbcModel::getInfeasibilityWeight
double getInfeasibilityWeight() const
Get the weight per integer infeasibility .
Definition: AbcModel.h:910
AbcModel::incrementNodeCount
void incrementNodeCount(int s=1)
Increment the count of nodes.
Definition: AbcModel.h:467
AbcModel::AbcDblParam
AbcDblParam
Definition: AbcModel.h:75
OsiSolverInterface::getObjSense
virtual double getObjSense() const =0
Get the objective function sense.
AbcModel::status_
int status_
Status of problem - 0 finished, 1 stopped, 2 difficulties.
Definition: AbcModel.h:172
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...
OsiCuts
Collections of row cuts and column cuts.
Definition: OsiCuts.hpp:19
AbcModel::AbcAllowableGap
Stop when the gap between the objective value of the best known solution and the best bound on the ob...
Definition: AbcModel.h:91
AbcModel::isContinuous
bool isContinuous(int colIndex) const
Return true if variable is continuous.
Definition: AbcModel.h:576
AbcModel::numberStrong
int numberStrong() const
Definition: AbcModel.h:939
AlpsEncoded
This data structure is to contain the packed form of an encodable knowledge.
Definition: AlpsEncoded.h:25
AbcModel::takeOffCuts
void takeOffCuts()
Remove inactive cuts from the model.
AbcModel::numberSolutions_
int numberSolutions_
Number of solutions.
Definition: AbcModel.h:208
AbcModel::heuristic_
AbcHeuristic ** heuristic_
Definition: AbcModel.h:198
OsiSolverInterface::readMps
virtual int readMps(const char *filename, const char *extension="mps")
Read a problem in MPS format from the given filename.
OsiSolverInterface::getNumElements
virtual int getNumElements() const =0
Get the number of nonzero elements.
AbcModel::AbcModel
AbcModel()
Definition: AbcModel.h:222
OsiSolverInterface::getDblParam
virtual bool getDblParam(OsiDblParam key, double &value) const
Get a double parameter.
Definition: OsiSolverInterface.hpp:313
AbcModel::AbcCutoffIncrement
The amount by which to tighten the objective function cutoff when a new solution is discovered...
Definition: AbcModel.h:84
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:133
AbcModel::findIntegers
void findIntegers(bool startAgain)
Identify integer variables and create corresponding objects.
AbcModel::AbcPar
AbcParams * AbcPar()
Definition: AbcModel.h:395
AbcMessage.h
AbcModel::numberNodes_
int numberNodes_
Cumulative number of nodes.
Definition: AbcModel.h:168
AbcModel::isInteger
bool isInteger(int colIndex) const
Return true if column is integer.
Definition: AbcModel.h:587
AbcModel::numberCutGenerators_
int numberCutGenerators_
Number of cut generators.
Definition: AbcModel.h:192
AbcModel::getRowLower
const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
Definition: AbcModel.h:555
AbcModel::setMaximumSolutions
bool setMaximumSolutions(int value)
Set the maximum number of solutions desired.
Definition: AbcModel.h:875
AbcModel::numberIntegers
int numberIntegers() const
Number of integers in problem.
Definition: AbcModel.h:414
AbcModel::basis_
CoinWarmStartBasis * basis_
Pointer to a warm start basis.
Definition: AbcModel.h:145
OsiSolverInterface::getObjValue
virtual double getObjValue() const =0
Get the objective function value.
AbcModel::getMaximumCutPassesAtRoot
int getMaximumCutPassesAtRoot() const
Get the maximum number of cut passes at root node.
Definition: AbcModel.h:699
AbcModel::numberIntegers_
int numberIntegers_
Number of integers in problem.
Definition: AbcModel.h:107
AbcModel::feasibleSolution
bool feasibleSolution(int &numberIntegerInfeasibilities)
Test the current solution for feasiblility.
OsiSolverInterface::getIterationCount
virtual int getIterationCount() const =0
Get the number of iterations it took to solve the problem (whatever `iteration&#39; means to the solver)...
AlpsTreeNode
This class holds one node of the search tree.
Definition: AlpsTreeNode.h:50
AbcModel::initialSolve
void initialSolve()
Solve the initial LP relaxation Invoke the solver&#39;s initialSolve() method.
AbcModel::bestSolution_
double * bestSolution_
Array holding the incumbent (best) solution.
Definition: AbcModel.h:157
OsiSolverInterface::getNumRows
virtual int getNumRows() const =0
Get the number of rows.
AbcNodeDesc
Definition: AbcNodeDesc.h:48
AbcModel::AbcMaxNumSol
The maximum number of solutions before terminating.
Definition: AbcModel.h:62
AbcModel::numberHeuristicSolutions_
int numberHeuristicSolutions_
Number of heuristic solutions.
Definition: AbcModel.h:210
AbcModel::setObjSense
void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
Definition: AbcModel.h:692
OsiSolverInterface::isContinuous
virtual bool isContinuous(int colIndex) const =0
Return true if the variable is continuous.
OsiSolverInterface::getColLower
virtual const double * getColLower() const =0
Get a pointer to an array[getNumCols()] of column lower bounds.
AbcModel::getReducedCost
const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
Definition: AbcModel.h:651
AbcModel::passInMessageHandler
void passInMessageHandler(CoinMessageHandler *handler)
Pass in Message handler (not deleted at end)
Definition: AbcModel.h:744
AbcModel::sharedBasis_
CoinWarmStartBasis * sharedBasis_
Pointer to a warm start basis.
Definition: AbcModel.h:111
OsiSolverInterface::getMatrixByCol
virtual const CoinPackedMatrix * getMatrixByCol() const =0
Get a pointer to a column-wise copy of the matrix.
AbcModel::getRowPrice
const double * getRowPrice() const
Get pointer to array[getNumRows()] of dual prices.
Definition: AbcModel.h:647
AbcModel::numberIterations_
int numberIterations_
Cumulative number of iterations.
Definition: AbcModel.h:170
OsiSolverInterface::getColSolution
virtual const double * getColSolution() const =0
Get a pointer to an array[getNumCols()] of primal variable values.
AbcModel::setObjValue
void setObjValue(double obj)
Set the best objective value.
Definition: AbcModel.h:668
AbcModel::ourSolver_
bool ourSolver_
Ownership of the solver object The convention is that AbcModel owns the null solver.
Definition: AbcModel.h:139
OsiSolverInterface::isBinary
virtual bool isBinary(int colIndex) const
Return true if the variable is binary.
AbcModel::AbcModel
AbcModel(const OsiSolverInterface &rhs)
Definition: AbcModel.h:227
AbcModel::AbcIntParam
AbcIntParam
Definition: AbcModel.h:58
AbcModel::getRowSense
const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
Definition: AbcModel.h:529
AbcPseudocost
Definition: AbcBranchActual.h:111
AbcModel::addHeuristic
void addHeuristic(AbcHeuristic *generator)
Add one heuristic.
AlpsParameterSet::readFromArglist
void readFromArglist(const int argnum, const char *const *arglist)
Read parameters from the command line.
CoinMessageHandler.hpp
This is a first attempt at a message handler.
AbcModel::bestSolution
const double * bestSolution() const
The best solution to the integer programming problem.
Definition: AbcModel.h:676
AbcModel::setMinimumDrop
void setMinimumDrop(double value)
Set the minimum drop to continue cuts.
Definition: AbcModel.h:928
OsiSolverInterface.hpp
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::getMinimumDrop
double getMinimumDrop() const
Get the minimum drop to continue cuts.
Definition: AbcModel.h:931
OsiSolverInterface
Abstract Base Class for describing an interface to a solver.
Definition: OsiSolverInterface.hpp:62
CoinWarmStartBasis.hpp
AbcModel::getNumberHeuristicSolutions
int getNumberHeuristicSolutions() const
Get number of heuristic solutions.
Definition: AbcModel.h:688
AbcModel::getColSolution
const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
Definition: AbcModel.h:643
AbcModel::integerVariable
const int * integerVariable() const
Integer variables.
Definition: AbcModel.h:418
AbcModel::encode
virtual AlpsEncoded * encode() const
The method that encodes the model into a encoded object.
AbcModel::getIntParam
int getIntParam(AbcIntParam key) const
Get an integer parameter.
Definition: AbcModel.h:840
AbcModel::isNodeLimitReached
bool isNodeLimitReached() const
Node limit reached?
CglCutGenerator
Cut Generator Base Class.
Definition: CglCutGenerator.hpp:23
AbcModel::AbcMaxNumNode
The maximum number of nodes before terminating.
Definition: AbcModel.h:60
AbcModel::intParam_
int intParam_[AbcLastIntParam]
Array for integer parameters.
Definition: AbcModel.h:127
AbcModel::setAllowableGap
bool setAllowableGap(double value)
Set the allowable gap between the best known solution and the best possible solution.
Definition: AbcModel.h:917
AbcModel::currentSolution
double * currentSolution() const
Solution to the most recent lp relaxation.
Definition: AbcModel.h:639
AbcModel::getDblParam
double getDblParam(AbcDblParam key) const
Get a double parameter.
Definition: AbcModel.h:845
AbcModel::solver
OsiSolverInterface * solver() const
Returns solver - has current state.
Definition: AbcModel.h:398
AbcModel::isBinary
bool isBinary(int colIndex) const
Return true if variable is binary.
Definition: AbcModel.h:580
AbcModel::getColUpper
const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
Definition: AbcModel.h:517
AbcModel::getRowActivity
const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels.
Definition: AbcModel.h:655
AbcModel::continuousSolver_
OsiSolverInterface * continuousSolver_
A copy of the solver, taken at the continuous (root) node.
Definition: AbcModel.h:142
AbcModel::generator_
AbcCutGenerator ** generator_
Definition: AbcModel.h:194
CoinMessages
Class to hold and manipulate an array of massaged messages.
Definition: CoinMessageHandler.hpp:128
AlpsModel::AlpsPar_
AlpsParams * AlpsPar_
The parameter set that is used in Alps.
Definition: AlpsModel.h:52
AbcParams.h
AbcModel::getNumRows
int getNumRows() const
Get number of rows.
Definition: AbcModel.h:505
AbcModel::setBranchingMethod
void setBranchingMethod(AbcBranchDecision *method)
Set the branching decision method.
Definition: AbcModel.h:730
AbcModel::AbcFathomDiscipline
Fathoming discipline Controls objective function comparisons for purposes of fathoming by bound or de...
Definition: AbcModel.h:70
AbcModel::checkInteger
bool checkInteger(double value) const
Definition: AbcModel.h:772
AbcModel::numberStrong_
int numberStrong_
Maximum number of candidates to consider for strong branching.
Definition: AbcModel.h:190
OsiSolverInterface::getInfinity
virtual double getInfinity() const =0
Get the solver&#39;s value for infinity.
AbcModel::bestObjective_
double bestObjective_
Best objective.
Definition: AbcModel.h:154
AbcModel::AbcInfeasibilityWeight
The objective is assumed to worsen by this amount for each integer infeasibility. ...
Definition: AbcModel.h:81
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:704
OsiSolverInterface::clone
virtual OsiSolverInterface * clone(bool copyData=true) const =0
Clone.
AbcModel::branchingMethod
AbcBranchDecision * branchingMethod() const
Get the current branching decision method.
Definition: AbcModel.h:727
AbcModel::maximumCutPasses_
int maximumCutPasses_
Maximum number of cut passes.
Definition: AbcModel.h:203
AbcModel::decodeToSelf
virtual void decodeToSelf(AlpsEncoded &)
The method that decodes the model from a encoded object.
AbcModel::currentNumberCuts
int currentNumberCuts() const
Number of entries in the list returned by #addedCuts()
Definition: AbcModel.h:710
AbcModel::getObjValue
double getObjValue() const
Get best objective function value.
Definition: AbcModel.h:663
AbcModel::setNumberRowsAtContinous
void setNumberRowsAtContinous(const int value)
Number of rows in continuous (root) problem.
Definition: AbcModel.h:494
AbcModel::getIterationCount
int getIterationCount() const
Get how many iterations it took to solve the problem.
Definition: AbcModel.h:461
CoinMessageHandler::setLogLevel
void setLogLevel(int value)
Set current log (detail) level.
OsiSolverInterface::getRowPrice
virtual const double * getRowPrice() const =0
Get pointer to array[getNumRows()] of dual variable values.
OsiSolverInterface::isInteger
virtual bool isInteger(int colIndex) const
Return true if the variable is integer.
AbcModel::currentNumberCuts_
int currentNumberCuts_
Number of entries in #addedCuts_.
Definition: AbcModel.h:174
OsiSolverInterface::isFreeBinary
virtual bool isFreeBinary(int colIndex) const
Return true if the variable is binary and not fixed.
AbcModel::setCutoff
void setCutoff(double value)
Set cutoff bound on the objective function. When using strict comparison, the bound is adjusted by a ...
AbcCutGenerator.h
AbcModel::messages_
CoinMessages messages_
Abc messages.
Definition: AbcModel.h:124
AbcModel::isIntegerNonBinary
bool isIntegerNonBinary(int colIndex) const
Return true if variable is general integer.
Definition: AbcModel.h:591
AbcModel::init
void init()
Initialize member data.
Definition: AbcModel.h:329
AbcModel::readInstance
virtual void readInstance(const char *dataFile)
Read in the problem data.
Definition: AbcModel.h:382
AbcModel::getMaximumNodes
int getMaximumNodes() const
Get the maximum node limit .
Definition: AbcModel.h:868
AbcModel::getObjCoefficients
const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
Definition: AbcModel.h:563
AbcModel::pseudoList_
AbcPseudocost ** pseudoList_
Definition: AbcModel.h:214
AbcModel::setCurrentNumberCuts
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
AbcModel::setInfeasibilityWeight
bool setInfeasibilityWeight(double value)
Set the weight per integer infeasibility .
Definition: AbcModel.h:903
AbcModel::AbcMaximumSeconds
The maximum number of seconds before terminating.
Definition: AbcModel.h:94
AbcModel::AbcIntegerTolerance
The maximum amount the value of an integer variable can vary from integer and still be considered fea...
Definition: AbcModel.h:78
AbcModel::getCutoff
double getCutoff() const
Get the cutoff bound on the objective function - always as minimize.
Definition: AbcModel.h:856
AbcModel::getMatrixByCol
const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
Definition: AbcModel.h:603
AbcModel::priority
const int * priority() const
Priorities.
Definition: AbcModel.h:951
AbcModel::dblParam_
double dblParam_[AbcLastDblParam]
Array for double parameters.
Definition: AbcModel.h:130
OsiCuts.hpp
AbcModel::newLanguage
void newLanguage(CoinMessages::Language language)
Set language.
Definition: AbcModel.h:755
AbcModel::getPseudoIndices
int * getPseudoIndices()
Number of rows in continuous (root) problem.
Definition: AbcModel.h:573
AbcModel::getRowUpper
const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
Definition: AbcModel.h:559
AbcCutGenerator
Interface between Abc and Cut Generation Library.
Definition: AbcCutGenerator.h:69
AbcModel::setNumberStrong
void setNumberStrong(int number)
Definition: AbcModel.h:942
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:696
AbcModel::isSolutionLimitReached
bool isSolutionLimitReached() const
Solution limit reached?
AbcBranchDecision
Abstract branching decision base class.
Definition: AbcBranchBase.h:50
AbcModel::isFreeBinary
bool isFreeBinary(int colIndex) const
Return true if variable is binary and not fixed at either bound.
Definition: AbcModel.h:595
AbcModel::setMaximumNodes
bool setMaximumNodes(int value)
Set the maximum node limit .
Definition: AbcModel.h:864
AbcModel::isProvenOptimal
bool isProvenOptimal() const
Is optimality proven?
OsiSolverInterface::isIntegerNonBinary
virtual bool isIntegerNonBinary(int colIndex) const
Return true if the variable is general integer.
CoinMessages::Language
Language
Supported languages.
Definition: CoinMessageHandler.hpp:136
AbcModel::priority_
int * priority_
Priorities.
Definition: AbcModel.h:212
AbcModel::AbcPar_
AbcParams * AbcPar_
Abc parameters.
Definition: AbcModel.h:219
AbcModel::~AbcModel
~AbcModel()
Definition: AbcModel.h:258
OsiDualObjectiveLimit
Dual objective limit.
Definition: OsiSolverParameters.hpp:58
AbcMessage
Definition: AbcMessage.h:77
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::getPseudoList
AbcPseudocost ** getPseudoList()
Number of rows in continuous (root) problem.
Definition: AbcModel.h:570
CoinWarmStartBasis
The default COIN simplex (basis-oriented) warm start class.
Definition: CoinWarmStartBasis.hpp:40
AbcModel
Model class for ALPS Branch and Cut.
Definition: AbcModel.h:55
AbcModel::numberRowsAtContinuous_
int numberRowsAtContinuous_
Number of rows at continuous.
Definition: AbcModel.h:105
AbcModel::setDblParam
bool setDblParam(AbcDblParam key, double value)
Set a double parameter.
Definition: AbcModel.h:834
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::getMaximumSolutions
int getMaximumSolutions() const
Get the maximum number of solutions desired.
Definition: AbcModel.h:882
AbcModel::reducedCostFix
void reducedCostFix()
Perform reduced cost fixing Fixes integer variables at their current value based on reduced cost pena...
AbcModel::assignSolver
void assignSolver(OsiSolverInterface *&solver)
Assign a solver to the model (model assumes ownership) On return, solver will be NULL.
AbcModel::getObjSense
double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
Definition: AbcModel.h:567
AbcModel::getAllowableGap
double getAllowableGap() const
Get the allowable gap between the best known solution and the best possible solution.
Definition: AbcModel.h:923