32#include "CoinMessageHandler.hpp"
33#include "CoinWarmStartBasis.hpp"
35#include "OsiSolverInterface.hpp"
233 int numberColumns =
solver_->getNumCols();
238 for (iColumn = 0; iColumn < numberColumns; ++iColumn) {
239 if(
solver_->isInteger(iColumn))
249 for (iColumn=0;iColumn<numberColumns;iColumn++) {
250 if(
solver_->isInteger(iColumn))
307 for (; i >= 0; --i) {
335 handler_ =
new CoinMessageHandler();
384 solver()->readMps(dataFile,
"");
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);
437 int & numberNewCuts,
int & maximumWhich,
438 int *& whichGenerator,
const bool cutDuringRampup,
462 {
return solver_->getIterationCount(); }
502 {
return solver_->getNumCols(); }
506 {
return solver_->getNumRows(); }
510 {
return solver_->getNumElements(); }
514 {
return solver_->getColLower(); }
518 {
return solver_->getColUpper(); }
530 {
return solver_->getRowSense(); }
541 {
return solver_->getRightHandSide(); }
552 {
return solver_->getRowRange(); }
556 {
return solver_->getRowLower(); }
560 {
return solver_->getRowUpper(); }
564 {
return solver_->getObjCoefficients(); }
568 {
return solver_->getObjSense(); }
577 {
return solver_->isContinuous(colIndex); }
581 {
return solver_->isBinary(colIndex); }
588 {
return solver_->isInteger(colIndex); }
592 {
return solver_->isIntegerNonBinary(colIndex); }
596 {
return solver_->isFreeBinary(colIndex); }
600 {
return solver_->getMatrixByRow(); }
604 {
return solver_->getMatrixByCol(); }
608 {
return solver_->getInfinity(); }
619 const double * solution,
624 double & objectiveValue,
625 const double *solution,
626 bool fixVariables =
false);
644 {
return solver_->getColSolution(); }
648 {
return solver_->getRowPrice(); }
652 {
return solver_->getReducedCost(); }
656 {
return solver_->getRowActivity(); }
660 {
return solver_->getObjValue(); }
774 double integerTolerance =
776 double nearest = floor(value + 0.5);
777 if (fabs(value - nearest) <= integerTolerance)
799 int howOften=1,
const char * name=NULL,
800 bool normal=
true,
bool atSolution=
false,
801 bool infeasible=
false);
859 solver_->getDblParam(OsiDualObjectiveLimit, value) ;
860 return value *
solver_->getObjSense() ;
Abstract branching decision base class.
Interface between Abc and Cut Generation Library.
AbcCutGenerator ** generator_
void init()
Initialize member data.
int numberCutGenerators_
Number of cut generators.
void setMaximumCutPasses(int value)
Set the maximum number of cut passes at other nodes (default 10) Minimum drop can also be used for fi...
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 .
double bestObjective_
Best objective.
bool setMaximumNodes(int value)
Set the maximum node limit .
double getInfeasibilityWeight() const
Get the weight per integer infeasibility .
OsiSolverInterface * solver() const
Returns solver - has current state.
AbcPseudocost ** pseudoList_
@ AbcIntegerTolerance
The maximum amount the value of an integer variable can vary from integer and still be considered fea...
@ AbcCutoffIncrement
The amount by which to tighten the objective function cutoff when a new solution is discovered.
@ AbcLastDblParam
Just a marker, so that a static sized array can store parameters.
@ AbcInfeasibilityWeight
The objective is assumed to worsen by this amount for each integer infeasibility.
@ AbcAllowableGap
Stop when the gap between the objective value of the best known solution and the best bound on the ob...
@ AbcMaximumSeconds
The maximum number of seconds before terminating.
void addHeuristic(AbcHeuristic *generator)
Add one heuristic.
const int * integerVariable() const
Integer variables.
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.
int intParam_[AbcLastIntParam]
Array for integer parameters.
int maximumCutPassesAtRoot_
Maximum number of cut passes at root.
double minimumDrop_
Minimum degradation in objective value to continue cut generation.
int numberNodes_
Cumulative number of nodes.
const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of matrix.
double dblParam_[AbcLastDblParam]
Array for double parameters.
int numberHeuristicSolutions_
Number of heuristic solutions.
int getNumElements() const
Get number of nonzero elements.
int maximumNumberCuts_
Maximum number of cuts.
const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
void setBranchingMethod(AbcBranchDecision *method)
Set the branching decision method.
void readParameters(const int argnum, const char *const *arglist)
Read in Alps and Abc parameters.
int currentNumberCuts() const
Number of entries in the list returned by #addedCuts()
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)
bool ourSolver_
Ownership of the solver object The convention is that AbcModel owns the null solver.
AbcHeuristic ** heuristic_
bool setMaximumSolutions(int value)
Set the maximum number of solutions desired.
void setNumberRowsAtContinous(const int value)
bool isContinuous(int colIndex) const
Return true if variable is continuous.
int maximumDepth_
Current limit on search tree depth.
const char * getRowSense() const
Get pointer to array[getNumRows()] of row constraint senses.
CoinMessageHandler * handler_
Message handler.
const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
double * currentSolution_
Array holding the current solution.
CoinMessages messages()
Return messages.
AbcParams * AbcPar_
Abc parameters.
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.
int getNumberHeuristicSolutions() const
Get number of heuristic solutions.
const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
bool isIntegerNonBinary(int colIndex) const
Return true if variable is general integer.
bool setInfeasibilityWeight(double value)
Set the weight per integer infeasibility .
bool setIntParam(AbcIntParam key, int value)
Set an integer parameter.
double * bestSolution_
Array holding the incumbent (best) solution.
const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
double getIntegerTolerance() const
Get the integrality tolerance .
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.
const double * bestSolution() const
The best solution to the integer programming problem.
const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
int priority(int sequence) const
Returns priority level for an object (or 1000 if no priorities exist)
const double * getRightHandSide() const
Get pointer to array[getNumRows()] of rows right-hand sides.
void setBranchingMethod(AbcBranchDecision &method)
Set the branching method This is an overloaded member function, provided for convenience....
bool isInteger(int colIndex) const
Return true if column is integer.
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.
double getMinimumDrop() const
Get the minimum drop to continue cuts.
bool isProvenOptimal() const
Is optimality proven?
bool setAllowableGap(double value)
Set the allowable gap between the best known solution and the best possible solution.
int numberIntegers_
Number of integers in problem.
const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels.
int * integerVariable_
Indices of integer variables.
CoinWarmStartBasis * basis_
Pointer to a warm start basis.
bool resolve()
Reoptimise an LP relaxation Invoke the solver's resolve() method.
int currentNumberCuts_
Number of entries in #addedCuts_.
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.
int numberIterations_
Cumulative number of iterations.
double getObjValue() const
Get best objective function value.
void setMinimumDrop(double value)
Set the minimum drop to continue cuts.
CoinMessages * messagesPointer()
Return pointer to messages.
virtual AlpsEncoded * encode() const
The method that encodes the model into a encoded object.
int getIntParam(AbcIntParam key) const
Get an integer parameter.
int getNumRows() const
Get number of rows.
void setLanguage(CoinMessages::Language language)
bool isBinary(int colIndex) const
Return true if variable is binary.
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.
int numberSolutions_
Number of solutions.
virtual void readInstance(const char *dataFile)
Read in the problem data.
void setMaximumCutPassesAtRoot(int value)
Set the maximum number of cut passes at root node (default 20) Minimum drop can also be used for fine...
CoinWarmStartBasis * sharedBasis_
Pointer to a warm start basis.
double getCurrentObjValue() const
Get current objective function value.
bool checkInteger(double value) const
void incrementNodeCount(int s=1)
Increment the count of nodes.
bool defaultHandler_
Flag to say if handler_ is the default handler.
CoinMessages messages_
Abc messages.
void setSolutionCount(int value)
Set number of solutions (so heuristics will be different)
int maximumCutPasses_
Maximum number of cut passes.
@ AbcMaxNumNode
The maximum number of nodes before terminating.
@ AbcLastIntParam
Just a marker, so that a static sized array can store parameters.
@ AbcMaxNumSol
The maximum number of solutions before terminating.
@ AbcFathomDiscipline
Fathoming discipline Controls objective function comparisons for purposes of fathoming by bound or de...
OsiSolverInterface * solver_
The solver associated with this model.
int numberStrong_
Maximum number of candidates to consider for strong branching.
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)
int getIterationCount() const
Get how many iterations it took to solve the problem.
int status() const
Final status of problem 0 finished, 1 stopped, 2 difficulties.
const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of matrix.
void passInMessageHandler(CoinMessageHandler *handler)
Pass in Message handler (not deleted at end)
int numberHeuristics_
Number of heuristics.
virtual bool setupSelf()
Do necessary work to make model usable.
int getSolutionCount() const
Get number of solutions.
void setObjValue(double obj)
Set the best objective value.
int numberRowsAtContinuous_
Number of rows at continuous.
void setNumberStrong(int number)
bool isSolutionLimitReached() const
Solution limit reached?
int getNumCols() const
Get number of columns.
AbcPseudocost ** getPseudoList()
const int * priority() const
Priorities.
void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
double getInfinity() const
Get solver's value for infinity.
AbcBranchDecision * branchingMethod_
Variable selection function.
int getMaximumCutPassesAtRoot() const
Get the maximum number of cut passes at root node.
double getObjSense() const
Get objective function sense (1 for min (default), -1 for max)
int howOftenGlobalScan_
How often to scan global cuts.
OsiCuts globalCuts_
Global cuts.
const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
bool setDblParam(AbcDblParam key, double value)
Set a double parameter.
double getCutoff() const
Get the cutoff bound on the objective function - always as minimize.
bool feasibleSolution(int &numberIntegerInfeasibilities)
Test the current solution for feasiblility.
const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
CoinMessageHandler * messageHandler() const
Return handler.
double * currentSolution() const
Solution to the most recent lp relaxation.
int getMaximumSolutions() const
Get the maximum number of solutions desired.
int numberRowsAtContinuous() const
Number of rows in continuous (root) problem.
void newLanguage(CoinMessages::Language language)
Set language.
CoinWarmStartBasis * lastws_
Pointer to last warm basis.
void takeOffCuts()
Remove inactive cuts from the model.
void setCurrentNumberCuts(int value)
double getDblParam(AbcDblParam key) const
Get a double parameter.
bool isFreeBinary(int colIndex) const
Return true if variable is binary and not fixed at either bound.
int getMaximumNodes() const
Get the maximum node limit .
void setCutoff(double value)
Set cutoff bound on the objective function.
int * priority_
Priorities.
const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
OsiSolverInterface * continuousSolver_
A copy of the solver, taken at the continuous (root) node.
int status_
Status of problem - 0 finished, 1 stopped, 2 difficulties.
This data structure is to contain the packed form of an encodable knowledge.
AlpsParams * AlpsPar_
The parameter set that is used in Alps.
AlpsModel(const AlpsModel &)
This class holds one node of the search tree.
ABC_Message
This deals with Abc messages (as against Clp messages etc).