/home/coin/SVN-release/OS-2.1.1/Couenne/src/expression/exprOp.hpp

Go to the documentation of this file.
00001 /* $Id: exprOp.hpp 217 2009-07-08 17:02:07Z pbelotti $
00002  *
00003  * Name:    exprOp.hpp
00004  * Author:  Pietro Belotti
00005  * Purpose: definition of the n-ary expression class
00006  *
00007  * (C) Carnegie-Mellon University, 2006-08.
00008  * This file is licensed under the Common Public License (CPL)
00009  */
00010 
00011 #ifndef COUENNE_EXPROP_HPP
00012 #define COUENNE_EXPROP_HPP
00013 
00014 #include <iostream>
00015 
00016 #include "expression.hpp"
00017 #include "CouenneTypes.hpp"
00018 
00019 #define MAX_ARG_LINE 10
00020 
00021 class CouenneProblem;
00022 class Domain;
00023 
00028 
00029 class exprOp: public expression {
00030 
00031  protected:
00032 
00033   expression **arglist_; 
00034   int          nargs_;   
00035 
00036  public:
00037 
00039   virtual inline enum nodeType Type () const
00040     {return N_ARY;}
00041 
00043   exprOp (expression **arglist, int nargs):  //< non-leaf expression, with argument list 
00044     arglist_ (arglist),
00045     nargs_   (nargs)
00046     {}
00047 
00049   exprOp (expression *arg0, expression *arg1):  //< two arguments 
00050     arglist_ (new expression * [2]),
00051     nargs_   (2)
00052     {arglist_ [0] = arg0; arglist_ [1] = arg1;}
00053 
00055   virtual ~exprOp ();
00056 
00059   exprOp (const exprOp &e, Domain *d = NULL):
00060     arglist_ (new expression * [e.nArgs ()]),
00061     nargs_   (e.nArgs ()) {}
00062 
00064   inline expression **ArgList () const 
00065   {return arglist_;}
00066 
00068   virtual inline void ArgList (expression **al) 
00069   {arglist_ = al;}
00070 
00072   inline int nArgs () const 
00073   {return nargs_;}
00074 
00076   virtual void print (std::ostream &out = std::cout,
00077                       bool = false) const;
00078 
00080   virtual enum pos printPos () const
00081   {return INSIDE;}
00082 
00084   virtual std::string printOp () const
00085   {return "??";}
00086 
00089   virtual int DepList (std::set <int> &deplist, enum dig_type type = ORIG_ONLY);
00090 
00092   virtual expression *simplify ();
00093 
00095   expression **clonearglist (Domain *d = NULL) const {
00096     if (nargs_) {
00097       expression **al = new expression * [nargs_];
00098       for (register int i=0; i<nargs_; i++)
00099         al [i] = arglist_ [i] -> clone (d);
00100       return al;
00101     } else return NULL;
00102   }
00103 
00105   int shrink_arglist (CouNumber, CouNumber);
00106 
00108   virtual inline int Linearity ()
00109   {return NONLINEAR;}
00110 
00112   virtual exprAux *standardize (CouenneProblem *, bool addAux = true);
00113 
00115   virtual inline enum expr_type code ()
00116   {return COU_EXPROP;}
00117 
00119   virtual bool isInteger ();
00120 
00122   virtual int compare (exprOp &);
00123 
00125   virtual int rank ();
00126 
00129   virtual void fillDepSet (std::set <DepNode *, compNode> *dep, DepGraph *g) {
00130     for (int i=nargs_; i--;)
00131       arglist_ [i] -> fillDepSet (dep, g);
00132   }
00133 
00135   virtual void replace (exprVar *, exprVar *);
00136 
00138   virtual void realign (const CouenneProblem *p);
00139 };
00140 
00141 #endif

Generated on Mon May 3 03:05:20 2010 by  doxygen 1.4.7