CouenneExprBQuad.hpp

Go to the documentation of this file.
00001 /* $Id: CouenneExprBQuad.hpp 490 2011-01-14 16:07:12Z pbelotti $ */
00002 /*
00003  * Name:    exprBQuad.hpp
00004  * Author:  Pietro Belotti
00005  * Purpose: definition of operators to compute lower/upper bounds of quadratic forms
00006  *
00007  * (C) Carnegie-Mellon University, 2006. 
00008  * This file is licensed under the Eclipse Public License (EPL)
00009  */
00010 
00011 #ifndef COUENNE_EXPRBQUAD_H
00012 #define COUENNE_EXPRBQUAD_H
00013 
00014 #include "CouenneExprOp.hpp"
00015 #include "CouenneExprQuad.hpp"
00016 
00017 namespace Couenne {
00018 
00021 
00022 class exprLBQuad: public expression {
00023 
00024   exprQuad *ref_; 
00025 
00026  public:
00027 
00029   exprLBQuad (exprQuad *ref): 
00030     ref_ (ref) {}
00031 
00033   exprLBQuad (const exprLBQuad &src, Domain *d = NULL): 
00034     ref_ (dynamic_cast <exprQuad *> (src.ref_ -> isaCopy () ? 
00035                                      src.ref_ -> Copy () -> clone (d) : 
00036                                      src.ref_ -> clone (d))) {}
00037 
00039   ~exprLBQuad () {}
00040 
00042   expression *clone (Domain *d = NULL) const
00043   {return new exprLBQuad (*this, d);}
00044 
00046   inline CouNumber operator () () 
00047   {return ref_ -> computeQBound (-1);}
00048 
00050   virtual void print (std::ostream &s = std::cout,     //< output stream
00051                       bool descend = false) const      //< descend into auxiliaries' image?
00052 
00053   {s << "quadLower("; ref_ -> print (s, descend); s << ')';}
00054 };
00055 
00056 
00059 
00060 class exprUBQuad: public expression {
00061 
00062   exprQuad *ref_; 
00063 
00064  public:
00065 
00067   exprUBQuad (exprQuad *ref): 
00068     ref_ (ref) {}
00069 
00071   exprUBQuad (const exprUBQuad &src, Domain *d = NULL): 
00072     ref_ (dynamic_cast <exprQuad *> (src.ref_ -> isaCopy () ? 
00073                                      src.ref_ -> Copy () -> clone (d) : 
00074                                      src.ref_ -> clone (d))) {}
00075 
00077   ~exprUBQuad () {}
00078 
00080   expression *clone (Domain *d = NULL) const
00081   {return new exprUBQuad (*this, d);}
00082 
00084   inline CouNumber operator () () 
00085   {return ref_ -> computeQBound (1);}
00086 
00088   virtual void print (std::ostream &s = std::cout,     //< output stream
00089                       bool descend = false) const      //< descend into auxiliaries' image?
00090 
00091   {s << "quadUpper("; ref_ -> print (s, descend); s << ')';}
00092 };
00093 
00094 }
00095 
00096 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 13 May 2015 for Couenne by  doxygen 1.6.1