Alps 1.5.12
Loading...
Searching...
No Matches
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-2019, 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
45class CglCutGenerator;
46
48class AlpsTreeNode;
49class AbcNodeDesc;
50class AbcTreeNode;
51
52//#############################################################################
53
55class AbcModel : public AlpsModel {
56
57 public:
74
98
99 private:
107 int numberIntegers_;
109 int* integerVariable_;
111 CoinWarmStartBasis* sharedBasis_;
113
115 CoinMessageHandler * handler_;
116
121 bool defaultHandler_;
122
124 CoinMessages messages_;
125
128
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_;
172 int status_;
179
184 int maximumDepth_;
185
190 int numberStrong_;
193 // Cut generators
197 // Heuristic solvers
199
204
208 int numberSolutions_;
212 int * priority_;
216 int *pseudoIndices_;
217
220
221 public:
223 {
224 init();
225 }
226
227 AbcModel(const OsiSolverInterface &rhs)
228 {
229 init();
230 solver_ = rhs.clone();
231 ourSolver_ = true ;
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))
241 }
242 } else {
243 // empty model
244 currentSolution_=NULL;
245 }
246 if (numberIntegers_) {
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_;
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_;
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_ ;
324 }
325 delete AbcPar_;
326 }
327
329 void init()
330 {
332 numberIntegers_ = 0;
333 integerVariable_ = NULL;
334 sharedBasis_ = NULL;
335 handler_ = new CoinMessageHandler();
336 handler_->setLogLevel(2);
337 defaultHandler_ = true;
339 solver_ = NULL;
340 ourSolver_ = false;
341 basis_ = 0;
342 minimumDrop_ = 1.0e-4;
343 bestObjective_ = 1.0e100;
344 bestSolution_ = 0;
346 numberNodes_ = 0;
348 status_ = 0;
350 maximumNumberCuts_ = 1000;
352 numberStrong_ = 0;
354 generator_ = NULL;
356 heuristic_ = NULL;
359 branchingMethod_ = NULL;
362 priority_ = NULL;
363 pseudoList_ = NULL;
364 pseudoIndices_ = NULL;
365
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
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
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
451 bool isAbandoned() const;
453 bool isProvenOptimal() const;
455 bool isProvenInfeasible() const;
457 bool isNodeLimitReached() 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
493
494 void setNumberRowsAtContinous(const int value)
495 {
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
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
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
681 { return numberSolutions_; }
682
684 void setSolutionCount(int value)
685 { numberSolutions_=value; }
686
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_; }
711 { return currentNumberCuts_; }
712 void setCurrentNumberCuts(int value)
713 {
714 currentNumberCuts_ += value;
715 }
716
718
719 //-------------------------------------------------------------------------
720
728 { return branchingMethod_; }
731 { branchingMethod_ = method; }
736 { branchingMethod_ = &method; }
738
739 //-------------------------------------------------------------------------
740
744 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 =
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);
805 void addHeuristic(AbcHeuristic * generator);
807
813
822 //void takeOffCuts(OsiCuts &cuts, int *whichGenerator,
823// int &numberOldActiveCuts, int &numberNewCuts,
824 // bool allowResolve);
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 {
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) {
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)
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
Abstract branching decision base class.
Interface between Abc and Cut Generation Library.
Heuristic base class.
Model class for ALPS Branch and Cut.
Definition AbcModel.h:55
AbcCutGenerator ** generator_
Definition AbcModel.h:194
void init()
Initialize member data.
Definition AbcModel.h:329
int numberCutGenerators_
Number of cut generators.
Definition AbcModel.h:192
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 void decodeToSelf(AlpsEncoded &)
The method that decodes the model from a encoded object.
void findIntegers(bool startAgain)
Identify integer variables and create corresponding objects.
bool setIntegerTolerance(double value)
Set the integrality tolerance .
Definition AbcModel.h:889
double bestObjective_
Best objective.
Definition AbcModel.h:154
bool setMaximumNodes(int value)
Set the maximum node limit .
Definition AbcModel.h:864
double getInfeasibilityWeight() const
Get the weight per integer infeasibility .
Definition AbcModel.h:910
int * pseudoIndices_
Definition AbcModel.h:216
OsiSolverInterface * solver() const
Returns solver - has current state.
Definition AbcModel.h:398
AbcPseudocost ** pseudoList_
Definition AbcModel.h:214
@ AbcIntegerTolerance
The maximum amount the value of an integer variable can vary from integer and still be considered fea...
Definition AbcModel.h:78
@ AbcCutoffIncrement
The amount by which to tighten the objective function cutoff when a new solution is discovered.
Definition AbcModel.h:84
@ AbcLastDblParam
Just a marker, so that a static sized array can store parameters.
Definition AbcModel.h:96
@ AbcInfeasibilityWeight
The objective is assumed to worsen by this amount for each integer infeasibility.
Definition AbcModel.h:81
@ 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
@ AbcMaximumSeconds
The maximum number of seconds before terminating.
Definition AbcModel.h:94
void addHeuristic(AbcHeuristic *generator)
Add one heuristic.
const int * integerVariable() const
Integer variables.
Definition AbcModel.h:418
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...
int getNodeCount() const
Get how many Nodes it took to solve the problem.
Definition AbcModel.h:464
int intParam_[AbcLastIntParam]
Array for integer parameters.
Definition AbcModel.h:127
int maximumCutPassesAtRoot_
Maximum number of cut passes at root.
Definition AbcModel.h:201
double minimumDrop_
Minimum degradation in objective value to continue cut generation.
Definition AbcModel.h:151
int numberNodes_
Cumulative number of nodes.
Definition AbcModel.h:168
const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
Definition AbcModel.h:599
double dblParam_[AbcLastDblParam]
Array for double parameters.
Definition AbcModel.h:130
int numberHeuristicSolutions_
Number of heuristic solutions.
Definition AbcModel.h:210
int getNumElements() const
Get number of nonzero elements.
Definition AbcModel.h:509
int maximumNumberCuts_
Maximum number of cuts.
Definition AbcModel.h:176
const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
Definition AbcModel.h:563
void setBranchingMethod(AbcBranchDecision *method)
Set the branching decision method.
Definition AbcModel.h:730
void readParameters(const int argnum, const char *const *arglist)
Read in Alps and Abc parameters.
Definition AbcModel.h:388
int currentNumberCuts() const
Number of entries in the list returned by #addedCuts()
Definition AbcModel.h:710
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.
void initialSolve()
Solve the initial LP relaxation Invoke the solver's initialSolve() method.
int getMaximumCutPasses() const
Get the maximum number of cut passes at other nodes (default 10)
Definition AbcModel.h:707
bool ourSolver_
Ownership of the solver object The convention is that AbcModel owns the null solver.
Definition AbcModel.h:139
AbcHeuristic ** heuristic_
Definition AbcModel.h:198
bool setMaximumSolutions(int value)
Set the maximum number of solutions desired.
Definition AbcModel.h:875
void setNumberRowsAtContinous(const int value)
Definition AbcModel.h:494
bool isContinuous(int colIndex) const
Return true if variable is continuous.
Definition AbcModel.h:576
int maximumDepth_
Current limit on search tree depth.
Definition AbcModel.h:184
const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
Definition AbcModel.h:529
CoinMessageHandler * handler_
Message handler.
Definition AbcModel.h:115
const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
Definition AbcModel.h:559
double * currentSolution_
Array holding the current solution.
Definition AbcModel.h:162
CoinMessages messages()
Return messages.
Definition AbcModel.h:763
AbcParams * AbcPar_
Abc parameters.
Definition AbcModel.h:219
bool isAbandoned() const
Are there a numerical difficulties?
bool isProvenInfeasible() const
Is infeasiblity proven (or none better than cutoff)?
AbcBranchDecision * branchingMethod() const
Get the current branching decision method.
Definition AbcModel.h:727
int getNumberHeuristicSolutions() const
Get number of heuristic solutions.
Definition AbcModel.h:688
const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
Definition AbcModel.h:651
bool isIntegerNonBinary(int colIndex) const
Return true if variable is general integer.
Definition AbcModel.h:591
bool setInfeasibilityWeight(double value)
Set the weight per integer infeasibility .
Definition AbcModel.h:903
bool setIntParam(AbcIntParam key, int value)
Set an integer parameter.
Definition AbcModel.h:828
double * bestSolution_
Array holding the incumbent (best) solution.
Definition AbcModel.h:157
const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
Definition AbcModel.h:555
double getIntegerTolerance() const
Get the integrality tolerance .
Definition AbcModel.h:895
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()
Definition AbcModel.h:258
const double * bestSolution() const
The best solution to the integer programming problem.
Definition AbcModel.h:676
const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
Definition AbcModel.h:643
int priority(int sequence) const
Returns priority level for an object (or 1000 if no priorities exist)
Definition AbcModel.h:954
const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
Definition AbcModel.h:540
int * getPseudoIndices()
Definition AbcModel.h:573
void setBranchingMethod(AbcBranchDecision &method)
Set the branching method This is an overloaded member function, provided for convenience....
Definition AbcModel.h:735
bool isInteger(int colIndex) const
Return true if column is integer.
Definition AbcModel.h:587
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...
const double * getRowPrice() const
Get pointer to array[getNumRows()] of dual prices.
Definition AbcModel.h:647
double getMinimumDrop() const
Get the minimum drop to continue cuts.
Definition AbcModel.h:931
bool isProvenOptimal() const
Is optimality proven?
bool setAllowableGap(double value)
Set the allowable gap between the best known solution and the best possible solution.
Definition AbcModel.h:917
int numberIntegers_
Number of integers in problem.
Definition AbcModel.h:107
const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels.
Definition AbcModel.h:655
int * integerVariable_
Indices of integer variables.
Definition AbcModel.h:109
CoinWarmStartBasis * basis_
Pointer to a warm start basis.
Definition AbcModel.h:145
bool resolve()
Reoptimise an LP relaxation Invoke the solver's resolve() method.
int currentNumberCuts_
Number of entries in #addedCuts_.
Definition AbcModel.h:174
void reducedCostFix()
Perform reduced cost fixing Fixes integer variables at their current value based on reduced cost pena...
bool isNodeLimitReached() const
Node limit reached?
double getAllowableGap() const
Get the allowable gap between the best known solution and the best possible solution.
Definition AbcModel.h:923
int numberIterations_
Cumulative number of iterations.
Definition AbcModel.h:170
double getObjValue() const
Get best objective function value.
Definition AbcModel.h:663
void setMinimumDrop(double value)
Set the minimum drop to continue cuts.
Definition AbcModel.h:928
int numberStrong() const
Definition AbcModel.h:939
CoinMessages * messagesPointer()
Return pointer to messages.
Definition AbcModel.h:766
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
int getNumRows() const
Get number of rows.
Definition AbcModel.h:505
void setLanguage(CoinMessages::Language language)
Definition AbcModel.h:757
bool isBinary(int colIndex) const
Return true if variable is binary.
Definition AbcModel.h:580
void assignSolver(OsiSolverInterface *&solver)
Assign a solver to the model (model assumes ownership) On return, solver will be NULL.
int numberIntegers() const
Number of integers in problem.
Definition AbcModel.h:414
int numberSolutions_
Number of solutions.
Definition AbcModel.h:208
virtual void readInstance(const char *dataFile)
Read in the problem data.
Definition AbcModel.h:382
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
CoinWarmStartBasis * sharedBasis_
Pointer to a warm start basis.
Definition AbcModel.h:111
double getCurrentObjValue() const
Get current objective function value.
Definition AbcModel.h:659
bool checkInteger(double value) const
Definition AbcModel.h:772
void incrementNodeCount(int s=1)
Increment the count of nodes.
Definition AbcModel.h:467
bool defaultHandler_
Flag to say if handler_ is the default handler.
Definition AbcModel.h:121
CoinMessages messages_
Abc messages.
Definition AbcModel.h:124
void setSolutionCount(int value)
Set number of solutions (so heuristics will be different)
Definition AbcModel.h:684
int maximumCutPasses_
Maximum number of cut passes.
Definition AbcModel.h:203
@ AbcMaxNumNode
The maximum number of nodes before terminating.
Definition AbcModel.h:60
@ AbcLastIntParam
Just a marker, so that a static sized array can store parameters.
Definition AbcModel.h:72
@ AbcMaxNumSol
The maximum number of solutions before terminating.
Definition AbcModel.h:62
@ AbcFathomDiscipline
Fathoming discipline Controls objective function comparisons for purposes of fathoming by bound or de...
Definition AbcModel.h:70
OsiSolverInterface * solver_
The solver associated with this model.
Definition AbcModel.h:133
int numberStrong_
Maximum number of candidates to consider for strong branching.
Definition AbcModel.h:190
bool setBestSolution(ABC_Message how, double &objectiveValue, const double *solution, bool fixVariables=false)
Record a new incumbent solution and update objectiveValue.
AbcModel(const OsiSolverInterface &rhs)
Definition AbcModel.h:227
int getIterationCount() const
Get how many iterations it took to solve the problem.
Definition AbcModel.h:461
int status() const
Final status of problem 0 finished, 1 stopped, 2 difficulties.
Definition AbcModel.h:473
const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
Definition AbcModel.h:603
void passInMessageHandler(CoinMessageHandler *handler)
Pass in Message handler (not deleted at end)
Definition AbcModel.h:744
int numberHeuristics_
Number of heuristics.
Definition AbcModel.h:196
virtual bool setupSelf()
Do necessary work to make model usable.
int getSolutionCount() const
Get number of solutions.
Definition AbcModel.h:680
void setObjValue(double obj)
Set the best objective value.
Definition AbcModel.h:668
int numberRowsAtContinuous_
Number of rows at continuous.
Definition AbcModel.h:105
void setNumberStrong(int number)
Definition AbcModel.h:942
bool isSolutionLimitReached() const
Solution limit reached?
int getNumCols() const
Get number of columns.
Definition AbcModel.h:501
AbcPseudocost ** getPseudoList()
Definition AbcModel.h:570
const int * priority() const
Priorities.
Definition AbcModel.h:951
void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
Definition AbcModel.h:692
double getInfinity() const
Get solver's value for infinity.
Definition AbcModel.h:607
AbcBranchDecision * branchingMethod_
Variable selection function.
Definition AbcModel.h:206
int getMaximumCutPassesAtRoot() const
Get the maximum number of cut passes at root node.
Definition AbcModel.h:699
double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
Definition AbcModel.h:567
int howOftenGlobalScan_
How often to scan global cuts.
Definition AbcModel.h:178
OsiCuts globalCuts_
Global cuts.
Definition AbcModel.h:165
const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
Definition AbcModel.h:517
bool setDblParam(AbcDblParam key, double value)
Set a double parameter.
Definition AbcModel.h:834
double getCutoff() const
Get the cutoff bound on the objective function - always as minimize.
Definition AbcModel.h:856
bool feasibleSolution(int &numberIntegerInfeasibilities)
Test the current solution for feasiblility.
const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
Definition AbcModel.h:551
CoinMessageHandler * messageHandler() const
Return handler.
Definition AbcModel.h:760
double * currentSolution() const
Solution to the most recent lp relaxation.
Definition AbcModel.h:639
int getMaximumSolutions() const
Get the maximum number of solutions desired.
Definition AbcModel.h:882
int numberRowsAtContinuous() const
Number of rows in continuous (root) problem.
Definition AbcModel.h:491
void newLanguage(CoinMessages::Language language)
Set language.
Definition AbcModel.h:755
CoinWarmStartBasis * lastws_
Pointer to last warm basis.
Definition AbcModel.h:148
void takeOffCuts()
Remove inactive cuts from the model.
void setCurrentNumberCuts(int value)
Definition AbcModel.h:712
double getDblParam(AbcDblParam key) const
Get a double parameter.
Definition AbcModel.h:845
bool isFreeBinary(int colIndex) const
Return true if variable is binary and not fixed at either bound.
Definition AbcModel.h:595
int getMaximumNodes() const
Get the maximum node limit .
Definition AbcModel.h:868
AbcParams * AbcPar()
Definition AbcModel.h:395
void setCutoff(double value)
Set cutoff bound on the objective function.
int * priority_
Priorities.
Definition AbcModel.h:212
const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
Definition AbcModel.h:513
OsiSolverInterface * continuousSolver_
A copy of the solver, taken at the continuous (root) node.
Definition AbcModel.h:142
int status_
Status of problem - 0 finished, 1 stopped, 2 difficulties.
Definition AbcModel.h:172
This data structure is to contain the packed form of an encodable knowledge.
Definition AlpsEncoded.h:25
AlpsParams * AlpsPar_
The parameter set that is used in Alps.
Definition AlpsModel.h:52
void readFromArglist(const int argnum, const char *const *arglist)
Read parameters from the command line.
This class holds one node of the search tree.
ABC_Message
This deals with Abc messages (as against Clp messages etc).
Definition AbcMessage.h:47