CouenneExprMul.hpp
Go to the documentation of this file.
1 /* $Id: CouenneExprMul.hpp 811 2012-02-01 19:21:41Z pbelotti $
2  *
3  * Name: exprMul.hpp
4  * Author: Pietro Belotti
5  * Purpose: definition of multiplications
6  *
7  * (C) Carnegie-Mellon University, 2006-10.
8  * This file is licensed under the Eclipse Public License (EPL)
9  */
10 
11 #ifndef COUENNE_EXPRMUL_H
12 #define COUENNE_EXPRMUL_H
13 
14 #include <vector>
15 
16 #include "CouenneExprOp.hpp"
17 
18 namespace Couenne {
19 
20 class CouenneCutGenerator;
21 
23 
24 class exprMul: public exprOp {
25 
26  public:
27 
29  exprMul (expression **, int);
30 
33 
35  virtual expression *clone (Domain *d = NULL) const
36  {return new exprMul (clonearglist (d), nargs_);}
37 
39  std::string printOp () const
40  {return "*";}
41 
43  inline CouNumber operator () ();
44 
46  virtual CouNumber gradientNorm (const double *x);
47 
49  expression *differentiate (int index);
50 
52  expression *simplify ();
53 
55  virtual int Linearity ();
56 
58  virtual void getBounds (expression *&, expression *&);
59 
61  virtual void getBounds (CouNumber &lb, CouNumber &ub);
62 
65  virtual exprAux *standardize (CouenneProblem *p, bool addAux = true);
66 
68  virtual void generateCuts (expression *w, //const OsiSolverInterface &si,
69  OsiCuts &cs, const CouenneCutGenerator *cg,
70  t_chg_bounds * = NULL, int = -1,
73 
75  virtual enum expr_type code ()
76  {return COU_EXPRMUL;}
77 
79  virtual bool impliedBound (int, CouNumber *, CouNumber *, t_chg_bounds *,
81 
84  virtual CouNumber selectBranch (const CouenneObject *obj,
85  const OsiBranchingInformation *info,
86  expression * &var,
87  double * &brpts,
88  double * &brDist, // distance of current LP
89  // point to new convexifications
90  int &way);
91 
93  virtual void closestFeasible (expression *varind,
94  expression *vardep,
95  CouNumber &left,
96  CouNumber &right) const;
97 protected:
98 
100  int impliedBoundMul (CouNumber wl,
101  CouNumber wu,
102  std::vector <CouNumber> &xl,
103  std::vector <CouNumber> &xu,
104  std::vector <std::pair <int, CouNumber> > &nl,
105  std::vector <std::pair <int, CouNumber> > &nu);
106 
108  CouNumber balancedMul (const OsiBranchingInformation *info, int index, int wind);
109 
112  virtual bool isCuttable (CouenneProblem *problem, int index) const
113  {return false;} // concave on both sides, as for products
114 };
115 
116 
119 
120  CouNumber ret = 1.;
121  expression **al = arglist_;
122 
123  for (int n = nargs_; n--;)
124  ret *= (**al++) ();
125 
126  return ret;
127 }
128 
129 
131 void unifiedProdCuts (const CouenneCutGenerator *, OsiCuts &,
136 
137 
139 void upperEnvHull (const CouenneCutGenerator *cg, OsiCuts &cs,
140  int xi, CouNumber x0, CouNumber xl, CouNumber xu,
141  int yi, CouNumber y0, CouNumber yl, CouNumber yu,
142  int wi, CouNumber w0, CouNumber wl, CouNumber wu);
143 
144 
147 double *computeMulBrDist (const OsiBranchingInformation *info,
148  int xi, int yi, int wi, int brind, double *brpt, int nPts = 1);
149 
150 }
151 
152 #endif
Cut Generator for linear convexifications.
std::string printOp() const
Print operator.
expression * differentiate(int index)
differentiation
Definition: exprMul.cpp:147
virtual void closestFeasible(expression *varind, expression *vardep, CouNumber &left, CouNumber &right) const
compute and for Violation Transfer algorithm
Definition: exprMul.cpp:210
void unifiedProdCuts(const CouenneCutGenerator *, OsiCuts &, int, CouNumber, CouNumber, CouNumber, int, CouNumber, CouNumber, CouNumber, int, CouNumber, CouNumber, CouNumber, t_chg_bounds *, enum expression::auxSign)
unified convexification of products and divisions
void fint fint fint real fint real real real real real real real real real fint real fint fint fint real fint fint fint fint * info
OsiObject for auxiliary variables $w=f(x)$.
status of lower/upper bound of a variable, to be checked/modified in bound tightening ...
virtual void generateCuts(expression *w, OsiCuts &cs, const CouenneCutGenerator *cg, t_chg_bounds *=NULL, int=-1, CouNumber=-COUENNE_INFINITY, CouNumber=COUENNE_INFINITY)
generate equality between *this and *w
virtual enum expr_type code()
code for comparison
CouNumber operator()()
Method to evaluate the expression.
virtual bool isCuttable(CouenneProblem *problem, int index) const
can this expression be further linearized or are we on its concave (&quot;bad&quot;) side
virtual CouNumber gradientNorm(const double *x)
return l-2 norm of gradient at given point
Definition: exprMul.cpp:238
virtual expression * clone(Domain *d=NULL) const
Cloning method.
virtual int Linearity()
get a measure of &quot;how linear&quot; the expression is:
Definition: exprMul.cpp:184
ULong * x0
Definition: OSdtoa.cpp:1776
exprMul(expression **, int)
Constructor.
Definition: exprMul.cpp:28
auxSign
&quot;sign&quot; of the constraint defining an auxiliary.
expression * simplify()
simplification
Definition: exprMul.cpp:51
expression ** clonearglist(Domain *d=NULL) const
clone argument list (for use with clone method)
Class for MINLP problems with symbolic information.
virtual bool impliedBound(int, CouNumber *, CouNumber *, t_chg_bounds *, enum Couenne::expression::auxSign=Couenne::expression::AUX_EQ)
implied bound processing
double * computeMulBrDist(const OsiBranchingInformation *info, int xi, int yi, int wi, int brind, double *brpt, int nPts)
compute distance from future convexifications in set with x,y,w bounded.
void upperEnvHull(const CouenneCutGenerator *cg, OsiCuts &cs, int xi, CouNumber x0, CouNumber xl, CouNumber xu, int yi, CouNumber y0, CouNumber yl, CouNumber yu, int wi, CouNumber w0, CouNumber wl, CouNumber wu)
better cuts than those from unifiedProdCuts
CouNumber balancedMul(const OsiBranchingInformation *info, int index, int wind)
balanced strategy for branching point selection in products
virtual CouNumber selectBranch(const CouenneObject *obj, const OsiBranchingInformation *info, expression *&var, double *&brpts, double *&brDist, int &way)
set up branching object by evaluating many branching points for each expression&#39;s arguments ...
expression ** arglist_
argument list is an array of pointers to other expressions
double CouNumber
main number type in Couenne
int nargs_
number of arguments (cardinality of arglist)
general n-ary operator-type expression: requires argument list.
#define COUENNE_INFINITY
Auxiliary variable.
expr_type
code returned by the method expression::code()
Expression base class.
fint nu
void fint fint fint real fint real real real real real real real real * w
void fint * n
virtual exprAux * standardize(CouenneProblem *p, bool addAux=true)
reduce expression in standard form, creating additional aux variables (and constraints) ...
virtual void getBounds(expression *&, expression *&)
Get lower and upper bound of an expression (if any)
int impliedBoundMul(CouNumber wl, CouNumber wu, std::vector< CouNumber > &xl, std::vector< CouNumber > &xu, std::vector< std::pair< int, CouNumber > > &nl, std::vector< std::pair< int, CouNumber > > &nu)
inferring bounds on factors of a product
Define a dynamic point+bounds, with a way to save and restore previous points+bounds through a LIFO s...
void fint fint fint real fint real * x
class for multiplications,