Couenne  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CouenneExprBQuad.hpp
Go to the documentation of this file.
1 /* $Id: CouenneExprBQuad.hpp 490 2011-01-14 16:07:12Z pbelotti $ */
2 /*
3  * Name: exprBQuad.hpp
4  * Author: Pietro Belotti
5  * Purpose: definition of operators to compute lower/upper bounds of quadratic forms
6  *
7  * (C) Carnegie-Mellon University, 2006.
8  * This file is licensed under the Eclipse Public License (EPL)
9  */
10 
11 #ifndef COUENNE_EXPRBQUAD_H
12 #define COUENNE_EXPRBQUAD_H
13 
14 #include "CouenneExprOp.hpp"
15 #include "CouenneExprQuad.hpp"
16 
17 namespace Couenne {
18 
21 
22 class exprLBQuad: public expression {
23 
25 
26  public:
27 
30  ref_ (ref) {}
31 
33  exprLBQuad (const exprLBQuad &src, Domain *d = NULL):
34  ref_ (dynamic_cast <exprQuad *> (src.ref_ -> isaCopy () ?
35  src.ref_ -> Copy () -> clone (d) :
36  src.ref_ -> clone (d))) {}
37 
40 
42  expression *clone (Domain *d = NULL) const
43  {return new exprLBQuad (*this, d);}
44 
47  {return ref_ -> computeQBound (-1);}
48 
50  virtual void print (std::ostream &s = std::cout, //< output stream
51  bool descend = false) const //< descend into auxiliaries' image?
52 
53  {s << "quadLower("; ref_ -> print (s, descend); s << ')';}
54 };
55 
56 
59 
60 class exprUBQuad: public expression {
61 
63 
64  public:
65 
68  ref_ (ref) {}
69 
71  exprUBQuad (const exprUBQuad &src, Domain *d = NULL):
72  ref_ (dynamic_cast <exprQuad *> (src.ref_ -> isaCopy () ?
73  src.ref_ -> Copy () -> clone (d) :
74  src.ref_ -> clone (d))) {}
75 
78 
80  expression *clone (Domain *d = NULL) const
81  {return new exprUBQuad (*this, d);}
82 
85  {return ref_ -> computeQBound (1);}
86 
88  virtual void print (std::ostream &s = std::cout, //< output stream
89  bool descend = false) const //< descend into auxiliaries' image?
90 
91  {s << "quadUpper("; ref_ -> print (s, descend); s << ')';}
92 };
93 
94 }
95 
96 #endif
expression * clone(Domain *d=NULL) const
cloning method
virtual bool isaCopy() const
return true if this is a copy of something (i.e. an exprCopy)
expression * clone(Domain *d=NULL) const
cloning method
class to compute upper bound of a fraction based on the bounds of both numerator and denominator ...
virtual void print(std::ostream &s=std::cout, bool descend=false) const
I/O.
CouNumber operator()()
function for the evaluation of the expression
class to compute lower bound of a fraction based on the bounds of both numerator and denominator ...
exprQuad * ref_
quadratic form, reference expression
exprUBQuad(exprQuad *ref)
Constructor.
double CouNumber
main number type in Couenne
exprLBQuad(const exprLBQuad &src, Domain *d=NULL)
copy constructor
class exprQuad, with constant, linear and quadratic terms
exprQuad * ref_
quadratic form, reference expression
exprUBQuad(const exprUBQuad &src, Domain *d=NULL)
copy constructor
CouNumber operator()()
function for the evaluation of the expression
virtual void print(std::ostream &s=std::cout, bool descend=false) const
I/O.
exprLBQuad(exprQuad *ref)
Constructor.
Expression base class.
virtual expression * Copy() const
return copy of this expression (only makes sense in exprCopy)
Define a dynamic point+bounds, with a way to save and restore previous points+bounds through a LIFO s...