# CouenneExprMul.hpp

Go to the documentation of this file.

    00001 /* $Id: CouenneExprMul.hpp 811 2012-02-01 19:21:41Z pbelotti $
    00002  *
    00003  * Name:    exprMul.hpp
    00004  * Author:  Pietro Belotti
    00005  * Purpose: definition of multiplications
    00006  *
    00007  * (C) Carnegie-Mellon University, 2006-10.
    00008  * This file is licensed under the Eclipse Public License (EPL)
    00009  */
    00010
    00011 #ifndef COUENNE_EXPRMUL_H
    00012 #define COUENNE_EXPRMUL_H
    00013
    00014 #include <vector>
    00015
    00016 #include "CouenneExprOp.hpp"
    00017
    00018 namespace Couenne {
    00019
    00020 class CouenneCutGenerator;
    00021
    00023
    00024 class exprMul: public exprOp {
    00025
    00026  public:
    00027
    00029   exprMul (expression **, int);
    00030
    00032   exprMul (expression *, expression *);
    00033
    00035   virtual expression *clone (Domain *d = NULL) const
    00036   {return new exprMul (clonearglist (d), nargs_);}
    00037
    00039   std::string printOp () const
    00040   {return "*";}
    00041
    00043   inline CouNumber operator () ();
    00044
    00046   virtual CouNumber gradientNorm (const double *x);
    00047
    00049   expression *differentiate (int index);
    00050
    00052   expression *simplify ();
    00053
    00055   virtual int Linearity ();
    00056
    00058   virtual void getBounds (expression *&, expression *&);
    00059
    00061   virtual void getBounds (CouNumber &lb, CouNumber &ub);
    00062
    00065   virtual exprAux *standardize (CouenneProblem *p, bool addAux = true);
    00066
    00068   virtual void generateCuts (expression *w, //const OsiSolverInterface &si,
    00069                              OsiCuts &cs, const CouenneCutGenerator *cg,
    00070                              t_chg_bounds * = NULL, int = -1,
    00071                              CouNumber = -COUENNE_INFINITY,
    00072                              CouNumber =  COUENNE_INFINITY);
    00073
    00075   virtual enum expr_type code ()
    00076   {return COU_EXPRMUL;}
    00077
    00079   virtual bool impliedBound (int, CouNumber *, CouNumber *, t_chg_bounds *,
    00080                              enum Couenne::expression::auxSign = Couenne::expression::AUX_EQ);
    00081
    00084   virtual CouNumber selectBranch (const CouenneObject *obj,
    00085                                   const OsiBranchingInformation *info,
    00086                                   expression * &var,
    00087                                   double * &brpts,
    00088                                   double * &brDist, // distance of current LP
    00089                                                     // point to new convexifications
    00090                                   int &way);
    00091
    00093   virtual void closestFeasible (expression *varind,
    00094                                 expression *vardep,
    00095                                 CouNumber &left,
    00096                                 CouNumber &right) const;
    00097 protected:
    00098
    00100   int impliedBoundMul (CouNumber wl,
    00101                        CouNumber wu,
    00102                        std::vector <CouNumber> &xl,
    00103                        std::vector <CouNumber> &xu,
    00104                        std::vector <std::pair <int, CouNumber> > &nl,
    00105                        std::vector <std::pair <int, CouNumber> > &nu);
    00106
    00108   CouNumber balancedMul (const OsiBranchingInformation *info, int index, int wind);
    00109
    00112   virtual bool isCuttable (CouenneProblem *problem, int index) const
    00113   {return false;} // concave on both sides, as for products
    00114 };
    00115
    00116
    00118 inline CouNumber exprMul:: operator () () {
    00119
    00120   CouNumber ret = 1.;
    00121   expression **al = arglist_;
    00122
    00123   for (int n = nargs_; n--;)
    00124     ret *= (**al++) ();
    00125
    00126   return ret;
    00127 }
    00128
    00129
    00131 void unifiedProdCuts (const CouenneCutGenerator *, OsiCuts &,
    00132                       int, CouNumber, CouNumber, CouNumber,
    00133                       int, CouNumber, CouNumber, CouNumber,
    00134                       int, CouNumber, CouNumber, CouNumber,
    00135                       t_chg_bounds *, enum expression::auxSign);
    00136
    00137
    00139 void upperEnvHull (const CouenneCutGenerator *cg, OsiCuts &cs,
    00140                    int xi, CouNumber x0, CouNumber xl, CouNumber xu,
    00141                    int yi, CouNumber y0, CouNumber yl, CouNumber yu,
    00142                    int wi, CouNumber w0, CouNumber wl, CouNumber wu);
    00143
    00144
    00147 double *computeMulBrDist (const OsiBranchingInformation *info,
    00148                           int xi, int yi, int wi, int brind, double *brpt, int nPts = 1);
    00149
    00150 }
    00151
    00152 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines