Go to the documentation of this file.
36 #include "CoinMessageHandler.hpp"
37 #include "CoinWarmStartBasis.hpp"
38 #include "OsiCuts.hpp"
39 #include "OsiSolverInterface.hpp"
49 class CglCutGenerator;
149 CoinWarmStartBasis*
basis_;
237 int numberColumns =
solver_->getNumCols();
242 for (iColumn = 0; iColumn < numberColumns; ++iColumn) {
243 if(
solver_->isInteger(iColumn))
253 for (iColumn=0;iColumn<numberColumns;iColumn++) {
254 if(
solver_->isInteger(iColumn))
311 for (; i >= 0; --i) {
339 handler_ =
new CoinMessageHandler();
388 solver()->readMps(dataFile,
"");
393 std::cout <<
"Reading in ALPS parameters ..." << std::endl;
395 std::cout <<
"Reading in ABC parameters ..." << std::endl;
415 CoinWarmStartBasis *
getEmptyBasis(
int ns = 0,
int na = 0)
const;
441 int & numberNewCuts,
int & maximumWhich,
442 int *& whichGenerator,
const bool cutDuringRampup,
466 {
return solver_->getIterationCount(); }
506 {
return solver_->getNumCols(); }
510 {
return solver_->getNumRows(); }
514 {
return solver_->getNumElements(); }
518 {
return solver_->getColLower(); }
522 {
return solver_->getColUpper(); }
534 {
return solver_->getRowSense(); }
545 {
return solver_->getRightHandSide(); }
556 {
return solver_->getRowRange(); }
560 {
return solver_->getRowLower(); }
564 {
return solver_->getRowUpper(); }
568 {
return solver_->getObjCoefficients(); }
572 {
return solver_->getObjSense(); }
581 {
return solver_->isContinuous(colIndex); }
585 {
return solver_->isBinary(colIndex); }
592 {
return solver_->isInteger(colIndex); }
596 {
return solver_->isIntegerNonBinary(colIndex); }
600 {
return solver_->isFreeBinary(colIndex); }
604 {
return solver_->getMatrixByRow(); }
608 {
return solver_->getMatrixByCol(); }
612 {
return solver_->getInfinity(); }
623 const double * solution,
628 double & objectiveValue,
629 const double *solution,
630 bool fixVariables =
false);
648 {
return solver_->getColSolution(); }
652 {
return solver_->getRowPrice(); }
656 {
return solver_->getReducedCost(); }
660 {
return solver_->getRowActivity(); }
664 {
return solver_->getObjValue(); }
778 double integerTolerance =
780 double nearest = floor(value + 0.5);
781 if (fabs(value - nearest) <= integerTolerance)
803 int howOften=1,
const char * name=NULL,
804 bool normal=
true,
bool atSolution=
false,
805 bool infeasible=
false);
863 solver_->getDblParam(OsiDualObjectiveLimit, value) ;
864 return value *
solver_->getObjSense() ;
@ AbcInfeasibilityWeight
The objective is assumed to worsen by this amount for each integer infeasibility.
bool setDblParam(AbcDblParam key, double value)
Set a double parameter.
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.
bool isNodeLimitReached() const
Node limit reached?
virtual AlpsReturnStatus decodeToSelf(AlpsEncoded &encoded)
Decode the given AlpsEncoded object into this.
double bestObjective_
Best objective.
void readFromArglist(const int argnum, const char *const *arglist)
Read parameters from the command line.
Abstract branching decision base class.
@ AbcMaxNumSol
The maximum number of solutions before terminating.
void setMaximumCutPassesAtRoot(int value)
Set the maximum number of cut passes at root node (default 20) Minimum drop can also be used for fine...
bool isProvenOptimal() const
Is optimality proven?
AbcHeuristic ** heuristic_
AlpsModel is a base class for user application problem data.
double * currentSolution() const
Solution to the most recent lp relaxation.
double getDblParam(AbcDblParam key) const
Get a double parameter.
double getInfinity() const
Get solver's value for infinity.
double dblParam_[AbcLastDblParam]
Array for double parameters.
double getMinimumDrop() const
Get the minimum drop to continue cuts.
@ AbcMaxNumNode
The maximum number of nodes before terminating.
double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
int numberRowsAtContinuous_
Number of rows at continuous.
int getMaximumCutPasses() const
Get the maximum number of cut passes at other nodes (default 10)
bool ourSolver_
Ownership of the solver object The convention is that AbcModel owns the null solver.
void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
double * currentSolution_
Array holding the current solution.
const double * bestSolution() const
The best solution to the integer programming problem.
void passInMessageHandler(CoinMessageHandler *handler)
Pass in Message handler (not deleted at end)
int status() const
Final status of problem 0 finished, 1 stopped, 2 difficulties.
const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
int getNumberHeuristicSolutions() const
Get number of heuristic solutions.
double getInfeasibilityWeight() const
Get the weight per integer infeasibility .
const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
void setNumberRowsAtContinous(const int value)
const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
void takeOffCuts()
Remove inactive cuts from the model.
double * bestSolution_
Array holding the incumbent (best) solution.
CoinWarmStartBasis * lastws_
Pointer to last warm basis.
const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
int status_
Status of problem - 0 finished, 1 stopped, 2 difficulties.
int maximumDepth_
Current limit on search tree depth.
ABC_Message
This deals with Abc messages (as against Clp messages etc).
double getIntegerTolerance() const
Get the integrality tolerance .
int getMaximumSolutions() const
Get the maximum number of solutions desired.
int currentNumberCuts_
Number of entries in #addedCuts_.
int maximumCutPasses_
Maximum number of cut passes.
AbcCutGenerator ** generator_
int priority(int sequence) const
Returns priority level for an object (or 1000 if no priorities exist)
int getNodeCount() const
Get how many Nodes it took to solve the problem.
bool isContinuous(int colIndex) const
Return true if variable is continuous.
AbcModel & operator=(AbcModel const &)
Disable copy assignment operator.
int getMaximumCutPassesAtRoot() const
Get the maximum number of cut passes at root node.
const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
This class holds one node of the search tree.
int numberIntegers_
Number of integers in problem.
int numberHeuristicSolutions_
Number of heuristic solutions.
void addHeuristic(AbcHeuristic *generator)
Add one heuristic.
bool isIntegerNonBinary(int colIndex) const
Return true if variable is general integer.
void reducedCostFix()
Perform reduced cost fixing Fixes integer variables at their current value based on reduced cost pena...
int numberCutGenerators_
Number of cut generators.
bool setMaximumNodes(int value)
Set the maximum node limit .
bool resolve()
Reoptimise an LP relaxation Invoke the solver's resolve() method.
void setCurrentNumberCuts(int value)
bool setIntParam(AbcIntParam key, int value)
Set an integer parameter.
CoinWarmStartBasis * sharedBasis_
Pointer to a warm start basis.
void setLanguage(CoinMessages::Language language)
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...
const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
int numberSolutions_
Number of solutions.
const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
int * priority_
Priorities.
int getIterationCount() const
Get how many iterations it took to solve the problem.
@ AbcAllowableGap
Stop when the gap between the objective value of the best known solution and the best bound on the ob...
void setMinimumDrop(double value)
Set the minimum drop to continue cuts.
int numberRowsAtContinuous() const
Number of rows in continuous (root) problem.
int intParam_[AbcLastIntParam]
Array for integer parameters.
const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
int maximumCutPassesAtRoot_
Maximum number of cut passes at root.
bool setIntegerTolerance(double value)
Set the integrality tolerance .
CoinMessages messages()
Return messages.
void setBranchingMethod(AbcBranchDecision &method)
Set the branching method This is an overloaded member function, provided for convenience....
int getSolutionCount() const
Get number of solutions.
void findIntegers(bool startAgain)
Identify integer variables and create corresponding objects.
OsiSolverInterface * solver() const
Returns solver - has current state.
void assignSolver(OsiSolverInterface *&solver)
Assign a solver to the model (model assumes ownership) On return, solver will be NULL.
const int * priority() const
Priorities.
bool isInteger(int colIndex) const
Return true if column is integer.
double getObjValue() const
Get best objective function value.
AlpsParams * AlpsPar_
The parameter set that is used in Alps.
CoinMessages * messagesPointer()
Return pointer to messages.
@ AbcLastIntParam
Just a marker, so that a static sized array can store parameters.
double getAllowableGap() const
Get the allowable gap between the best known solution and the best possible solution.
const double * getRowPrice() const
Get pointer to array[getNumRows()] of dual prices.
int numberNodes_
Cumulative number of nodes.
The abstract base class of Alps knowledges generated during the search.
int * integerVariable_
Indices of integer variables.
void readParameters(const int argnum, const char *const *arglist)
Read in Alps and Abc parameters.
bool setBestSolution(ABC_Message how, double &objectiveValue, const double *solution, bool fixVariables=false)
Record a new incumbent solution and update objectiveValue.
bool isSolutionLimitReached() const
Solution limit reached?
@ AbcLastDblParam
Just a marker, so that a static sized array can store parameters.
int numberStrong_
Maximum number of candidates to consider for strong branching.
int getNumCols() const
Get number of columns.
@ AbcFathomDiscipline
Fathoming discipline Controls objective function comparisons for purposes of fathoming by bound or de...
AlpsEncoded * encode() const
Encode the content of this into an AlpsEncoded object and return a pointer to it.
const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels.
OsiCuts globalCuts_
Global cuts.
virtual AlpsKnowledge * decode(AlpsEncoded &encoded) const
Decode the given AlpsEncoded object into a new AlpsKnowledge object and.
double getCutoff() const
Get the cutoff bound on the objective function - always as minimize.
AbcModel(const OsiSolverInterface &rhs)
bool setMaximumSolutions(int value)
Set the maximum number of solutions desired.
CoinMessageHandler * handler_
Message handler.
bool checkInteger(double value) const
bool isFreeBinary(int colIndex) const
Return true if variable is binary and not fixed at either bound.
@ AbcMaximumSeconds
The maximum number of seconds before terminating.
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 CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
bool isBinary(int colIndex) const
Return true if variable is binary.
bool setInfeasibilityWeight(double value)
Set the weight per integer infeasibility .
CoinMessageHandler * messageHandler() const
Return handler.
int numberIntegers() const
Number of integers in problem.
Model class for ALPS Branch and Cut.
CoinWarmStartBasis * basis_
Pointer to a warm start basis.
OsiSolverInterface * continuousSolver_
A copy of the solver, taken at the continuous (root) node.
const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
AbcBranchDecision * branchingMethod() const
Get the current branching decision method.
int numberHeuristics_
Number of heuristics.
void setMaximumCutPasses(int value)
Set the maximum number of cut passes at other nodes (default 10) Minimum drop can also be used for fi...
double minimumDrop_
Minimum degradation in objective value to continue cut generation.
const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
AbcBranchDecision * branchingMethod_
Variable selection function.
int currentNumberCuts() const
Number of entries in the list returned by #addedCuts()
const int * integerVariable() const
Integer variables.
void initialSolve()
Solve the initial LP relaxation Invoke the solver's initialSolve() method.
virtual void readInstance(const char *dataFile)
Read in the problem data.
bool feasibleSolution(int &numberIntegerInfeasibilities)
Test the current solution for feasiblility.
bool defaultHandler_
Flag to say if handler_ is the default handler.
void incrementNodeCount(int s=1)
Increment the count of nodes.
void setSolutionCount(int value)
Set number of solutions (so heuristics will be different)
int howOftenGlobalScan_
How often to scan global cuts.
int getNumElements() const
Get number of nonzero elements.
AbcParams * AbcPar_
Abc parameters.
Interface between Abc and Cut Generation Library.
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.
int maximumNumberCuts_
Maximum number of cuts.
virtual bool setupSelf()
Do necessary work to make model usable.
int getIntParam(AbcIntParam key) const
Get an integer parameter.
void newLanguage(CoinMessages::Language language)
Set language.
void setNumberStrong(int number)
AbcPseudocost ** getPseudoList()
void init()
Initialize member data.
int getMaximumNodes() const
Get the maximum node limit .
double getCurrentObjValue() const
Get current objective function value.
void setObjValue(double obj)
Set the best objective value.
CoinMessages messages_
Abc messages.
@ AbcCutoffIncrement
The amount by which to tighten the objective function cutoff when a new solution is discovered.
int getNumRows() const
Get number of rows.
bool isProvenInfeasible() const
Is infeasiblity proven (or none better than cutoff)?
OsiSolverInterface * solver_
The solver associated with this model.
@ AbcIntegerTolerance
The maximum amount the value of an integer variable can vary from integer and still be considered fea...
AbcPseudocost ** pseudoList_
bool setAllowableGap(double value)
Set the allowable gap between the best known solution and the best possible solution.
int numberIterations_
Cumulative number of iterations.
void setCutoff(double value)
Set cutoff bound on the objective function.
bool isAbandoned() const
Are there a numerical difficulties?
virtual AlpsTreeNode * createRoot()
Create the root node.
void setBranchingMethod(AbcBranchDecision *method)
Set the branching decision method.