#include <CouenneAggrProbing.hpp>
Collaboration diagram for Couenne::CouenneAggrProbing:
Public Member Functions | |
CouenneAggrProbing (CouenneSetup *couenne, const Ipopt::SmartPtr< Ipopt::OptionsList > options) | |
Constructor. | |
CouenneAggrProbing (const CouenneAggrProbing &rhs) | |
Copy constructor. | |
~CouenneAggrProbing () | |
Destructor. | |
CouenneAggrProbing * | clone () const |
Clone method (necessary for the abstract CglCutGenerator class). | |
void | generateCuts (const OsiSolverInterface &solver, OsiCuts &cuts, const CglTreeInfo=CglTreeInfo()) const |
The main CglCutGenerator; not implemented yet. | |
double | probeVariable (int index, bool probeLower) |
Probe one variable (try to tigthen the lower or the upper bound, depending on the value of the second argument), so that we can generate the corresponding column cut. | |
double | probeVariable2 (int index, bool lower) |
Alternative probing algorithm. | |
void | setMaxTime (double value) |
Set/get maximum time to probe one variable. | |
double | getMaxTime () const |
void | setMaxFailedSteps (int value) |
Set/get maximum number of failed steps. | |
int | getMaxFailedSteps () const |
void | setMaxNodes (int value) |
Set/get maximum number of nodes to probe one variable. | |
int | getMaxNodes () const |
void | setRestoreCutoff (bool value) |
Set/get restoreCutoff parameter (should we restore the initial cutoff value after each probing run?). | |
bool | getRestoreCutoff () const |
Static Public Member Functions | |
static void | registerOptions (Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions) |
Add list of options to be read from file. | |
Protected Attributes | |
CouenneSetup * | couenne_ |
Pointer to the CouenneProblem representation. | |
int | numCols_ |
Number of columns (want to have this handy). | |
double | maxTime_ |
Maximum time to probe one variable. | |
int | maxFailedSteps_ |
Maximum number of failed iterations. | |
int | maxNodes_ |
Maximum number of nodes in probing. | |
bool | restoreCutoff_ |
Restore initial cutoff (value and solution)? | |
double | initCutoff_ |
Initial cutoff. |
This probing strategy is very expensive and was initially developed to be run in parallel; hence, the user can choose to probe just a particular variable, without adding this cut generator to the list of cut generators normally employed by Couenne. However, it can also be used in the standard way; in that case, it chooses automatically the variables to probe (in a very naive way, for the moment). TODO: Implement some way to automatically choose the variables TODO: Implement the generateCuts method, for use in Branch-and-Bound
Definition at line 36 of file CouenneAggrProbing.hpp.
CouenneAggrProbing::CouenneAggrProbing | ( | CouenneSetup * | couenne, | |
const Ipopt::SmartPtr< Ipopt::OptionsList > | options | |||
) |
Constructor.
Definition at line 25 of file CouenneAggrProbing.cpp.
References couenne_, COUENNE_INFINITY, Couenne::CouenneSetup::couennePtr(), initCutoff_, maxFailedSteps_, maxNodes_, maxTime_, numCols_, Couenne::CouenneProblem::nVars(), Couenne::CouenneCutGenerator::Problem(), and restoreCutoff_.
Referenced by clone().
CouenneAggrProbing::CouenneAggrProbing | ( | const CouenneAggrProbing & | rhs | ) |
Copy constructor.
Definition at line 38 of file CouenneAggrProbing.cpp.
References couenne_, initCutoff_, maxFailedSteps_, maxNodes_, maxTime_, numCols_, and restoreCutoff_.
CouenneAggrProbing::~CouenneAggrProbing | ( | ) |
CouenneAggrProbing* Couenne::CouenneAggrProbing::clone | ( | ) | const [inline] |
Clone method (necessary for the abstract CglCutGenerator class).
Definition at line 51 of file CouenneAggrProbing.hpp.
References CouenneAggrProbing().
void CouenneAggrProbing::generateCuts | ( | const OsiSolverInterface & | solver, | |
OsiCuts & | cuts, | |||
const | CglTreeInfo = CglTreeInfo() | |||
) | const |
The main CglCutGenerator; not implemented yet.
Definition at line 55 of file CouenneAggrProbing.cpp.
double CouenneAggrProbing::probeVariable | ( | int | index, | |
bool | probeLower | |||
) |
Probe one variable (try to tigthen the lower or the upper bound, depending on the value of the second argument), so that we can generate the corresponding column cut.
This runs the main algorithm. It returns the new bound (equal to the initial one if we could not tigthen)
First store, then disable all heuristics.
Setup Branch-and-Bound limits
Now do Branch-and-Bound and see if probing succeeded
Problem is infeasible; therefore, probing was successful.
Problem is not infeasible; we failed
Set the bound that we want to try
Setup Branch-and-Bound limits
Now do Branch-and-Bound and see if probing succeeded
Is the search in the current interval complete?
Try again in a smaller interval
There is no smaller interval that we can try; bail out
We fully explored the current interval, and there is no feasible solution, or there is a solution and we have already updated the cutoff. So, we can eliminate the current interval. We also double the size of the search interval.
Make sure we increase by at least one if it is an integer variable
Restore initial bounds (we do not want to modify the CouenneSetup object: the caller will do that, if needed)
Restore parameters and heuristics
Restore cutoff
We are done; return best bound found.
Definition at line 93 of file CouenneAggrProbing.cpp.
References Bonmin::BabSetupBase::bestBound, Couenne::CouenneObjective::Body(), Couenne::CouenneProblem::checkNLP(), Bonmin::BabSetupBase::continuousSolver(), couenne_, COUENNE_AGGR_PROBING_BND_RELAX, COUENNE_AGGR_PROBING_FINITE_BOUND, COUENNE_AGGR_PROBING_MIN_INTERVAL, COUENNE_EPS, COUENNE_INFINITY, Couenne::CouenneSetup::couennePtr(), Couenne::CouenneProblem::domain(), Couenne::CouenneProblem::getCutOff(), Couenne::CouenneProblem::getCutOffSol(), Couenne::CouenneSetup::getDoubleParameter(), Bonmin::BabSetupBase::getIntParameter(), Bonmin::BabSetupBase::heuristics(), Couenne::expression::Index(), Couenne::CouenneProblem::installCutOff(), Couenne::CouenneProblem::Lb(), lp, maxFailedSteps_, Bonmin::BabSetupBase::MaxNodes, maxNodes_, Bonmin::BabSetupBase::MaxSolutions, Bonmin::BabSetupBase::MaxTime, maxTime_, Bonmin::Bab::model(), Bonmin::BabSetupBase::nodeComparisonMethod(), Bonmin::BabSetupBase::nonlinearSolver(), numCols_, Couenne::CouenneProblem::Obj(), Couenne::Domain::pop(), Couenne::CouenneCutGenerator::Problem(), Couenne::Domain::push(), Couenne::CouenneProblem::resetCutOff(), restoreCutoff_, Couenne::CouenneProblem::setCheckAuxBounds(), Couenne::CouenneProblem::setCutOff(), Couenne::CouenneSetup::setDoubleParameter(), Bonmin::BabSetupBase::setIntParameter(), Couenne::CouenneSetup::setNodeComparisonMethod(), Bonmin::Bab::setUsingCouenne(), and Couenne::CouenneProblem::Ub().
double CouenneAggrProbing::probeVariable2 | ( | int | index, | |
bool | lower | |||
) |
Alternative probing algorithm.
This one does not work yet! Do not use, will probably segfault.
Modify the CouenneSetup object to use our options. We store the initial values of all parameters that we modify, so that we can restore them when we are done.
First store, then disable all heuristics - we do not need upper bounds, plus they probably use a NLP object which we do not know how to modify
Now, store and modify objective function in the CouenneProblem object
Restore parameters
Definition at line 400 of file CouenneAggrProbing.cpp.
References Couenne::CouenneProblem::addVariable(), Bonmin::BabSetupBase::bestBound, Couenne::CouenneObjective::Body(), Bonmin::BabSetupBase::continuousSolver(), couenne_, COUENNE_EPS, Couenne::CouenneSetup::couennePtr(), Couenne::CouenneSetup::getDoubleParameter(), Bonmin::BabSetupBase::getIntParameter(), Bonmin::BabSetupBase::heuristics(), lp, Bonmin::BabSetupBase::MaxNodes, maxNodes_, Bonmin::BabSetupBase::MaxSolutions, Bonmin::BabSetupBase::MaxTime, maxTime_, Bonmin::Bab::model(), Bonmin::BabSetupBase::nodeComparisonMethod(), numCols_, Couenne::CouenneProblem::Obj(), Couenne::CouenneCutGenerator::Problem(), Couenne::CouenneSetup::setDoubleParameter(), Bonmin::BabSetupBase::setIntParameter(), Couenne::CouenneSetup::setNodeComparisonMethod(), Bonmin::Bab::setUsingCouenne(), and Couenne::CouenneProblem::Variables().
void CouenneAggrProbing::registerOptions | ( | Ipopt::SmartPtr< Bonmin::RegisteredOptions > | roptions | ) | [static] |
void CouenneAggrProbing::setMaxTime | ( | double | value | ) |
Set/get maximum time to probe one variable.
Definition at line 65 of file CouenneAggrProbing.cpp.
References maxTime_.
double CouenneAggrProbing::getMaxTime | ( | ) | const |
void CouenneAggrProbing::setMaxFailedSteps | ( | int | value | ) |
Set/get maximum number of failed steps.
Definition at line 73 of file CouenneAggrProbing.cpp.
References maxFailedSteps_.
int CouenneAggrProbing::getMaxFailedSteps | ( | ) | const |
void CouenneAggrProbing::setMaxNodes | ( | int | value | ) |
Set/get maximum number of nodes to probe one variable.
Definition at line 81 of file CouenneAggrProbing.cpp.
References maxNodes_.
int CouenneAggrProbing::getMaxNodes | ( | ) | const |
void CouenneAggrProbing::setRestoreCutoff | ( | bool | value | ) |
Set/get restoreCutoff parameter (should we restore the initial cutoff value after each probing run?).
Definition at line 89 of file CouenneAggrProbing.cpp.
References restoreCutoff_.
bool CouenneAggrProbing::getRestoreCutoff | ( | ) | const |
CouenneSetup* Couenne::CouenneAggrProbing::couenne_ [protected] |
Pointer to the CouenneProblem representation.
Definition at line 93 of file CouenneAggrProbing.hpp.
Referenced by CouenneAggrProbing(), probeVariable(), and probeVariable2().
int Couenne::CouenneAggrProbing::numCols_ [protected] |
Number of columns (want to have this handy).
Definition at line 96 of file CouenneAggrProbing.hpp.
Referenced by CouenneAggrProbing(), probeVariable(), and probeVariable2().
double Couenne::CouenneAggrProbing::maxTime_ [protected] |
Maximum time to probe one variable.
Definition at line 99 of file CouenneAggrProbing.hpp.
Referenced by CouenneAggrProbing(), getMaxTime(), probeVariable(), probeVariable2(), and setMaxTime().
int Couenne::CouenneAggrProbing::maxFailedSteps_ [protected] |
Maximum number of failed iterations.
Definition at line 102 of file CouenneAggrProbing.hpp.
Referenced by CouenneAggrProbing(), getMaxFailedSteps(), probeVariable(), and setMaxFailedSteps().
int Couenne::CouenneAggrProbing::maxNodes_ [protected] |
Maximum number of nodes in probing.
Definition at line 105 of file CouenneAggrProbing.hpp.
Referenced by CouenneAggrProbing(), getMaxNodes(), probeVariable(), probeVariable2(), and setMaxNodes().
bool Couenne::CouenneAggrProbing::restoreCutoff_ [protected] |
Restore initial cutoff (value and solution)?
Definition at line 108 of file CouenneAggrProbing.hpp.
Referenced by CouenneAggrProbing(), getRestoreCutoff(), probeVariable(), and setRestoreCutoff().
double Couenne::CouenneAggrProbing::initCutoff_ [protected] |
Initial cutoff.
Definition at line 111 of file CouenneAggrProbing.hpp.
Referenced by CouenneAggrProbing().