Changeset 808 for stable/0.4


Ignore:
Timestamp:
Jan 30, 2012 9:50:35 PM (8 years ago)
Author:
pbelotti
Message:

merged from trunk: last fixings on negative index objective

Location:
stable/0.4
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • stable/0.4

    • Property svn:mergeinfo changed
      /trunkmerged: 807
  • stable/0.4/Couenne

  • stable/0.4/Couenne/src

  • stable/0.4/Couenne/src/branch

  • stable/0.4/Couenne/src/branch/BranchCore.cpp

    r795 r808  
    149149
    150150    if (jnlst_ -> ProduceOutput (J_ERROR, J_BRANCHING)) {
     151
    151152      printf ("Branch: x%d <= %g [%g,%g] (opt %g)\n",
    152153              indVar,
     
    154155              solver -> getColLower () [indVar],
    155156              solver -> getColUpper () [indVar],
    156               problem_ -> bestSol () ? problem_ -> bestSol () [indVar] : 0./0.);
     157              problem_ -> bestSol () ? problem_ -> bestSol () [indVar] : 0.);
    157158
    158159      if (problem_ -> bestSol ()) {
     
    168169                (solver -> getColUpper () [i] < problem_ -> bestSol () [i] - COUENNE_EPS))
    169170
    170               {printf ("This node does not contain optimal solution: x%d in [%g,%g] (%g)\n", i, solver -> getColLower () [i], solver -> getColUpper () [i], problem_ -> bestSol () [i]); break;}
     171              {printf ("This node does not contain optimal solution: x%d in [%g,%g] (%g)\n",
     172                       i, solver -> getColLower () [i], solver -> getColUpper () [i], problem_ -> bestSol () [i]); break;}
    171173      }
    172174    }
     
    185187              solver -> getColLower () [indVar],
    186188              solver -> getColUpper () [indVar],
    187               problem_ -> bestSol () ? problem_ -> bestSol () [indVar] : 0./0.);
     189              problem_ -> bestSol () ? problem_ -> bestSol () [indVar] : 0.);
    188190
    189191      if (problem_ -> bestSol ()) {
     
    200202                (solver -> getColUpper () [indVar] < problem_ -> bestSol () [indVar] - COUENNE_EPS))
    201203
    202               {printf ("This node does not contain optimal solution: x%d in [%g,%g] (%g)\n", i, solver -> getColLower () [i], solver -> getColUpper () [i], problem_ -> bestSol () [i]); break;}
     204              {printf ("This node does not contain optimal solution: x%d in [%g,%g] (%g)\n",
     205                       i, solver -> getColLower () [i], solver -> getColUpper () [i], problem_ -> bestSol () [i]); break;}
    203206      }
    204207    }
  • stable/0.4/Couenne/src/branch/CouenneChooseStrong.cpp

    r795 r808  
    268268#ifdef USE_SMALL_GAP
    269269      int objInd = problem_ -> Obj (0) -> Body () -> Index ();
    270       double lbGap = info -> lower_ [objInd];
     270      double lbGap = objInd >= 0 ? info -> lower_ [objInd] : problem_ -> Obj (0) -> Body () -> Value ();
    271271      double ubGap = problem_ -> getCutOff ();
    272272      double currentGap =
     
    14131413
    14141414#ifdef FM_CHECKNLP2
    1415     bool isFeas = problem_->checkNLP2(solution, 0, false, true, true,
    1416                                       problem_->getFeasTol());
    1417     return isFeas;
     1415    return problem_ -> checkNLP2 (solution, 0, false, true, true,
     1416                                  problem_->getFeasTol());
    14181417#else
    1419     double obj = solution [problem_ -> Obj (0) -> Body () -> Index ()];
    1420     return problem_ -> checkNLP (solution, obj);
     1418    int indobj = problem_ -> Obj (0) -> Body () -> Index ();
     1419    return problem_ -> checkNLP (solution, indobj >= 0 ? solution [indobj] : problem_ -> Obj (0) -> Body () -> Value ());
    14211420#endif
    14221421  }
     1422
    14231423/****************************************************************************/
    14241424  void CouenneChooseStrong::printObjViol(OsiBranchingInformation *info) {
     
    14511451  } /* printObjViol */
    14521452
    1453 
    14541453//}
  • stable/0.4/Couenne/src/branch/CouenneChooseVariable.cpp

    r707 r808  
    138138                                              const OsiObject ** objects) {
    139139
    140   double obj = solution [problem_ -> Obj (0) -> Body () -> Index ()];
     140  int indobj = problem_ -> Obj (0) -> Body () -> Index ();
     141  double obj = indobj >= 0 ? solution [indobj] : problem_ -> Obj (0) -> Body () -> Value ();
    141142
    142143#ifdef FM_CHECKNLP2
     
    149150  return isFeas;
    150151#else
    151   return problem_ -> checkNLP(solution, obj);
     152  return problem_ -> checkNLP (solution, obj);
    152153#endif
    153154}
  • stable/0.4/Couenne/src/branch/CouenneComplBranchingObject.cpp

    r694 r808  
    165165
    166166        //CouNumber newEst = problem_ -> Lb (objind) - lb [objind];
    167         estimate = CoinMax (0., problem_ -> Lb (objind) - lb [objind]);
     167        estimate = CoinMax (0., objind >= 0 ? problem_ -> Lb (objind) - lb [objind] : 0.);
    168168
    169169        //if (newEst > estimate)
  • stable/0.4/Couenne/src/branch/CouenneSOSObject.cpp

    r560 r808  
    7575
    7676      //CouNumber newEst = problem_ -> Lb (objind) - lb [objind];
    77       estimate = CoinMax (0., problem_ -> Lb (objind) - lb [objind]);
     77      estimate = CoinMax (0., objind >= 0 ? problem_ -> Lb (objind) - lb [objind] : 0.);
    7878
    7979      //if (newEst > estimate)
  • stable/0.4/Couenne/src/convex/generateCuts.cpp

    r806 r808  
    240240
    241241      // (which has an aux as its body)
    242       int index = con -> Body () -> Index ();
    243 
    244       if ((index >= 0) &&
     242      int objindex = con -> Body () -> Index ();
     243
     244      if ((objindex >= 0) &&
    245245          ((con -> Body () -> Type () == AUX) ||
    246246           (con -> Body () -> Type () == VAR))) {
    247247
    248248        // get the auxiliary that is at the lhs
    249         exprVar *conaux = problem_ -> Var (index);
     249        exprVar *conaux = problem_ -> Var (objindex);
    250250
    251251        if (conaux &&
     
    262262
    263263          OsiColCut newBound;
    264           if (lb > -COUENNE_INFINITY) newBound.setLbs (1, &index, &lb);
    265           if (ub <  COUENNE_INFINITY) newBound.setUbs (1, &index, &ub);
     264          if (lb > -COUENNE_INFINITY) newBound.setLbs (1, &objindex, &lb);
     265          if (ub <  COUENNE_INFINITY) newBound.setUbs (1, &objindex, &ub);
    266266
    267267          cs.insert (newBound);
     
    348348
    349349    // (which has an aux as its body)
    350     int index = con -> Body () -> Index ();
    351 
    352     if ((index >= 0) &&
     350    int objindex = con -> Body () -> Index ();
     351
     352    if ((objindex >= 0) &&
    353353        ((con -> Body () -> Type () == AUX) ||
    354354         (con -> Body () -> Type () == VAR))) {
     
    360360
    361361      // tighten bounds in Couenne's problem representation
    362       problem_ -> Lb (index) = CoinMax (l, problem_ -> Lb (index));
    363       problem_ -> Ub (index) = CoinMin (u, problem_ -> Ub (index));
     362      problem_ -> Lb (objindex) = CoinMax (l, problem_ -> Lb (objindex));
     363      problem_ -> Ub (objindex) = CoinMin (u, problem_ -> Ub (objindex));
    364364    }
    365365  }
  • stable/0.4/Couenne/src/expression/operators/exprGroup.cpp

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • stable/0.4/Couenne/src/heuristics/BonNlpHeuristic.cpp

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • stable/0.4/Couenne/src/problem/checkNLP.cpp

    r752 r808  
    9898      (*(objBody -> Image () ? objBody -> Image () : objBody)) ();
    9999
    100   if (Jnlst () -> ProduceOutput (Ipopt::J_ALL, J_PROBLEM)) {
    101     printf ("  Objective: %.12e %.12e %.12e\n",
    102             realobj, sol [objBody -> Index ()],
    103             (*(objBody -> Image () ? objBody -> Image () : objBody)) ());
    104   }
     100  Jnlst () -> Printf (Ipopt::J_ALL, J_PROBLEM, "  Objective: %.12e %.12e %.12e\n",
     101                      realobj, objBody -> Index () >= 0 ? sol [objBody -> Index ()] : objBody -> Value (),
     102                      (*(objBody -> Image () ? objBody -> Image () : objBody)) ());
    105103
    106104  bool retval = true;
Note: See TracChangeset for help on using the changeset viewer.