Couenne  0.5.8
CouenneObject.hpp
Go to the documentation of this file.
1 /* $Id: CouenneObject.hpp 793 2012-01-26 03:07:16Z pbelotti $
2  *
3  * Name: CouenneObject.hpp
4  * Authors: Pierre Bonami, IBM Corp.
5  * Pietro Belotti, Carnegie Mellon University
6  * Purpose: Object for auxiliary variables
7  *
8  * (C) Carnegie-Mellon University, 2006-11.
9  * This file is licensed under the Eclipse Public License (EPL)
10  */
11 
12 #ifndef COUENNEOBJECT_HPP
13 #define COUENNEOBJECT_HPP
14 
15 #include "BonBabSetupBase.hpp"
16 
17 #include "CouenneExprVar.hpp"
18 #include "CouenneJournalist.hpp"
19 #include "OsiBranchingObject.hpp"
20 
21 namespace Couenne {
22 
23 const CouNumber default_alpha = 0.25;
25 const CouNumber max_pseudocost = 1000.;
26 
28 const double large_bound = 1e9;
29 
30 #define AGGR_MUL 2
31 #define THRES_ZERO_SYMM 0.8
32 
34 
39 
42 
43 class funtriplet;
44 class CouenneProblem;
45 class CouenneCutGenerator;
46 
49 
50 
56 
57  class CouenneObject: public OsiObject {
58 
59 public:
60 
66 
69 
72 
75 
78  CouenneProblem *p,
79  exprVar *ref, Bonmin::BabSetupBase *base, JnlstPtr jnlst);
80 
83 
86 
89 
91  virtual CouenneObject * clone () const
92  {return new CouenneObject (*this);}
93 
96 
99  virtual double infeasibility (const OsiBranchingInformation *info, int &way) const;
100 
103  virtual double checkInfeasibility (const OsiBranchingInformation * info) const;
104 
107 
111  const OsiBranchingInformation*, int) const;
112 
114  exprVar *Reference () const
115  {return reference_;}
116 
118  enum brSelStrat Strategy () const
119  {return strategy_;}
120 
123 
127 
129  virtual double downEstimate () const
130  {//if (jnlst_ -> ProduceOutput (J_MATRIX, J_BRANCHING)) {
131  //printf ("DOWN EST = %g for ", downEstimate_);
132  //reference_ -> print ();
133  //printf ("\n");
134  //}
135  return downEstimate_;}
136 
138  virtual double upEstimate () const
139  {//if (jnlst_ -> ProduceOutput (J_MATRIX, J_BRANCHING)) {
140  //printf ("UP EST = %g for ", upEstimate_);
141  //reference_ -> print ();
142  //printf ("\n");
143  //}
144  return upEstimate_;}
145 
150  void setEstimate (double est, int direction)
151  {(direction ? upEstimate_ : downEstimate_) = est;}
152 
156  CouNumber *brpt) const;
157 
159  virtual bool isCuttable () const {
160  return (reference_ -> Image ()) ?
161  ((!(reference_ -> isInteger ())) &&
162  reference_ -> Image () -> isCuttable (problem_, reference_ -> Index ())) :
163  (!(reference_ -> isInteger ()));
164  }
165 
167  virtual double intInfeasibility (double value, double lb, double ub) const;
168 
171  {return lp_clamp_;}
172 
174  virtual int columnNumber () const
175  {return (reference_ ? reference_ -> Index () : -1);}
176 
177 protected:
178 
181 
184 
189 
191  enum brSelStrat strategy_;
192 
195 
199 
202 
205 
207  bool doFBBT_;
208 
211 
213  mutable double downEstimate_;
214 
216  mutable double upEstimate_;
217 
220 };
221 
222 }
223 
224 #endif
Cut Generator for linear convexifications.
OsiObject for auxiliary variables $w=f(x)$.
exprVar * reference_
The (auxiliary) variable this branching object refers to.
CouenneProblem * problem_
pointer to Couenne problem
CouNumber feas_tolerance_
feasibility tolerance (equal to that of CouenneProblem)
double downEstimate_
down estimate (to be used in pseudocost)
CouNumber lp_clamp() const
Defines safe interval percentage for using LP point as a branching point.
virtual double feasibleRegion(OsiSolverInterface *, const OsiBranchingInformation *) const
fix (one of the) arguments of reference auxiliary variable
brSelStrat
strategy names
virtual double downEstimate() const
Return "down" estimate (for non-convex, distance old <--> new LP point)
branch_obj
type of object (for branching variable selection)
JnlstPtr jnlst_
SmartPointer to the Journalist.
void setEstimates(const OsiBranchingInformation *info, CouNumber *infeasibility, CouNumber *brpt) const
set up/down estimates based on branching information
bool doFBBT_
shall we do Feasibility based Bound Tightening (FBBT) at branching?
enum brSelStrat strategy_
Branching point selection strategy.
CouenneObject(CouenneCutGenerator *cutgen, CouenneProblem *p, exprVar *ref, Bonmin::BabSetupBase *base, JnlstPtr jnlst)
Constructor with information for branching point selection strategy.
pseudocostMult
type of up/down estimate to return for pseudocosts
CouNumber midInterval(CouNumber x, CouNumber l, CouNumber u, const OsiBranchingInformation *info=NULL) const
returns a point "inside enough" a given interval, or x if it already is.
void setEstimate(double est, int direction)
set up/down estimate (0 for down, 1 for up).
CouenneObject(const CouenneObject &src)
Copy constructor.
CouenneObject(exprVar *ref, Bonmin::BabSetupBase *base, JnlstPtr jnlst)
Constructor with lesser information, used for infeasibility only.
enum pseudocostMult pseudoMultType_
multiplier type for pseudocost
enum brSelStrat Strategy() const
return branching point selection strategy
virtual double intInfeasibility(double value, double lb, double ub) const
integer infeasibility: min {value - floor(value), ceil(value) - value}
CouenneCutGenerator * cutGen_
pointer to cut generator (not necessary, can be NULL)
CouNumber alpha_
Combination parameter for the mid-point branching point selection strategy.
virtual CouenneObject * clone() const
Cloning method.
virtual double infeasibility(const OsiBranchingInformation *info, int &way) const
compute infeasibility of this variable, |w - f(x)| (where w is the auxiliary variable defined as w = ...
void setParameters(Bonmin::BabSetupBase *base)
set object parameters by reading from command line
CouNumber lp_clamp_
Defines safe interval percentage for using LP point as a branching point.
virtual bool isCuttable() const
are we on the bad or good side of the expression?
CouNumber getBrPoint(funtriplet *ft, CouNumber x0, CouNumber l, CouNumber u, const OsiBranchingInformation *info=NULL) const
pick branching point based on current strategy
exprVar * Reference() const
return reference auxiliary variable
virtual double upEstimate() const
Return "up" estimate (for non-convex, distance old <--> new LP point)
double upEstimate_
up estimate (to be used in pseudocost)
virtual OsiBranchingObject * createBranch(OsiSolverInterface *, const OsiBranchingInformation *, int) const
create CouenneBranchingObject or CouenneThreeWayBranchObj based on this object
CouenneObject()
empty constructor (for unused objects)
~CouenneObject()
Destructor.
virtual double checkInfeasibility(const OsiBranchingInformation *info) const
compute infeasibility of this variable, |w - f(x)|, where w is the auxiliary variable defined as w = ...
virtual int columnNumber() const
Returns the column index.
bool doConvCuts_
shall we add convexification cuts at branching?
Class for MINLP problems with symbolic information.
variable-type operator
double infeasibility() const
general include file for different compilers
const CouNumber default_clamp
const CouNumber max_pseudocost
const double large_bound
if |branching point| > this, change it
CouNumber minMaxDelta(funtriplet *ft, CouNumber lb, CouNumber ub)
double CouNumber
main number type in Couenne
const CouNumber default_alpha
const CouNumber closeToBounds
CouNumber maxHeight(funtriplet *ft, CouNumber lb, CouNumber ub)
bool isInteger(CouNumber x)
is this number integer?
int Index