Couenne 0.5.8
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
20namespace Couenne {
21
34
35
37
38class 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
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
87class 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
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
Define a dynamic point+bounds, with a way to save and restore previous points+bounds through a LIFO s...
constant-type operator
These are bound expression classes.
CouNumber operator()()
return the value of the variable
exprLowerBound(int varIndex, Domain *d=NULL)
Constructor.
int dependsOn(int *, int, enum dig_type type=STOP_AT_AUX)
dependence on variable set
exprLowerBound * clone(Domain *d=NULL) const
cloning method
void print(std::ostream &out=std::cout, bool=false) const
Print to iostream.
virtual int Linearity()
get a measure of "how linear" the expression is:
enum nodeType Type() const
Node type.
exprLowerBound(const exprLowerBound &src, Domain *d=NULL)
Copy constructor.
expression * differentiate(int)
differentiation
virtual enum expr_type code()
code for comparisons
CouNumber operator()()
return the value of the variable
exprUpperBound(const exprUpperBound &src, Domain *d=NULL)
Copy constructor.
virtual enum expr_type code()
code for comparisons
virtual int Linearity()
get a measure of "how linear" the expression is:
exprUpperBound(int varIndex, Domain *d=NULL)
Constructor.
enum nodeType Type() const
Node type.
exprUpperBound * clone(Domain *d=NULL) const
cloning method
void print(std::ostream &out=std::cout, bool=false) const
Print to iostream.
int dependsOn(int *, int, enum dig_type type=STOP_AT_AUX)
dependence on variable set
expression * differentiate(int)
differentiation
variable-type operator
virtual CouNumber & ub()
Get/set upper bound value.
int varIndex_
The index of the variable.
virtual CouNumber & lb()
Get/set lower bound value.
Domain * domain_
Pointer to a descriptor of the current point/bounds.
Expression base class.
general include file for different compilers
nodeType
type of a node in an expression tree
dig_type
type of digging when filling the dependence list
double CouNumber
main number type in Couenne
expr_type
code returned by the method expression::code()
@ COU_EXPRUBOUND
@ COU_EXPRLBOUND