# source:trunk/Couenne/src/expression/operators/CouenneExprCeil.hpp@595

Last change on this file since 595 was 595, checked in by pbelotti, 3 years ago

File size: 2.6 KB
RevLine
[595]1/* \$Id\$
2 *
3 * Name:    exprCeil.hpp
4 * Author:  Pietro Belotti
5 * Purpose: definition of ceiling
6 *
7 * (C) Pietro Belotti, 2011.
9 */
10
11#ifndef COUENNE_EXPRCEIL_HPP
12#define COUENNE_EXPRCEIL_HPP
13
14#include "CouenneExpression.hpp"
15
16namespace Couenne {
17
18/// class ceiling
19
20class exprCeil: public exprUnary {
21
22 public:
23
24  /// constructor, destructor
25  exprCeil (expression *arg):
26    exprUnary (arg) {}
27
28  /// cloning method
29  expression *clone (Domain *d = NULL) const
30  {return new exprCeil (argument_ -> clone (d));}
31
32  //// the operator's function
33  inline unary_function F ()
34  {return ceil;}
35
36  /// print operator
37  std::string printOp () const
38  {return "ceil";}
39
40  /// return l-2 norm of gradient at given point
41  inline CouNumber gradientNorm (const double *x) {
42    return (argument_ -> Index () < 0) ?
43      0. : fabs (x [argument_ -> Index ()]);
44  }
45
46  /// obtain derivative of expression
47  expression *differentiate (int index);
48
49  /// Get lower and upper bound of an expression (if any)
50  void getBounds (expression *&, expression *&);
51
52  /// Get value of lower and upper bound of an expression
53  void getBounds (CouNumber &lb, CouNumber &ub);
54
55  /// generate equality between *this and *w
56  void generateCuts (expression *w, //const OsiSolverInterface &si,
57                     OsiCuts &cs, const CouenneCutGenerator *cg,
58                     t_chg_bounds * = NULL, int = -1,
59                     CouNumber = -COUENNE_INFINITY,
60                     CouNumber =  COUENNE_INFINITY);
61
62  /// code for comparisons
63  virtual enum expr_type code ()
64  {return COU_EXPRCEIL;}
65
66  /// implied bound processing
67  bool impliedBound (int index, CouNumber *l, CouNumber *u, t_chg_bounds *chg, enum auxSign = expression::AUX_EQ) {
68
69    bool impl = true;
70    return impl;
71  }
72
73  /// Set up branching object by evaluating many branching points for
74  /// each expression's arguments
75  virtual CouNumber selectBranch (const CouenneObject *obj,
76                                  const OsiBranchingInformation *info,
77                                  expression * &var,
78                                  double * &brpts,
79                                  double * &brDist, // distance of current LP
80                                                    // point to new convexifications
81                                  int &way)
82  {return 0.;}
83
84  /// closest feasible points in function in both directions
85  virtual void closestFeasible (expression *varind, expression *vardep,
86                                CouNumber& left, CouNumber& right) const;
87
88  /// can this expression be further linearized or are we on its