Couenne  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CouenneExprBound.hpp
Go to the documentation of this file.
1 /* $Id: CouenneExprBound.hpp 490 2011-01-14 16:07:12Z pbelotti $
2  *
3  * Name: exprBound.hpp
4  * Author: Pietro Belotti
5  * Purpose: definition of the class for variable bounds
6  *
7  * (C) Carnegie-Mellon University, 2006.
8  * This file is licensed under the Eclipse Public License (EPL)
9  */
10 
11 #ifndef COUENNE_EXPRBOUND_HPP
12 #define COUENNE_EXPRBOUND_HPP
13 
14 #include <iostream>
15 #include <assert.h>
16 
17 #include "CouenneTypes.hpp"
18 #include "CouenneExprVar.hpp"
19 
20 namespace Couenne {
21 
34 
35 
37 
38 class exprLowerBound: public exprVar {
39 
40  public:
41 
43  inline enum nodeType Type () const
44  {return CONST;}
45 
47  exprLowerBound (int varIndex, Domain *d = NULL):
48  exprVar (varIndex, d) {}
49 
51  exprLowerBound (const exprLowerBound &src, Domain *d = NULL):
52  exprVar (src, d) {}
53 
55  inline exprLowerBound *clone (Domain *d = NULL) const
56  {return new exprLowerBound (*this, d);}
57 
59  void print (std::ostream &out = std::cout,
60  bool = false) const
61  {out << "l_" << varIndex_;}
62 
65  {assert (domain_); return domain_ -> lb (varIndex_);}
66 
68  inline expression *differentiate (int)
69  {return new exprConst (0.);}
70 
72  inline int dependsOn (int *, int, enum dig_type type = STOP_AT_AUX)
73  {return 0;}
74 
76  virtual inline int Linearity ()
77  {return CONST;}
78 
80  virtual inline enum expr_type code ()
81  {return COU_EXPRLBOUND;}
82 };
83 
84 
86 
87 class exprUpperBound: public exprVar {
88 
89  public:
90 
92  inline enum nodeType Type () const
93  {return CONST;}
94 
96  exprUpperBound (int varIndex, Domain *d = NULL):
97  exprVar (varIndex, d) {}
98 
100  exprUpperBound (const exprUpperBound &src, Domain *d = NULL):
101  exprVar (src, d) {}
102 
104  inline exprUpperBound *clone (Domain *d = NULL) const
105  {return new exprUpperBound (*this, d);}
106 
108  void print (std::ostream &out = std::cout,
109  bool = false) const
110  {out << "u_" << varIndex_;}
111 
114  {assert (domain_); return domain_ -> ub (varIndex_);}
115 
117  inline expression *differentiate (int)
118  {return new exprConst (0.);}
119 
121  inline int dependsOn (int *, int, enum dig_type type = STOP_AT_AUX)
122  {return 0;}
123 
125  virtual inline int Linearity ()
126  {return CONST;}
127 
129  virtual inline enum expr_type code ()
130  {return COU_EXPRUBOUND;}
131 };
132 
133 }
134 
135 #endif
exprLowerBound * clone(Domain *d=NULL) const
cloning method
exprLowerBound(int varIndex, Domain *d=NULL)
Constructor.
virtual enum expr_type code()
code for comparisons
void print(std::ostream &out=std::cout, bool=false) const
Print to iostream.
enum nodeType Type() const
Node type.
Domain * domain_
Pointer to a descriptor of the current point/bounds.
CouNumber operator()()
return the value of the variable
exprLowerBound(const exprLowerBound &src, Domain *d=NULL)
Copy constructor.
constant-type operator
virtual enum expr_type code()
code for comparisons
enum nodeType Type() const
Node type.
expression * differentiate(int)
differentiation
expression * differentiate(int)
differentiation
exprUpperBound * clone(Domain *d=NULL) const
cloning method
exprUpperBound(int varIndex, Domain *d=NULL)
Constructor.
virtual CouNumber & ub()
Get/set upper bound value.
void print(std::ostream &out=std::cout, bool=false) const
Print to iostream.
exprUpperBound(const exprUpperBound &src, Domain *d=NULL)
Copy constructor.
double CouNumber
main number type in Couenne
nodeType
type of a node in an expression tree
virtual int Linearity()
get a measure of &quot;how linear&quot; the expression is:
dig_type
type of digging when filling the dependence list
variable-type operator
expr_type
code returned by the method expression::code()
Expression base class.
int varIndex_
The index of the variable.
virtual int Linearity()
get a measure of &quot;how linear&quot; the expression is:
int dependsOn(int *, int, enum dig_type type=STOP_AT_AUX)
dependence on variable set
int dependsOn(int *, int, enum dig_type type=STOP_AT_AUX)
dependence on variable set
These are bound expression classes.
CouNumber operator()()
return the value of the variable
Define a dynamic point+bounds, with a way to save and restore previous points+bounds through a LIFO s...
virtual CouNumber & lb()
Get/set lower bound value.