Couenne 0.5.8
Loading...
Searching...
No Matches
CouenneExprMin.hpp
Go to the documentation of this file.
1/* $Id: CouenneExprMin.hpp 1147 2015-05-04 14:01:51Z stefan $
2 *
3 * Name: exprMin.hpp
4 * Author: Pietro Belotti
5 * Purpose: definition of $\f{\textrm{argmin}_{i\in I} y_i}$
6 *
7 * (C) Carnegie-Mellon University, 2006-09.
8 * This file is licensed under the Eclipse Public License (EPL)
9 */
10
11#ifndef COUENNE_EXPRMIN_H
12#define COUENNE_EXPRMIN_H
13
14#include "CouenneExprOp.hpp"
15#include "CouenneExprCopy.hpp"
16#include "CouenneExprStore.hpp"
17
18// TODO: CouenneObject might take expression of the form
19// min(x1,x2,...,xn) and branch it by creating two subsets N1 and N2
20// of N={1,2,...,n} and then impose the constraints
21//
22// (xi <= xj for i in N1, j in N2) OR
23// (xi >= xj for i in N1, j in N2)
24
25namespace Couenne {
26
28
29class exprMin: public exprOp {
30
31 public:
32
34 exprMin (expression **al, int n):
35 exprOp (al, n) {}
36
39 exprOp (new expression * [4], 4) {
40 arglist_ [0] = new exprCopy (el0); arglist_ [1] = new exprStore (arglist_ [0]);
41 arglist_ [2] = new exprCopy (el1); arglist_ [3] = new exprStore (arglist_ [2]);
42 }
43
45 exprMin *clone (Domain *d = NULL) const
46 {return new exprMin (clonearglist (d), nargs_);}
47
49 std::string printOp () const
50 {return "min";}
51
53 enum pos printPos () const
54 {return PRE;}
55
58
61 {return NULL;}
62
64 inline expression *simplify ()
65 {return NULL;}
66
68 virtual inline int Linearity ()
69 {return NONLINEAR;}
70
71 // Get lower and upper bound of an expression (if any)
73
76 virtual inline exprAux *standardize (CouenneProblem *, bool addAux = true)
77 {return NULL;}
78
80 void generateCuts (expression *w, //const OsiSolverInterface &si,
81 OsiCuts &cs, const CouenneCutGenerator *cg,
82 t_chg_bounds * = NULL, int = -1,
85
87 virtual enum expr_type code ()
88 {return COU_EXPRMIN;}
89};
90
91
93
95
96 CouNumber best_val = (*(arglist_ [0])) ();
97 int best_ind = 0;
98
99 for (int ind = 2; ind < nargs_; ind += 2) {
100
101 CouNumber val = (*(arglist_ [ind])) ();
102
103 if (val < best_val) {
104 best_ind = ind;
105 best_val = val;
106 }
107 }
108
109 return (*(arglist_ [best_ind + 1])) ();
110}
111
112}
113
114#endif
#define COUENNE_INFINITY
Cut Generator for linear convexifications.
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.
class for minima
std::string printOp() const
Print operator.
virtual int Linearity()
get a measure of "how linear" the expression is (see CouenneTypes.h)
CouNumber operator()()
Function for the evaluation of the expression.
enum pos printPos() const
Print operator.
expression * simplify()
Simplification.
exprMin(expression *el0, expression *el1)
Constructor with only two arguments.
virtual enum expr_type code()
Code for comparisons.
exprMin(expression **al, int n)
Constructor.
expression * differentiate(int)
Differentiation.
virtual exprAux * standardize(CouenneProblem *, bool addAux=true)
Reduce expression in standard form, creating additional aux variables (and constraints)
exprMin * clone(Domain *d=NULL) const
Cloning method.
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.
void getBounds(expression *&, expression *&)
Get lower and upper bound of an expression (if any)
general n-ary operator-type expression: requires argument list.
int nargs_
number of arguments (cardinality of arglist)
expression ** arglist_
argument list is an array of pointers to other expressions
expression ** clonearglist(Domain *d=NULL) const
clone argument list (for use with clone method)
storage class for previously evaluated expressions
Expression base class.
status of lower/upper bound of a variable, to be checked/modified in bound tightening
general include file for different compilers
pos
position where the operator should be printed when printing the expression
double CouNumber
main number type in Couenne
expr_type
code returned by the method expression::code()