/home/coin/SVN-release/OS-2.4.2/Couenne/src/convex/operators/conv-exprQuad.cpp

Go to the documentation of this file.
00001 /* $Id: conv-exprQuad.cpp 490 2011-01-14 16:07:12Z pbelotti $
00002  *
00003  * Name:    conv-exprQuad.cpp
00004  * Authors: Pierre Bonami
00005  *          Stefan Vigerske
00006  *          Pietro Belotti
00007  * Purpose: implementation of convexification methods for exprQuad
00008  *
00009  * (C) Carnegie-Mellon University, 2006-09.
00010  * This file is licensed under the Eclipse Public License (EPL)
00011  */
00012 
00013 #include "OsiRowCut.hpp"
00014 #include "OsiCuts.hpp"
00015 
00016 #include "CouenneCutGenerator.hpp"
00017 
00018 #include "CouenneExprAux.hpp"
00019 #include "CouenneExprQuad.hpp"
00020 #include "CouenneExprBQuad.hpp"
00021 
00022 using namespace Couenne;
00023 
00025 void exprQuad::getBounds (expression *&lb, expression *&ub) {
00026 
00027   lb = new exprLBQuad (this);
00028   ub = new exprUBQuad (this);
00029 
00030   /*printf ("generated quad bounds:\n  ");
00031   lb -> print (); printf (" [%g]\n  ", (*lb) ());
00032   ub -> print (); printf (" [%g]\n",   (*ub) ());*/
00033 }
00034 
00035 
00037 void exprQuad::getBounds (CouNumber &lb, CouNumber &ub) {
00038   expression::getBounds (lb, ub);
00039 }
00040 
00041 
00042 
00043 // generate equality between *this and *w
00044 void exprQuad::generateCuts (expression *w, //const OsiSolverInterface &si, 
00045                              OsiCuts &cs, const CouenneCutGenerator *cg,
00046                              t_chg_bounds *chg, 
00047                              int wind, CouNumber lb, CouNumber ub) {
00048 
00049   if (((!(cg -> isFirst ())) &&                     // unless a convexification was never created,
00050        (fabs ((*this) () - (*w) ()) < COUENNE_EPS)) // do we really need a convexification cut?
00051       || !alphaConvexify (cg -> Problem ()))        // ... or a new alpha-convexification?
00052     return;
00053 
00054   /*int 
00055     nrc = cs.sizeRowCuts (),
00056     ncc = cs.sizeColCuts ();*/
00057 
00058   // generate linear cuts for convex quadratic [upper|lower]-envelope
00059   // of this expression
00060   quadCuts (w, cs, cg);
00061 
00062   /*if (cs.sizeRowCuts () > nrc) {
00063     printf ("------------------ constraint row cuts\n");
00064     for (int i=nrc; i<cs.sizeRowCuts (); i++) 
00065       cs.rowCutPtr (i) -> print ();
00066   }
00067   if (cs.sizeColCuts () > nrc) {
00068     printf ("================== constraint col cuts\n");
00069     for (int i=ncc; i<cs.sizeColCuts (); i++) 
00070       cs.colCutPtr (i) -> print ();
00071       }*/
00072 }

Generated on Wed Nov 30 03:03:58 2011 by  doxygen 1.4.7