#include <CouenneCutGenerator.hpp>
Collaboration diagram for CouenneCutGenerator:
Public Member Functions | |
CouenneCutGenerator (Bonmin::OsiTMINLPInterface *=NULL, Bonmin::BabSetupBase *base=NULL, CouenneProblem *=NULL, struct ASL *=NULL) | |
constructor | |
CouenneCutGenerator (const CouenneCutGenerator &) | |
copy constructor | |
~CouenneCutGenerator () | |
destructor | |
CouenneCutGenerator * | clone () const |
clone method (necessary for the abstract CglCutGenerator class) | |
CouenneProblem * | Problem () const |
return pointer to symbolic problem | |
void | setProblem (CouenneProblem *p) |
return pointer to symbolic problem | |
int | getnvars () const |
total number of variables (original + auxiliary) | |
bool | isFirst () const |
has generateCuts been called yet? | |
bool | addViolated () const |
should we add the violated cuts only (true), or all of them (false)? | |
enum conv_type | ConvType () const |
get convexification type (see CouenneTypes.h) | |
int | nSamples () const |
get number of convexification samples | |
void | generateCuts (const OsiSolverInterface &, OsiCuts &, const CglTreeInfo=CglTreeInfo()) const |
the main CglCutGenerator | |
int | createCut (OsiCuts &, CouNumber, CouNumber, int, CouNumber, int=-1, CouNumber=0., int=-1, CouNumber=0., bool=false) const |
create cut and check violation. Insert and return status | |
int | createCut (OsiCuts &, CouNumber, int, int, CouNumber, int=-1, CouNumber=0., int=-1, CouNumber=0., bool=false) const |
create cut and check violation. Other version with only one bound | |
void | addEnvelope (OsiCuts &, int, unary_function, unary_function, int, int, CouNumber, CouNumber, CouNumber, t_chg_bounds *=NULL, bool=false) const |
Add general linear envelope to convex function, given its variables' indices, the (univariate) function and its first derivative. | |
void | addEnvelope (OsiCuts &, int, funtriplet *, int, int, CouNumber, CouNumber, CouNumber, t_chg_bounds *=NULL, bool=false) const |
Add general linear envelope to convex function, given its variables' indices, the (univariate) function and its first derivative. | |
int | addSegment (OsiCuts &, int, int, CouNumber, CouNumber, CouNumber, CouNumber, int) const |
Add half-plane through (x1,y1) and (x2,y2) -- resp. | |
int | addTangent (OsiCuts &, int, int, CouNumber, CouNumber, CouNumber, int) const |
add tangent at given poing (x,w) with given slope | |
void | setBabPtr (Bonmin::Bab *p) |
Method to set the Bab pointer. | |
void | getStats (int &nrc, int &ntc, double &st) |
Get statistics. | |
bool & | infeasNode () const |
Allow to get and set the infeasNode_ flag (used only in generateCuts()). | |
void | genRowCuts (const OsiSolverInterface &, OsiCuts &cs, int, int *, t_chg_bounds *=NULL) const |
generate OsiRowCuts for current convexification | |
void | genColCuts (const OsiSolverInterface &, OsiCuts &, int, int *) const |
generate OsiColCuts for improved (implied and propagated) bounds | |
ConstJnlstPtr | Jnlst () const |
Provide Journalist. | |
void | setJnlst (JnlstPtr jnlst__) |
double & | rootTime () |
Time spent at root node. | |
bool | check_lp () const |
return check_lp flag (used in CouenneSolverInterface) | |
bool | enableLpImpliedBounds () const |
returns value of enable_lp_implied_bounds_ | |
Static Public Member Functions | |
static void | registerOptions (Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions) |
Add list of options to be read from file. | |
Protected Attributes | |
bool | firstcall_ |
True if no convexification cuts have been generated yet for this problem. | |
bool | addviolated_ |
True if we should add the violated cuts only, false if all of them should be added. | |
enum conv_type | convtype_ |
what kind of sampling should be performed? | |
int | nSamples_ |
how many cuts should be added for each function? | |
CouenneProblem * | problem_ |
pointer to symbolic repr. of constraint, variables, and bounds | |
int | nrootcuts_ |
number of cuts generated at the first call | |
int | ntotalcuts_ |
total number of cuts generated | |
double | septime_ |
separation time (includes generation of problem) | |
double | objValue_ |
Record obj value at final point of CouenneConv. | |
Bonmin::OsiTMINLPInterface * | nlp_ |
nonlinear solver interface as used within Bonmin (used at first Couenne pass of each b&b node | |
Bonmin::Bab * | BabPtr_ |
pointer to the Bab object (used to retrieve the current primal bound through bestObj()) | |
bool | infeasNode_ |
signal infeasibility of current node (found through bound tightening) | |
JnlstPtr | jnlst_ |
SmartPointer to the Journalist. | |
double | rootTime_ |
Time spent at the root node. | |
bool | check_lp_ |
Check all generated LPs through an independent call to OsiClpSolverInterface::initialSolve(). | |
bool | enable_lp_implied_bounds_ |
Take advantage of OsiClpSolverInterface::tightenBounds (), known to have caused some problems some time ago. |
Definition at line 35 of file CouenneCutGenerator.hpp.
CouenneCutGenerator::CouenneCutGenerator | ( | Bonmin::OsiTMINLPInterface * | = NULL , |
|
Bonmin::BabSetupBase * | base = NULL , |
|||
CouenneProblem * | = NULL , |
|||
struct ASL * | = NULL | |||
) |
constructor
Definition at line 21 of file CouenneCutGenerator.cpp.
References addviolated_, AROUND_CURPOINT, check_lp_, convtype_, CURRENT_ONLY, enable_lp_implied_bounds_, nSamples_, s, and UNIFORM_GRID.
Referenced by clone().
CouenneCutGenerator::CouenneCutGenerator | ( | const CouenneCutGenerator & | ) |
CouenneCutGenerator::~CouenneCutGenerator | ( | ) |
CouenneCutGenerator* CouenneCutGenerator::clone | ( | ) | const [inline] |
clone method (necessary for the abstract CglCutGenerator class)
Definition at line 108 of file CouenneCutGenerator.hpp.
References CouenneCutGenerator().
CouenneProblem* CouenneCutGenerator::Problem | ( | ) | const [inline] |
return pointer to symbolic problem
Definition at line 112 of file CouenneCutGenerator.hpp.
References problem_.
Referenced by Bonmin::CouenneInterface::extractLinearRelaxation(), and CouenneDisjCuts::getDisjunctions().
void CouenneCutGenerator::setProblem | ( | CouenneProblem * | p | ) | [inline] |
return pointer to symbolic problem
Definition at line 116 of file CouenneCutGenerator.hpp.
References problem_.
int CouenneCutGenerator::getnvars | ( | ) | const |
total number of variables (original + auxiliary)
Definition at line 132 of file CouenneCutGenerator.cpp.
References problem_.
bool CouenneCutGenerator::isFirst | ( | ) | const [inline] |
has generateCuts been called yet?
Definition at line 123 of file CouenneCutGenerator.hpp.
References firstcall_.
bool CouenneCutGenerator::addViolated | ( | ) | const [inline] |
should we add the violated cuts only (true), or all of them (false)?
Definition at line 127 of file CouenneCutGenerator.hpp.
References addviolated_.
enum conv_type CouenneCutGenerator::ConvType | ( | ) | const [inline] |
get convexification type (see CouenneTypes.h)
Definition at line 131 of file CouenneCutGenerator.hpp.
References convtype_.
int CouenneCutGenerator::nSamples | ( | ) | const [inline] |
get number of convexification samples
Definition at line 135 of file CouenneCutGenerator.hpp.
References nSamples_.
void CouenneCutGenerator::generateCuts | ( | const OsiSolverInterface & | , | |
OsiCuts & | , | |||
const | CglTreeInfo = CglTreeInfo() | |||
) | const |
the main CglCutGenerator
Definition at line 78 of file generateCuts.cpp.
References addviolated_, AUX, t_chg_bounds::CHANGED, COUENNE_EPS, COUENNE_INFINITY, fictitiousBound(), firstcall_, genColCuts(), genRowCuts(), infeasible, isOptimumCut(), J_CONVEXIFYING(), jnlst_, LINEAR, nlp_, nrootcuts_, ntotalcuts_, problem_, rootTime_, septime_, t_chg_bounds::setUpper(), sparse2dense(), updateBranchInfo(), VAR, and x.
Referenced by Bonmin::CouenneInterface::extractLinearRelaxation(), and genRowCuts().
int CouenneCutGenerator::createCut | ( | OsiCuts & | cs, | |
CouNumber | lb, | |||
CouNumber | ub, | |||
int | i1, | |||
CouNumber | c1, | |||
int | i2 = -1 , |
|||
CouNumber | c2 = 0. , |
|||
int | i3 = -1 , |
|||
CouNumber | c3 = 0. , |
|||
bool | is_global = false | |||
) | const |
create cut and check violation. Insert and return status
Return 1 if cut inserted, 0 if none, <0 if error
Definition at line 30 of file createCuts.cpp.
References addviolated_, badCoeff(), COU_MAX_COEFF, COUENNE_EPS, COUENNE_INFINITY, e, firstcall_, J_CONVEXIFYING(), jnlst_, ll, nt, problem_, and x.
Referenced by addEnvelope(), addSegment(), addTangent(), and createCut().
int CouenneCutGenerator::createCut | ( | OsiCuts & | cs, | |
CouNumber | rhs, | |||
int | sign, | |||
int | i1, | |||
CouNumber | c1, | |||
int | i2 = -1 , |
|||
CouNumber | c2 = 0. , |
|||
int | i3 = -1 , |
|||
CouNumber | c3 = 0. , |
|||
bool | is_global = false | |||
) | const |
create cut and check violation. Other version with only one bound
Return 1 if cut inserted, 0 if none, <0 if error
Definition at line 211 of file createCuts.cpp.
References createCut().
void CouenneCutGenerator::addEnvelope | ( | OsiCuts & | , | |
int | , | |||
unary_function | , | |||
unary_function | , | |||
int | , | |||
int | , | |||
CouNumber | , | |||
CouNumber | , | |||
CouNumber | , | |||
t_chg_bounds * | = NULL , |
|||
bool | = false | |||
) | const |
Add general linear envelope to convex function, given its variables' indices, the (univariate) function and its first derivative.
Definition at line 19 of file addEnvelope.cpp.
void CouenneCutGenerator::addEnvelope | ( | OsiCuts & | , | |
int | , | |||
funtriplet * | , | |||
int | , | |||
int | , | |||
CouNumber | , | |||
CouNumber | , | |||
CouNumber | , | |||
t_chg_bounds * | = NULL , |
|||
bool | = false | |||
) | const |
Add general linear envelope to convex function, given its variables' indices, the (univariate) function and its first derivative.
Definition at line 32 of file addEnvelope.cpp.
References convtype_, COUENNE_EPS, COUENNE_INFINITY, createCut(), CURRENT_ONLY, firstcall_, t_chg_bounds::lower(), nSamples_, t_chg_bounds::UNCHANGED, UNIFORM_GRID, and t_chg_bounds::upper().
int CouenneCutGenerator::addSegment | ( | OsiCuts & | , | |
int | , | |||
int | , | |||
CouNumber | , | |||
CouNumber | , | |||
CouNumber | , | |||
CouNumber | , | |||
int | ||||
) | const |
Add half-plane through (x1,y1) and (x2,y2) -- resp.
4th, 5th, 6th, and 7th argument
Definition at line 106 of file CouenneCutGenerator.cpp.
References COUENNE_EPS, createCut(), J_CONVEXIFYING(), jnlst_, and MAX_SLOPE.
Referenced by bayEnvelope().
int CouenneCutGenerator::addTangent | ( | OsiCuts & | , | |
int | , | |||
int | , | |||
CouNumber | , | |||
CouNumber | , | |||
CouNumber | , | |||
int | ||||
) | const |
add tangent at given poing (x,w) with given slope
Definition at line 125 of file CouenneCutGenerator.cpp.
References createCut().
void CouenneCutGenerator::setBabPtr | ( | Bonmin::Bab * | p | ) | [inline] |
Method to set the Bab pointer.
Definition at line 197 of file CouenneCutGenerator.hpp.
References BabPtr_.
void CouenneCutGenerator::getStats | ( | int & | nrc, | |
int & | ntc, | |||
double & | st | |||
) | [inline] |
Get statistics.
Definition at line 201 of file CouenneCutGenerator.hpp.
References nrootcuts_, ntotalcuts_, and septime_.
bool& CouenneCutGenerator::infeasNode | ( | ) | const [inline] |
Allow to get and set the infeasNode_ flag (used only in generateCuts()).
Definition at line 208 of file CouenneCutGenerator.hpp.
References infeasNode_.
void CouenneCutGenerator::genRowCuts | ( | const OsiSolverInterface & | , | |
OsiCuts & | cs, | |||
int | , | |||
int * | , | |||
t_chg_bounds * | = NULL | |||
) | const |
generate OsiRowCuts for current convexification
Definition at line 17 of file genRowCuts.cpp.
References AUX, firstcall_, generateCuts(), LINEAR, and problem_.
Referenced by CouenneBranchingObject::branch(), and generateCuts().
void CouenneCutGenerator::genColCuts | ( | const OsiSolverInterface & | , | |
OsiCuts & | , | |||
int | , | |||
int * | ||||
) | const |
generate OsiColCuts for improved (implied and propagated) bounds
Definition at line 18 of file genColCuts.cpp.
References COUENNE_EPS, COUENNE_INFINITY, firstcall_, isInteger(), and problem_.
Referenced by generateCuts().
void CouenneCutGenerator::registerOptions | ( | Ipopt::SmartPtr< Bonmin::RegisteredOptions > | roptions | ) | [static] |
Add list of options to be read from file.
Definition at line 137 of file CouenneCutGenerator.cpp.
References Bonmin::RegisteredOptions::CouenneCategory, CouenneChooseVariable::registerOptions(), CouenneChooseStrong::registerOptions(), and CouenneProblem::registerOptions().
Referenced by Bonmin::CouenneSetup::registerAllOptions().
ConstJnlstPtr CouenneCutGenerator::Jnlst | ( | ) | const [inline] |
void CouenneCutGenerator::setJnlst | ( | JnlstPtr | jnlst__ | ) | [inline] |
double& CouenneCutGenerator::rootTime | ( | ) | [inline] |
Time spent at root node.
Definition at line 229 of file CouenneCutGenerator.hpp.
References rootTime_.
bool CouenneCutGenerator::check_lp | ( | ) | const [inline] |
return check_lp flag (used in CouenneSolverInterface)
Definition at line 233 of file CouenneCutGenerator.hpp.
References check_lp_.
bool CouenneCutGenerator::enableLpImpliedBounds | ( | ) | const [inline] |
returns value of enable_lp_implied_bounds_
Definition at line 237 of file CouenneCutGenerator.hpp.
References enable_lp_implied_bounds_.
bool CouenneCutGenerator::firstcall_ [mutable, protected] |
True if no convexification cuts have been generated yet for this problem.
Definition at line 41 of file CouenneCutGenerator.hpp.
Referenced by addEnvelope(), createCut(), genColCuts(), generateCuts(), genRowCuts(), and isFirst().
bool CouenneCutGenerator::addviolated_ [mutable, protected] |
True if we should add the violated cuts only, false if all of them should be added.
Definition at line 45 of file CouenneCutGenerator.hpp.
Referenced by addViolated(), CouenneCutGenerator(), createCut(), and generateCuts().
enum conv_type CouenneCutGenerator::convtype_ [protected] |
what kind of sampling should be performed?
Definition at line 48 of file CouenneCutGenerator.hpp.
Referenced by addEnvelope(), ConvType(), and CouenneCutGenerator().
int CouenneCutGenerator::nSamples_ [protected] |
how many cuts should be added for each function?
Definition at line 51 of file CouenneCutGenerator.hpp.
Referenced by addEnvelope(), CouenneCutGenerator(), and nSamples().
CouenneProblem* CouenneCutGenerator::problem_ [protected] |
pointer to symbolic repr. of constraint, variables, and bounds
Definition at line 54 of file CouenneCutGenerator.hpp.
Referenced by createCut(), genColCuts(), generateCuts(), genRowCuts(), getnvars(), Problem(), and setProblem().
int CouenneCutGenerator::nrootcuts_ [mutable, protected] |
number of cuts generated at the first call
Definition at line 57 of file CouenneCutGenerator.hpp.
Referenced by generateCuts(), and getStats().
int CouenneCutGenerator::ntotalcuts_ [mutable, protected] |
total number of cuts generated
Definition at line 60 of file CouenneCutGenerator.hpp.
Referenced by generateCuts(), and getStats().
double CouenneCutGenerator::septime_ [mutable, protected] |
separation time (includes generation of problem)
Definition at line 63 of file CouenneCutGenerator.hpp.
Referenced by generateCuts(), and getStats().
double CouenneCutGenerator::objValue_ [mutable, protected] |
Record obj value at final point of CouenneConv.
Definition at line 66 of file CouenneCutGenerator.hpp.
Bonmin::OsiTMINLPInterface* CouenneCutGenerator::nlp_ [protected] |
nonlinear solver interface as used within Bonmin (used at first Couenne pass of each b&b node
Definition at line 70 of file CouenneCutGenerator.hpp.
Referenced by generateCuts().
Bonmin::Bab* CouenneCutGenerator::BabPtr_ [protected] |
pointer to the Bab object (used to retrieve the current primal bound through bestObj())
Definition at line 74 of file CouenneCutGenerator.hpp.
Referenced by setBabPtr().
bool CouenneCutGenerator::infeasNode_ [mutable, protected] |
signal infeasibility of current node (found through bound tightening)
Definition at line 77 of file CouenneCutGenerator.hpp.
Referenced by infeasNode().
JnlstPtr CouenneCutGenerator::jnlst_ [protected] |
SmartPointer to the Journalist.
Definition at line 80 of file CouenneCutGenerator.hpp.
Referenced by addSegment(), createCut(), generateCuts(), Jnlst(), and setJnlst().
double CouenneCutGenerator::rootTime_ [mutable, protected] |
Time spent at the root node.
Definition at line 83 of file CouenneCutGenerator.hpp.
Referenced by generateCuts(), and rootTime().
bool CouenneCutGenerator::check_lp_ [protected] |
Check all generated LPs through an independent call to OsiClpSolverInterface::initialSolve().
Definition at line 87 of file CouenneCutGenerator.hpp.
Referenced by check_lp(), and CouenneCutGenerator().
bool CouenneCutGenerator::enable_lp_implied_bounds_ [protected] |
Take advantage of OsiClpSolverInterface::tightenBounds (), known to have caused some problems some time ago.
Definition at line 91 of file CouenneCutGenerator.hpp.
Referenced by CouenneCutGenerator(), and enableLpImpliedBounds().