00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "CouenneProblem.hpp"
00012
00014
00015 int CouenneProblem::impliedBounds (t_chg_bounds *chg_bds) const {
00016
00017 int nchg = 0;
00018
00019 if (Jnlst()->ProduceOutput(Ipopt::J_DETAILED, J_BOUNDTIGHTENING)) {
00020 Jnlst()->Printf(Ipopt::J_DETAILED, J_BOUNDTIGHTENING," backward =====================\n ");
00021 int j=0;
00022 for (int i=0; i < nVars (); i++)
00023 if (variables_ [i] -> Multiplicity () >= 0) {
00024 Jnlst()->Printf(Ipopt::J_MOREVECTOR, J_BOUNDTIGHTENING,
00025 "x_%03d [%+15.8g %+15.8g] ", i,
00026 domain_.lb (i),
00027 domain_.ub (i));
00028 if (!(++j % 6)) Jnlst()->Printf(Ipopt::J_MOREVECTOR, J_BOUNDTIGHTENING,"\n ");
00029 }
00030 if (j % 6) Jnlst()->Printf(Ipopt::J_MOREVECTOR, J_BOUNDTIGHTENING,"\n");
00031 }
00032
00033 for (int ii = nVars (); ii--;) {
00034
00035 int i = numbering_ [ii];
00036
00037 if ((variables_ [i] -> Type () == AUX) &&
00038 (variables_ [i] -> Multiplicity () > 0)) {
00039
00040 if (Lb (i) > Ub (i) + COUENNE_EPS * (1 + CoinMin (fabs (Lb (i)), fabs (Ub (i))))) {
00041 Jnlst () -> Printf (Ipopt::J_DETAILED, J_BOUNDTIGHTENING,
00042 " implied bounds: w_%d has infeasible bounds [%g,%g]\n",
00043 i, Lb (i), Ub (i));
00044 return -1;
00045 }
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 CouNumber
00071 l0 = Lb (i),
00072 u0 = Ub (i);
00073
00074 if (variables_ [i] -> Image () -> impliedBound
00075 (variables_ [i] -> Index (), Lb (), Ub (), chg_bds)) {
00076
00077
00078
00079
00080
00081
00082
00083 if (Jnlst()->ProduceOutput(Ipopt::J_VECTOR, J_BOUNDTIGHTENING)) {
00084
00085 Jnlst()->Printf(Ipopt::J_VECTOR, J_BOUNDTIGHTENING,
00086 " impli %2d [%15.8g, %15.8g] -> [%15.8g, %15.8g]: ",
00087 i, l0, u0, Lb (i), Ub (i));
00088
00089 variables_ [i] -> print (std::cout);
00090
00091 if (Jnlst()->ProduceOutput(Ipopt::J_MOREVECTOR, J_BOUNDTIGHTENING)) {
00092 Jnlst()->Printf(Ipopt::J_MOREVECTOR, J_BOUNDTIGHTENING," := ");
00093 variables_ [i] -> Image () -> print (std::cout);
00094 }
00095
00096 Jnlst()->Printf(Ipopt::J_VECTOR, J_BOUNDTIGHTENING,"\n");
00097 }
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140 nchg++;
00141 }
00142 }
00143 }
00144
00145 if (nchg)
00146 Jnlst () -> Printf (J_DETAILED, J_BOUNDTIGHTENING,
00147 " implied bounds: %d changes\n", nchg);
00148
00149 return nchg;
00150 }