Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Couenne::CouenneCutGenerator Class Reference

Cut Generator for linear convexifications. More...

#include <CouenneCutGenerator.hpp>

Inheritance diagram for Couenne::CouenneCutGenerator:
Inheritance graph
[legend]
Collaboration diagram for Couenne::CouenneCutGenerator:
Collaboration graph
[legend]

Public Member Functions

 CouenneCutGenerator (Bonmin::OsiTMINLPInterface *=NULL, Bonmin::BabSetupBase *base=NULL, CouenneProblem *=NULL, struct ASL *=NULL)
 constructor More...
 
 CouenneCutGenerator (const CouenneCutGenerator &)
 copy constructor More...
 
 ~CouenneCutGenerator ()
 destructor More...
 
CouenneCutGeneratorclone () const
 clone method (necessary for the abstract CglCutGenerator class) More...
 
CouenneProblemProblem () const
 return pointer to symbolic problem More...
 
void setProblem (CouenneProblem *p)
 return pointer to symbolic problem More...
 
int getnvars () const
 total number of variables (original + auxiliary) More...
 
bool isFirst () const
 has generateCuts been called yet? More...
 
bool addViolated () const
 should we add the violated cuts only (true), or all of them (false)? More...
 
enum conv_type ConvType () const
 get convexification type (see CouenneTypes.h) More...
 
int nSamples () const
 get number of convexification samples More...
 
void generateCuts (const OsiSolverInterface &, OsiCuts &, const CglTreeInfo=CglTreeInfo()) const
 the main CglCutGenerator More...
 
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 More...
 
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 More...
 
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. More...
 
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. More...
 
int addSegment (OsiCuts &, int, int, CouNumber, CouNumber, CouNumber, CouNumber, int) const
 Add half-plane through (x1,y1) and (x2,y2) – resp. More...
 
int addTangent (OsiCuts &, int, int, CouNumber, CouNumber, CouNumber, int) const
 add tangent at given poing (x,w) with given slope More...
 
void setBabPtr (Bonmin::Bab *p)
 Method to set the Bab pointer. More...
 
void getStats (int &nrc, int &ntc, double &st)
 Get statistics. More...
 
bool & infeasNode () const
 Allow to get and set the infeasNode_ flag (used only in generateCuts()) More...
 
void genRowCuts (const OsiSolverInterface &, OsiCuts &cs, int, int *, t_chg_bounds *=NULL) const
 generate OsiRowCuts for current convexification More...
 
void genColCuts (const OsiSolverInterface &, OsiCuts &, int, int *) const
 generate OsiColCuts for improved (implied and propagated) bounds More...
 
void printLineInfo () const
 print node, depth, LB/UB/LP info More...
 
ConstJnlstPtr Jnlst () const
 Provide Journalist. More...
 
void setJnlst (JnlstPtr jnlst__)
 
double & rootTime ()
 Time spent at root node. More...
 
bool check_lp () const
 return check_lp flag (used in CouenneSolverInterface) More...
 
bool enableLpImpliedBounds () const
 returns value of enable_lp_implied_bounds_ More...
 

Static Public Member Functions

static void registerOptions (Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
 Add list of options to be read from file. More...
 

Protected Attributes

bool firstcall_
 True if no convexification cuts have been generated yet for this problem. More...
 
bool addviolated_
 True if we should add the violated cuts only, false if all of them should be added. More...
 
enum conv_type convtype_
 what kind of sampling should be performed? More...
 
int nSamples_
 how many cuts should be added for each function? More...
 
CouenneProblemproblem_
 pointer to symbolic repr. of constraint, variables, and bounds More...
 
int nrootcuts_
 number of cuts generated at the first call More...
 
int ntotalcuts_
 total number of cuts generated More...
 
double septime_
 separation time (includes generation of problem) More...
 
double objValue_
 Record obj value at final point of CouenneConv. More...
 
Bonmin::OsiTMINLPInterfacenlp_
 nonlinear solver interface as used within Bonmin (used at first Couenne pass of each b&b node More...
 
Bonmin::BabBabPtr_
 pointer to the Bab object (used to retrieve the current primal bound through bestObj()) More...
 
bool infeasNode_
 signal infeasibility of current node (found through bound tightening) More...
 
JnlstPtr jnlst_
 SmartPointer to the Journalist. More...
 
double rootTime_
 Time spent at the root node. More...
 
bool check_lp_
 Check all generated LPs through an independent call to OsiClpSolverInterface::initialSolve() More...
 
bool enable_lp_implied_bounds_
 Take advantage of OsiClpSolverInterface::tightenBounds (), known to have caused some problems some time ago. More...
 
int lastPrintLine
 Running count of printed info lines. More...
 

Detailed Description

Cut Generator for linear convexifications.

Definition at line 49 of file CouenneCutGenerator.hpp.

Constructor & Destructor Documentation

CouenneCutGenerator::CouenneCutGenerator ( Bonmin::OsiTMINLPInterface nlp = NULL,
Bonmin::BabSetupBase base = NULL,
CouenneProblem problem = NULL,
struct ASL *  asl = NULL 
)

constructor

Definition at line 27 of file CouenneCutGenerator.cpp.

CouenneCutGenerator::CouenneCutGenerator ( const CouenneCutGenerator src)

copy constructor

Definition at line 88 of file CouenneCutGenerator.cpp.

CouenneCutGenerator::~CouenneCutGenerator ( )

destructor

Definition at line 83 of file CouenneCutGenerator.cpp.

Member Function Documentation

CouenneCutGenerator* Couenne::CouenneCutGenerator::clone ( ) const
inline

clone method (necessary for the abstract CglCutGenerator class)

Definition at line 125 of file CouenneCutGenerator.hpp.

CouenneProblem* Couenne::CouenneCutGenerator::Problem ( ) const
inline

return pointer to symbolic problem

Definition at line 129 of file CouenneCutGenerator.hpp.

void Couenne::CouenneCutGenerator::setProblem ( CouenneProblem p)
inline

return pointer to symbolic problem

Definition at line 133 of file CouenneCutGenerator.hpp.

int CouenneCutGenerator::getnvars ( ) const

total number of variables (original + auxiliary)

total number of variables (original + auxiliary) of the problem

Definition at line 141 of file CouenneCutGenerator.cpp.

bool Couenne::CouenneCutGenerator::isFirst ( ) const
inline

has generateCuts been called yet?

Definition at line 140 of file CouenneCutGenerator.hpp.

bool Couenne::CouenneCutGenerator::addViolated ( ) const
inline

should we add the violated cuts only (true), or all of them (false)?

Definition at line 144 of file CouenneCutGenerator.hpp.

enum conv_type Couenne::CouenneCutGenerator::ConvType ( ) const
inline

get convexification type (see CouenneTypes.h)

Definition at line 148 of file CouenneCutGenerator.hpp.

int Couenne::CouenneCutGenerator::nSamples ( ) const
inline

get number of convexification samples

Definition at line 152 of file CouenneCutGenerator.hpp.

void Couenne::CouenneCutGenerator::generateCuts ( const OsiSolverInterface &  si,
OsiCuts &  cs,
const CglTreeInfo  info = CglTreeInfo () 
) const

the main CglCutGenerator

a convexifier cut generator

Definition at line 94 of file generateCuts.cpp.

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

general procedure for inserting a linear cut with up to three variables.

Return 1 if cut inserted, 0 if none, <0 if error

Definition at line 32 of file createCuts.cpp.

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

general procedure for inserting a linear cut with up to three variables.

Return 1 if cut inserted, 0 if none, <0 if error

Definition at line 218 of file createCuts.cpp.

void CouenneCutGenerator::addEnvelope ( OsiCuts &  cs,
int  sign,
unary_function  f,
unary_function  fprime,
int  w_ind,
int  x_ind,
CouNumber  x,
CouNumber  l,
CouNumber  u,
t_chg_bounds chg = NULL,
bool  is_global = false 
) const

Add general linear envelope to convex function, given its variables' indices, the (univariate) function and its first derivative.

Definition at line 22 of file addEnvelope.cpp.

void CouenneCutGenerator::addEnvelope ( OsiCuts &  cs,
int  sign,
funtriplet ft,
int  w_ind,
int  x_ind,
CouNumber  x,
CouNumber  l,
CouNumber  u,
t_chg_bounds chg = NULL,
bool  is_global = false 
) const

Add general linear envelope to convex function, given its variables' indices, the (univariate) function and its first derivative.

Definition at line 35 of file addEnvelope.cpp.

int CouenneCutGenerator::addSegment ( OsiCuts &  cs,
int  wi,
int  xi,
CouNumber  x1,
CouNumber  y1,
CouNumber  x2,
CouNumber  y2,
int  sign 
) const

Add half-plane through (x1,y1) and (x2,y2) – resp.

add half-space through two points (x1,y1) and (x2,y2)

4th, 5th, 6th, and 7th argument

Definition at line 115 of file CouenneCutGenerator.cpp.

int CouenneCutGenerator::addTangent ( OsiCuts &  cs,
int  wi,
int  xi,
CouNumber  x,
CouNumber  w,
CouNumber  slope,
int  sign 
) const

add tangent at given poing (x,w) with given slope

add tangent at (x,w) with given slope

Definition at line 134 of file CouenneCutGenerator.cpp.

void Couenne::CouenneCutGenerator::setBabPtr ( Bonmin::Bab p)
inline

Method to set the Bab pointer.

Definition at line 218 of file CouenneCutGenerator.hpp.

void Couenne::CouenneCutGenerator::getStats ( int nrc,
int ntc,
double &  st 
)
inline

Get statistics.

Definition at line 222 of file CouenneCutGenerator.hpp.

bool& Couenne::CouenneCutGenerator::infeasNode ( ) const
inline

Allow to get and set the infeasNode_ flag (used only in generateCuts())

Definition at line 229 of file CouenneCutGenerator.hpp.

void CouenneCutGenerator::genRowCuts ( const OsiSolverInterface &  si,
OsiCuts &  cs,
int  nchanged,
int changed,
t_chg_bounds chg = NULL 
) const

generate OsiRowCuts for current convexification

Definition at line 19 of file genRowCuts.cpp.

void CouenneCutGenerator::genColCuts ( const OsiSolverInterface &  si,
OsiCuts &  cs,
int  nchanged,
int changed 
) const

generate OsiColCuts for improved (implied and propagated) bounds

Definition at line 21 of file genColCuts.cpp.

void CouenneCutGenerator::registerOptions ( Ipopt::SmartPtr< Bonmin::RegisteredOptions roptions)
static

Add list of options to be read from file.

Definition at line 146 of file CouenneCutGenerator.cpp.

void CouenneCutGenerator::printLineInfo ( ) const

print node, depth, LB/UB/LP info

Definition at line 208 of file CouenneCutGenerator.cpp.

ConstJnlstPtr Couenne::CouenneCutGenerator::Jnlst ( ) const
inline

Provide Journalist.

Definition at line 246 of file CouenneCutGenerator.hpp.

void Couenne::CouenneCutGenerator::setJnlst ( JnlstPtr  jnlst__)
inline

Definition at line 249 of file CouenneCutGenerator.hpp.

double& Couenne::CouenneCutGenerator::rootTime ( )
inline

Time spent at root node.

Definition at line 253 of file CouenneCutGenerator.hpp.

bool Couenne::CouenneCutGenerator::check_lp ( ) const
inline

return check_lp flag (used in CouenneSolverInterface)

Definition at line 257 of file CouenneCutGenerator.hpp.

bool Couenne::CouenneCutGenerator::enableLpImpliedBounds ( ) const
inline

returns value of enable_lp_implied_bounds_

Definition at line 261 of file CouenneCutGenerator.hpp.

Member Data Documentation

bool Couenne::CouenneCutGenerator::firstcall_
mutableprotected

True if no convexification cuts have been generated yet for this problem.

Definition at line 55 of file CouenneCutGenerator.hpp.

bool Couenne::CouenneCutGenerator::addviolated_
mutableprotected

True if we should add the violated cuts only, false if all of them should be added.

Definition at line 59 of file CouenneCutGenerator.hpp.

enum conv_type Couenne::CouenneCutGenerator::convtype_
protected

what kind of sampling should be performed?

Definition at line 62 of file CouenneCutGenerator.hpp.

int Couenne::CouenneCutGenerator::nSamples_
protected

how many cuts should be added for each function?

Definition at line 65 of file CouenneCutGenerator.hpp.

CouenneProblem* Couenne::CouenneCutGenerator::problem_
protected

pointer to symbolic repr. of constraint, variables, and bounds

Definition at line 68 of file CouenneCutGenerator.hpp.

int Couenne::CouenneCutGenerator::nrootcuts_
mutableprotected

number of cuts generated at the first call

Definition at line 71 of file CouenneCutGenerator.hpp.

int Couenne::CouenneCutGenerator::ntotalcuts_
mutableprotected

total number of cuts generated

Definition at line 74 of file CouenneCutGenerator.hpp.

double Couenne::CouenneCutGenerator::septime_
mutableprotected

separation time (includes generation of problem)

Definition at line 77 of file CouenneCutGenerator.hpp.

double Couenne::CouenneCutGenerator::objValue_
mutableprotected

Record obj value at final point of CouenneConv.

Definition at line 80 of file CouenneCutGenerator.hpp.

Bonmin::OsiTMINLPInterface* Couenne::CouenneCutGenerator::nlp_
protected

nonlinear solver interface as used within Bonmin (used at first Couenne pass of each b&b node

Definition at line 84 of file CouenneCutGenerator.hpp.

Bonmin::Bab* Couenne::CouenneCutGenerator::BabPtr_
protected

pointer to the Bab object (used to retrieve the current primal bound through bestObj())

Definition at line 88 of file CouenneCutGenerator.hpp.

bool Couenne::CouenneCutGenerator::infeasNode_
mutableprotected

signal infeasibility of current node (found through bound tightening)

Definition at line 91 of file CouenneCutGenerator.hpp.

JnlstPtr Couenne::CouenneCutGenerator::jnlst_
protected

SmartPointer to the Journalist.

Definition at line 94 of file CouenneCutGenerator.hpp.

double Couenne::CouenneCutGenerator::rootTime_
mutableprotected

Time spent at the root node.

Definition at line 97 of file CouenneCutGenerator.hpp.

bool Couenne::CouenneCutGenerator::check_lp_
protected

Check all generated LPs through an independent call to OsiClpSolverInterface::initialSolve()

Definition at line 101 of file CouenneCutGenerator.hpp.

bool Couenne::CouenneCutGenerator::enable_lp_implied_bounds_
protected

Take advantage of OsiClpSolverInterface::tightenBounds (), known to have caused some problems some time ago.

Definition at line 105 of file CouenneCutGenerator.hpp.

int Couenne::CouenneCutGenerator::lastPrintLine
mutableprotected

Running count of printed info lines.

Definition at line 108 of file CouenneCutGenerator.hpp.


The documentation for this class was generated from the following files: