Couenne 0.5.8
Loading...
Searching...
No Matches
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
17namespace Couenne {
18
21
22class exprLBQuad: public expression {
23
24 exprQuad *ref_;
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
60class exprUBQuad: public expression {
61
62 exprQuad *ref_;
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
Define a dynamic point+bounds, with a way to save and restore previous points+bounds through a LIFO s...
exprLBQuad(exprQuad *ref)
Constructor.
virtual void print(std::ostream &s=std::cout, bool descend=false) const
I/O.
exprLBQuad(const exprLBQuad &src, Domain *d=NULL)
copy constructor
CouNumber operator()()
function for the evaluation of the expression
expression * clone(Domain *d=NULL) const
cloning method
class exprQuad, with constant, linear and quadratic terms
expression * clone(Domain *d=NULL) const
cloning method
virtual void print(std::ostream &s=std::cout, bool descend=false) const
I/O.
exprUBQuad(exprQuad *ref)
Constructor.
CouNumber operator()()
function for the evaluation of the expression
exprUBQuad(const exprUBQuad &src, Domain *d=NULL)
copy constructor
virtual bool isaCopy() const
return true if this is a copy of something (i.e. an exprCopy)
virtual expression * Copy() const
return copy of this expression (only makes sense in exprCopy)
general include file for different compilers
double CouNumber
main number type in Couenne