exprUnary.hpp

Go to the documentation of this file.
00001 /* $Id: exprUnary.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
00002 /*
00003  * Name:    exprUnary.hpp
00004  * Author:  Pietro Belotti
00005  * Purpose: definition of the class for univariate functions
00006  *
00007  * (C) Carnegie-Mellon University, 2006-08.
00008  * This file is licensed under the Common Public License (CPL)
00009  */
00010 
00011 #ifndef COUENNE_EXPRUNARY_HPP
00012 #define COUENNE_EXPRUNARY_HPP
00013 
00014 #include <iostream>
00015 
00016 #include "expression.hpp"
00017 #include "CouenneTypes.hpp"
00018 
00019 
00021 inline CouNumber zero_fun (CouNumber x) 
00022 {return 0.;}
00023 
00024 
00031 
00032 class exprUnary: public expression {
00033 
00034  protected:
00035 
00037   expression *argument_;
00038 
00039  public:
00040 
00042   virtual inline enum nodeType Type () const
00043   {return UNARY;}
00044 
00046   exprUnary  (expression *argument): 
00047     argument_ (argument)        //< non-leaf expression, with argument list
00048   {}
00049 
00051   virtual inline unary_function F () 
00052   {return zero_fun;}
00053 
00055   ~exprUnary ()
00056   {if (argument_) {delete argument_; argument_ = NULL;}}
00057 
00059   inline int nArgs () const
00060   {return 1;}
00061 
00063   virtual inline expression *Argument () const
00064   {return argument_;}
00065 
00067   virtual inline expression **ArgPtr () 
00068   {return &argument_;}
00069 
00071   virtual void print (std::ostream &out = std::cout, bool = false) const;
00072 
00074   virtual enum pos printPos () const
00075   {return PRE;}
00076 
00078   virtual std::string printOp () const
00079   {return "?";}
00080 
00082   virtual inline CouNumber operator () ()
00083   {return (F ()) ((*argument_) ());}
00084 
00087   virtual inline int DepList (std::set <int> &deplist, enum dig_type type = ORIG_ONLY)
00088   {return argument_ -> DepList (deplist, type);}
00089 
00091   expression *simplify ();
00092 
00095   virtual inline int Linearity ()
00096   {return NONLINEAR;}
00097 
00100   virtual exprAux *standardize (CouenneProblem *, bool addAux = true);
00101 
00103   virtual inline enum expr_type code () 
00104   {return COU_EXPRUNARY;}
00105 
00107   virtual bool isInteger ();
00108 
00110   virtual int compare (exprUnary &); 
00111 
00113   virtual inline int rank ()
00114   {return (argument_ -> rank ());} 
00115 
00117   virtual inline void fillDepSet (std::set <DepNode *, compNode> *dep, DepGraph *g) 
00118   {argument_ -> fillDepSet (dep, g);}
00119 
00121   virtual void replace (exprVar *, exprVar *);
00122 
00124   virtual inline void realign (const CouenneProblem *p) 
00125   {argument_ -> realign (p);}
00126 };
00127 
00128 #endif

Generated on Wed Oct 7 03:10:23 2009 for Couenne by  doxygen 1.4.7