Couenne 0.5.8
Loading...
Searching...
No Matches
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
18namespace Couenne {
19
21
23
24class exprMul: public exprOp {
25
26 public:
27
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
50
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;
97protected:
98
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
136
137
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
148 int xi, int yi, int wi, int brind, double *brpt, int nPts = 1);
149
150}
151
152#endif
#define COUENNE_INFINITY
Cut Generator for linear convexifications.
OsiObject for auxiliary variables $w=f(x)$.
Class for MINLP problems with symbolic information.
Define a dynamic point+bounds, with a way to save and restore previous points+bounds through a LIFO s...
Auxiliary variable.
virtual CouNumber gradientNorm(const double *x)
return l-2 norm of gradient at given point
virtual void getBounds(CouNumber &lb, CouNumber &ub)
Get value of lower and upper bound of an expression (if any)
virtual expression * clone(Domain *d=NULL) const
Cloning method.
exprMul(expression **, int)
Constructor.
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 void closestFeasible(expression *varind, expression *vardep, CouNumber &left, CouNumber &right) const
compute and for Violation Transfer algorithm
virtual bool isCuttable(CouenneProblem *problem, int index) const
can this expression be further linearized or are we on its concave ("bad") side
virtual int Linearity()
get a measure of "how linear" the expression is:
virtual bool impliedBound(int, CouNumber *, CouNumber *, t_chg_bounds *, enum Couenne::expression::auxSign=Couenne::expression::AUX_EQ)
implied bound processing
virtual enum expr_type code()
code for comparison
expression * simplify()
simplification
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's arguments
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
CouNumber balancedMul(const OsiBranchingInformation *info, int index, int wind)
balanced strategy for branching point selection in products
expression * differentiate(int index)
differentiation
exprMul(expression *, expression *)
Constructor with two arguments.
CouNumber operator()()
Method to evaluate the expression.
virtual exprAux * standardize(CouenneProblem *p, bool addAux=true)
reduce expression in standard form, creating additional aux variables (and constraints)
std::string printOp() const
Print operator.
int nargs_
number of arguments (cardinality of arglist)
expression ** arglist_
argument list is an array of pointers to other expressions
exprOp(expression **arglist, int nargs)
Constructor.
expression ** clonearglist(Domain *d=NULL) const
clone argument list (for use with clone method)
Expression base class.
auxSign
"sign" of the constraint defining an auxiliary.
status of lower/upper bound of a variable, to be checked/modified in bound tightening
general include file for different compilers
double CouNumber
main number type in Couenne
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
double * computeMulBrDist(const OsiBranchingInformation *info, int xi, int yi, int wi, int brind, double *brpt, int nPts=1)
compute distance from future convexifications in set with x,y,w bounded.
expr_type
code returned by the method expression::code()
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