# CouenneExprSum.hpp

Go to the documentation of this file.

    00001 /* $Id: CouenneExprSum.hpp 615 2011-06-08 20:36:24Z pbelotti $
    00002  *
    00003  * Name:    exprSum.hpp
    00004  * Author:  Pietro Belotti
    00005  * Purpose: definition of sum expressions
    00006  *
    00007  * (C) Carnegie-Mellon University, 2006-10.
    00008  * This file is licensed under the Eclipse Public License (EPL)
    00009  */
    00010
    00011 #ifndef COUENNE_EXPRSUM_H
    00012 #define COUENNE_EXPRSUM_H
    00013
    00014 #include <vector>
    00015
    00016 #include "CouenneExprOp.hpp"
    00017
    00018 namespace Couenne {
    00019
    00021
    00022 class exprSum: public exprOp {
    00023
    00024  public:
    00025
    00027   exprSum  (expression ** = NULL, int = 0);
    00028
    00030   exprSum (expression *, expression *);
    00031
    00033   virtual ~exprSum () {}
    00034
    00036   virtual expression *clone (Domain *d = NULL) const
    00037     {return new exprSum (clonearglist (d), nargs_);}
    00038
    00040   std::string printOp () const
    00041     {return "+";}
    00042
    00044   virtual CouNumber operator () ();
    00045
    00047   virtual expression *differentiate (int index);
    00048
    00050   virtual expression *simplify ();
    00051
    00053   virtual int Linearity ();
    00054
    00056   virtual void getBounds (expression *&, expression *&);
    00057
    00059   virtual void getBounds (CouNumber &, CouNumber &);
    00060
    00063   virtual exprAux *standardize (CouenneProblem *p, bool addAux = true);
    00064
    00066   virtual void generateCuts (expression *, //const OsiSolverInterface &,
    00067                              OsiCuts &, const CouenneCutGenerator *,
    00068                              t_chg_bounds * = NULL, int = -1,
    00069                              CouNumber = -COUENNE_INFINITY,
    00070                              CouNumber =  COUENNE_INFINITY);
    00071
    00073   virtual enum expr_type code ()
    00074     {return COU_EXPRSUM;}
    00075
    00097   virtual bool impliedBound (int, CouNumber *, CouNumber *, t_chg_bounds *, enum auxSign = expression::AUX_EQ);
    00098
    00102   exprAux *createQuadratic (CouenneProblem *);
    00103
    00104 protected:
    00105
    00107   int impliedBoundSum (CouNumber wl,
    00108                        CouNumber wu,
    00109                        std::vector <CouNumber> &xl,
    00110                        std::vector <CouNumber> &xu,
    00111                        std::vector <std::pair <int, CouNumber> > &nl,
    00112                        std::vector <std::pair <int, CouNumber> > &nu);
    00113 };
    00114
    00115
    00117
    00118 inline CouNumber exprSum::operator () () {
    00119
    00120   CouNumber ret = 0;
    00121
    00122   expression **al = arglist_;
    00123
    00124   for (int n = nargs_; n--;)
    00125     ret += (**al++) ();
    00126
    00127   return ret;
    00128 }
    00129
    00130 }
    00131
    00132 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines