Changeset 806 for stable/0.4


Ignore:
Timestamp:
Jan 30, 2012 6:44:01 PM (8 years ago)
Author:
pbelotti
Message:

merging const-objective-negative-index fixes from trunk

Location:
stable/0.4/Couenne/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • stable/0.4/Couenne/src/bound_tightening/aggressiveBT.cpp

    r752 r806  
    205205                        "   %2d %+20g [%+20g %+20g]\n",
    206206                        i, X [i], Lb (i), Ub (i));
    207       Jnlst()->Printf(J_ITERSUMMARY, J_BOUNDTIGHTENING,
    208                       "-------------\nAggressive BT. Current bound = %g, cutoff = %g, %d vars\n",
    209                       Lb (objind), getCutOff (), ncols);
     207      if (objind >= 0)
     208        Jnlst()->Printf(J_ITERSUMMARY, J_BOUNDTIGHTENING,
     209                        "-------------\nAggressive BT. Current bound = %g, cutoff = %g, %d vars\n",
     210                        Lb (objind), getCutOff (), ncols);
    210211    }
    211212
     
    309310      int objind = Obj (0) -> Body  () -> Index ();
    310311
    311       Jnlst()->Printf(J_ITERSUMMARY, J_BOUNDTIGHTENING,
    312                       "-------------\ndone Aggressive BT. Current bound = %g, cutoff = %g, %d vars\n",
    313                       Lb (objind), getCutOff (), ncols);
     312      if (objind >= 0)
     313        Jnlst()->Printf(J_ITERSUMMARY, J_BOUNDTIGHTENING,
     314                        "-------------\ndone Aggressive BT. Current bound = %g, cutoff = %g, %d vars\n",
     315                        Lb (objind), getCutOff (), ncols);
    314316
    315317      if (Jnlst()->ProduceOutput(J_DETAILED, J_BOUNDTIGHTENING))
  • stable/0.4/Couenne/src/branch/CouenneBranchingObject.cpp

    r738 r806  
    271271
    272272        //CouNumber newEst = problem_ -> Lb (objind) - lb [objind];
    273         estimate = CoinMax (0., problem_ -> Lb (objind) - lb [objind]);
     273        estimate = CoinMax (0., objind >= 0 ? (problem_ -> Lb (objind) - lb [objind]) : 0.);
    274274
    275275        for (int i=0; i<nvars; i++) {
  • stable/0.4/Couenne/src/branch/CouenneObject.cpp

    r795 r806  
    277277
    278278    double
    279       lb = info -> lower_ [objInd],
     279      lb = objInd >= 0 ? info -> lower_ [objInd] : problem_ -> Obj (0) -> Body () -> Value (),
    280280      ub = problem_ -> getCutOff (),
    281281      currentGap =
  • stable/0.4/Couenne/src/convex/generateCuts.cpp

    r736 r806  
    112112    //problem_ -> setCutOff (bestVal - 1e-6); // FIXME: don't add numerical constants
    113113    problem_ -> setCutOff (bestVal);
    114     OsiColCut *objCut = new OsiColCut;
     114
    115115    int indObj = problem_->Obj(0)->Body()->Index();
    116     objCut->setUbs(1, &indObj, &bestVal);
    117     cs.insert(objCut);
    118     delete objCut;
     116
     117    if (indObj >= 0) {
     118      OsiColCut *objCut = new OsiColCut;
     119      objCut->setUbs(1, &indObj, &bestVal);
     120      cs.insert(objCut);
     121      delete objCut;
     122    }
    119123  }
    120124#endif
  • stable/0.4/Couenne/src/problem/CouenneSolverInterface.cpp

    r769 r806  
    143143    knowDualInfeasible_ = true;
    144144
     145  int objind = cutgen_ -> Problem () -> Obj (0) -> Body () -> Index ();
     146
    145147  CouNumber
    146148    //objval     = T::getObjValue (),
    147149    curCutoff  = cutgen_ -> Problem () -> getCutOff (),
    148     objvalGlob = T::getColSolution () [cutgen_ -> Problem () -> Obj (0) -> Body () -> Index ()]; 
     150    objvalGlob = objind >= 0 ? T::getColSolution () [objind] : cutgen_ -> Problem () -> Obj (0) -> Body () -> Value ();
    149151
    150152  // check if resolve found new integer solution
  • stable/0.4/Couenne/src/problem/reformulate.cpp

    r801 r806  
    111111
    112112#ifdef FM_CHECKNLP2
    113   cutoff = X (objectives_ [0] -> Body () -> Index ());
     113  int objind = objectives_ [0] -> Body () -> Index ();
     114  cutoff = objind >= 0 ? X (objind) : objectives_ [0] -> Body () -> Value ();
    114115  if(checkNLP2(X(), cutoff, false, // do not care about obj value
    115116               true, // stop at first viol
Note: See TracChangeset for help on using the changeset viewer.