00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "CglCutGenerator.hpp"
00012 #include "CouenneTypes.hpp"
00013 #include "CouenneProblem.hpp"
00014 #include "BonAuxInfos.hpp"
00015
00016 namespace Couenne {
00017
00018
00019
00021 void updateBranchInfo (const OsiSolverInterface &si, CouenneProblem *p,
00022 t_chg_bounds *chg_bds, const CglTreeInfo &info) {
00023
00024 int ncols = p -> nVars ();
00025
00026 if ((info.inTree) && (info.pass==0)) {
00027
00028
00029
00030
00031
00032 OsiBabSolver *auxinfo = dynamic_cast <OsiBabSolver *> (si.getAuxiliaryInfo ());
00033
00034 bool
00035 have_parent_lower = false,
00036 have_parent_upper = false;
00037
00038 if (auxinfo && (auxinfo -> extraCharacteristics () & 2)) {
00039
00040
00041 const double
00042 *beforeLower = auxinfo -> beforeLower (),
00043 *beforeUpper = auxinfo -> beforeUpper ();
00044
00045 if (beforeLower || beforeUpper) {
00046
00047
00048 const double
00049 *nowLower = p -> Lb (),
00050 *nowUpper = p -> Ub ();
00051
00052 if (beforeLower) {
00053
00054 have_parent_lower = true;
00055
00056 for (int i=0; i < ncols; i++)
00057 if (*nowLower++ >= *beforeLower++ + COUENNE_EPS)
00058 chg_bds [i].setLower (t_chg_bounds::CHANGED);
00059 }
00060
00061 if (beforeUpper) {
00062
00063 have_parent_upper = true;
00064
00065 for (int i=0; i < ncols; i++)
00066 if (*nowUpper++ <= *beforeUpper++ - COUENNE_EPS)
00067 chg_bds [i].setUpper (t_chg_bounds::CHANGED);
00068 }
00069 }
00070 }
00071
00072
00073
00074 if (!have_parent_lower ||
00075 !have_parent_upper) {
00076
00077 #ifdef DEBUG
00078 printf ("### Warning: could not access parent node's %sbounds in generateCuts()\n",
00079 have_parent_lower ? "upper " : have_parent_upper ? "lower " : "");
00080 #endif
00081
00082
00083 if (!have_parent_lower)
00084 for (int i=0; i < ncols; i++)
00085 chg_bds [i].setLower (t_chg_bounds::CHANGED);
00086
00087 if (!have_parent_upper)
00088 for (int i=0; i < ncols; i++)
00089 chg_bds [i].setUpper (t_chg_bounds::CHANGED);
00090 }
00091 }
00092 }
00093 }