conv-exprQuad.cpp
Go to the documentation of this file.
1 /* $Id: conv-exprQuad.cpp 490 2011-01-14 16:07:12Z pbelotti $
2  *
3  * Name: conv-exprQuad.cpp
4  * Authors: Pierre Bonami
5  * Stefan Vigerske
6  * Pietro Belotti
7  * Purpose: implementation of convexification methods for exprQuad
8  *
9  * (C) Carnegie-Mellon University, 2006-09.
10  * This file is licensed under the Eclipse Public License (EPL)
11  */
12 
13 #include "OsiRowCut.hpp"
14 #include "OsiCuts.hpp"
15 
16 #include "CouenneCutGenerator.hpp"
17 
18 #include "CouenneExprAux.hpp"
19 #include "CouenneExprQuad.hpp"
20 #include "CouenneExprBQuad.hpp"
21 
22 using namespace Couenne;
23 
26 
27  lb = new exprLBQuad (this);
28  ub = new exprUBQuad (this);
29 
30  /*printf ("generated quad bounds:\n ");
31  lb -> print (); printf (" [%g]\n ", (*lb) ());
32  ub -> print (); printf (" [%g]\n", (*ub) ());*/
33 }
34 
35 
38  expression::getBounds (lb, ub);
39 }
40 
41 
42 
43 // generate equality between *this and *w
44 void exprQuad::generateCuts (expression *w, //const OsiSolverInterface &si,
45  OsiCuts &cs, const CouenneCutGenerator *cg,
46  t_chg_bounds *chg,
47  int wind, CouNumber lb, CouNumber ub) {
48 
49  if (((!(cg -> isFirst ())) && // unless a convexification was never created,
50  (fabs ((*this) () - (*w) ()) < COUENNE_EPS)) // do we really need a convexification cut?
51  || !alphaConvexify (cg -> Problem ())) // ... or a new alpha-convexification?
52  return;
53 
54  /*int
55  nrc = cs.sizeRowCuts (),
56  ncc = cs.sizeColCuts ();*/
57 
58  // generate linear cuts for convex quadratic [upper|lower]-envelope
59  // of this expression
60  quadCuts (w, cs, cg);
61 
62  /*if (cs.sizeRowCuts () > nrc) {
63  printf ("------------------ constraint row cuts\n");
64  for (int i=nrc; i<cs.sizeRowCuts (); i++)
65  cs.rowCutPtr (i) -> print ();
66  }
67  if (cs.sizeColCuts () > nrc) {
68  printf ("================== constraint col cuts\n");
69  for (int i=ncc; i<cs.sizeColCuts (); i++)
70  cs.colCutPtr (i) -> print ();
71  }*/
72 }
Cut Generator for linear convexifications.
status of lower/upper bound of a variable, to be checked/modified in bound tightening ...
class to compute upper bound of a fraction based on the bounds of both numerator and denominator ...
virtual void generateCuts(expression *w, OsiCuts &cs, const CouenneCutGenerator *cg, t_chg_bounds *=NULL, int=-1, CouNumber=-COUENNE_INFINITY, CouNumber=COUENNE_INFINITY)
Generate cuts for the quadratic expression, which are supporting hyperplanes of the concave upper env...
class to compute lower bound of a fraction based on the bounds of both numerator and denominator ...
void quadCuts(expression *w, OsiCuts &cs, const CouenneCutGenerator *cg)
method exprQuad::quadCuts
Definition: quadCuts.cpp:22
#define COUENNE_EPS
virtual void getBounds(expression *&, expression *&)
Get lower and upper bound of an expression (if any)
double CouNumber
main number type in Couenne
virtual void getBounds(expression *&, expression *&)
Get lower and upper bound of an expression (if any)
Definition: expression.cpp:32
Expression base class.
void fint fint fint real fint real real real real real real real real * w
virtual bool alphaConvexify(const CouenneProblem *)
Compute data for -convexification of a quadratic form (fills in dCoeff_ and dIndex_ for the convex un...