# CouenneExprUnary.hpp

Go to the documentation of this file.

    00001 /* $Id: CouenneExprUnary.hpp 614 2011-06-08 14:20:39Z 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 Eclipse Public License (EPL)
    00009  */
    00010
    00011 #ifndef COUENNE_EXPRUNARY_HPP
    00012 #define COUENNE_EXPRUNARY_HPP
    00013
    00014 #include <iostream>
    00015
    00016 #include "CouenneExpression.hpp"
    00017 #include "CouenneTypes.hpp"
    00018
    00019 namespace Couenne {
    00020
    00022 inline CouNumber zero_fun (CouNumber x)
    00023 {return 0.;}
    00024
    00025
    00032
    00033 class exprUnary: public expression {
    00034
    00035  protected:
    00036
    00038   expression *argument_;
    00039
    00040  public:
    00041
    00043   virtual inline enum nodeType Type () const
    00044   {return UNARY;}
    00045
    00047   exprUnary  (expression *argument):
    00048     argument_ (argument)        //< non-leaf expression, with argument list
    00049   {}
    00050
    00052   virtual inline unary_function F ()
    00053   {return zero_fun;}
    00054
    00056   ~exprUnary ()
    00057   {if (argument_) delete argument_;}
    00058
    00060   inline int nArgs () const
    00061   {return 1;}
    00062
    00064   virtual inline expression *Argument () const
    00065   {return argument_;}
    00066
    00068   virtual inline expression **ArgPtr ()
    00069   {return &argument_;}
    00070
    00072   virtual void print (std::ostream &out = std::cout, bool = false) const;
    00073
    00075   virtual enum pos printPos () const
    00076   {return PRE;}
    00077
    00079   virtual std::string printOp () const
    00080   {return "?";}
    00081
    00083   virtual inline CouNumber operator () ()
    00084   {return (F ()) ((*argument_) ());}
    00085
    00088   virtual inline int DepList (std::set <int> &deplist, enum dig_type type = ORIG_ONLY)
    00089   {return argument_ -> DepList (deplist, type);}
    00090
    00092   expression *simplify ();
    00093
    00096   virtual inline int Linearity ()
    00097   {return NONLINEAR;}
    00098
    00101   virtual exprAux *standardize (CouenneProblem *, bool addAux = true);
    00102
    00104   virtual inline enum expr_type code ()
    00105   {return COU_EXPRUNARY;}
    00106
    00108   virtual bool isInteger ();
    00109
    00111   virtual int compare (exprUnary &);
    00112
    00114   virtual inline int rank ()
    00115   {return (argument_ -> rank ());}
    00116
    00118   virtual inline void fillDepSet (std::set <DepNode *, compNode> *dep, DepGraph *g)
    00119   {argument_ -> fillDepSet (dep, g);}
    00120
    00122   virtual void replace (exprVar *, exprVar *);
    00123
    00125   virtual inline void realign (const CouenneProblem *p)
    00126   {argument_ -> realign (p);}
    00127 };
    00128
    00129 }
    00130
    00131 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines