1 | /* |
---|

2 | * Name: exprAbs.h |
---|

3 | * Author: Pietro Belotti |
---|

4 | * Purpose: definition of the absolute value of a function |
---|

5 | * |
---|

6 | * (C) Pietro Belotti. This file is licensed under the Common Public License (CPL) |
---|

7 | */ |
---|

8 | |
---|

9 | #ifndef COUENNE_EXPRABS_H |
---|

10 | #define COUENNE_EXPRABS_H |
---|

11 | |
---|

12 | #include <math.h> |
---|

13 | |
---|

14 | #include <exprUnary.h> |
---|

15 | #include <exprConst.h> |
---|

16 | |
---|

17 | |
---|

18 | /// class for abs f(x) |
---|

19 | |
---|

20 | class exprAbs: public exprUnary { |
---|

21 | |
---|

22 | public: |
---|

23 | |
---|

24 | // Constructors, destructor |
---|

25 | exprAbs (expression *al): |
---|

26 | exprUnary (al) {} //< non-leaf expression, with argument list |
---|

27 | |
---|

28 | /// the operator's function |
---|

29 | inline unary_function F () {return fabs;} |
---|

30 | |
---|

31 | /// cloning method |
---|

32 | expression *clone () const |
---|

33 | {return new exprAbs (argument_ -> clone ());} |
---|

34 | |
---|

35 | /// I/O |
---|

36 | void print (std::ostream&) const; |
---|

37 | |
---|

38 | /// differentiation |
---|

39 | expression *differentiate (int index); |
---|

40 | |
---|

41 | /// Get lower and upper bound of an expression (if any) |
---|

42 | void getBounds (expression *&, expression *&); |
---|

43 | |
---|

44 | /// generate equality between *this and *w |
---|

45 | void generateCuts (exprAux *w, const OsiSolverInterface &si, |
---|

46 | OsiCuts &cs, const CouenneCutGenerator *cg); |
---|

47 | |
---|

48 | /// code for comparisons |
---|

49 | enum expr_type code () {return COU_EXPRABS;} |
---|

50 | |
---|

51 | /// implied bound processing |
---|

52 | bool impliedBound (int, CouNumber *, CouNumber *, char *); |
---|

53 | }; |
---|

54 | |
---|

55 | #endif |
---|