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 
47 CouNumber minMaxDelta (funtriplet *ft, CouNumber lb, CouNumber ub);
48 CouNumber maxHeight (funtriplet *ft, CouNumber lb, CouNumber ub);
49 
50 
56 
57  class CouenneObject: public OsiObject {
58 
59 public:
60 
66 
69 
72 
74  CouenneObject ();
75 
78  CouenneProblem *p,
79  exprVar *ref, Bonmin::BabSetupBase *base, JnlstPtr jnlst);
80 
83 
86 
88  CouenneObject (const CouenneObject &src);
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 
106  virtual double feasibleRegion (OsiSolverInterface*, const OsiBranchingInformation*) const;
107 
110  virtual OsiBranchingObject *createBranch (OsiSolverInterface*,
111  const OsiBranchingInformation*, int) const;
112 
114  exprVar *Reference () const
115  {return reference_;}
116 
118  enum brSelStrat Strategy () const
119  {return strategy_;}
120 
122  CouNumber getBrPoint (funtriplet *ft, CouNumber x0, CouNumber l, CouNumber u, const OsiBranchingInformation *info = NULL) const;
123 
126  CouNumber midInterval (CouNumber x, CouNumber l, CouNumber u, const OsiBranchingInformation *info = NULL) const;
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 
154  void setEstimates (const OsiBranchingInformation *info,
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 
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.
pseudocostMult
type of up/down estimate to return for pseudocosts
const double large_bound
if |branching point| > this, change it
CouenneObject()
empty constructor (for unused objects)
virtual int columnNumber() const
Returns the column index.
brSelStrat
strategy names
void fint fint fint real fint real real real real real real real real real fint real fint fint fint real fint fint fint fint * info
OsiObject for auxiliary variables $w=f(x)$.
enum brSelStrat Strategy() const
return branching point selection strategy
CouNumber alpha_
Combination parameter for the mid-point branching point selection strategy.
virtual OsiBranchingObject * createBranch(OsiSolverInterface *, const OsiBranchingInformation *, int) const
create CouenneBranchingObject or CouenneThreeWayBranchObj based on this object
void setEstimate(double est, int direction)
set up/down estimate (0 for down, 1 for up).
exprVar * reference_
The (auxiliary) variable this branching object refers to.
void setEstimates(const OsiBranchingInformation *info, CouNumber *infeasibility, CouNumber *brpt) const
set up/down estimates based on branching information
enum brSelStrat strategy_
Branching point selection strategy.
bool doFBBT_
shall we do Feasibility based Bound Tightening (FBBT) at branching?
CouNumber feas_tolerance_
feasibility tolerance (equal to that of CouenneProblem)
double downEstimate_
down estimate (to be used in pseudocost)
CouenneProblem * problem_
pointer to Couenne problem
CouNumber minMaxDelta(funtriplet *ft, CouNumber lb, CouNumber ub)
Definition: minMaxDelta.cpp:49
CouNumber lp_clamp() const
Defines safe interval percentage for using LP point as a branching point.
const CouNumber default_alpha
ULong * x0
Definition: OSdtoa.cpp:1776
void setParameters(Bonmin::BabSetupBase *base)
set object parameters by reading from command line
A class to have all elements necessary to setup a branch-and-bound.
bool doConvCuts_
shall we add convexification cuts at branching?
virtual double intInfeasibility(double value, double lb, double ub) const
integer infeasibility: min {value - floor(value), ceil(value) - value}
Class for MINLP problems with symbolic information.
const CouNumber closeToBounds
CouNumber getBrPoint(funtriplet *ft, CouNumber x0, CouNumber l, CouNumber u, const OsiBranchingInformation *info=NULL) const
pick branching point based on current strategy
const CouNumber max_pseudocost
double CouNumber
main number type in Couenne
enum pseudocostMult pseudoMultType_
multiplier type for pseudocost
double upEstimate_
up estimate (to be used in pseudocost)
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.
~CouenneObject()
Destructor.
exprVar * Reference() const
return reference auxiliary variable
variable-type operator
virtual double downEstimate() const
Return "down" estimate (for non-convex, distance old <–> new LP point)
CouenneCutGenerator * cutGen_
pointer to cut generator (not necessary, can be NULL)
virtual CouenneObject * clone() const
Cloning method.
CouNumber lp_clamp_
Defines safe interval percentage for using LP point as a branching point.
branch_obj
type of object (for branching variable selection)
const CouNumber default_clamp
JnlstPtr jnlst_
SmartPointer to the Journalist.
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 = ...
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 bool isCuttable() const
are we on the bad or good side of the expression?
CouNumber maxHeight(funtriplet *ft, CouNumber lb, CouNumber ub)
Definition: minMaxDelta.cpp:86
virtual double feasibleRegion(OsiSolverInterface *, const OsiBranchingInformation *) const
fix (one of the) arguments of reference auxiliary variable
void fint fint fint real fint real * x
virtual double upEstimate() const
Return "up" estimate (for non-convex, distance old <–> new LP point)
bool isInteger(CouNumber x)
is this number integer?