Changeset 201 for stable/0.2/Couenne/src


Ignore:
Timestamp:
Jul 7, 2009 6:28:24 AM (12 years ago)
Author:
pbelotti
Message:

merged Couenne/trunk changes 179-200

Location:
stable/0.2
Files:
22 edited
2 copied

Legend:

Unmodified
Added
Removed
  • stable/0.2

  • stable/0.2/Couenne/src/bound_tightening/tightenBounds.cpp

    r159 r201  
    5151      continue;
    5252
     53    CouNumber &lower_i = Lb (i);
     54    CouNumber &upper_i = Ub (i);
     55
    5356    // early test to avoid a loop
    5457
    55     if ((Lb (i) > Ub (i) + COUENNE_EPS * (1 + CoinMin (fabs (Lb (i)), fabs (Ub (i))))) ||
    56         (Ub (i) < - MAX_BOUND) ||
    57         (Lb (i) >   MAX_BOUND)) {
     58    if ((lower_i > upper_i + COUENNE_EPS * (1 + CoinMin (fabs (lower_i), fabs (upper_i)))) ||
     59        (upper_i < - MAX_BOUND) ||
     60        (lower_i >   MAX_BOUND)) {
    5861
    5962      if (Jnlst()->ProduceOutput(J_ITERSUMMARY, J_BOUNDTIGHTENING)) {
    6063
    6164        Jnlst()->Printf(J_ITERSUMMARY, J_BOUNDTIGHTENING,
    62                         "pre-check: w_%d has infeasible bounds [%.10e,%.10e]. ", i, Lb (i), Ub (i));
     65                        "pre-check: w_%d has infeasible bounds [%.10e,%.10e]. ", i, lower_i, upper_i);
    6366
    6467        if (Jnlst()->ProduceOutput(J_DETAILED, J_BOUNDTIGHTENING)) {
     
    7679    /*if ((Var (i) -> Type () == VAR) &&
    7780        (Var (i) -> isInteger ())) {
    78       Lb (i) = ceil  (Lb (i) - COUENNE_EPS);
    79       Ub (i) = floor (Ub (i) + COUENNE_EPS);
     81      lower_i = ceil  (lower_i - COUENNE_EPS);
     82      upper_i = floor (upper_i + COUENNE_EPS);
    8083      }*/
    8184
    8285    if (Var (i) -> Type () == AUX) {
    83         // TODO: also test if any indep variable of this expression
    84         // have changed. If not, skip
     86      // TODO: also test if any indep variable of this expression
     87      // have changed. If not, skip
    8588
    8689      CouNumber ll, uu;
     
    116119      // check if lower bound got higher
    117120      if ((ll > - COUENNE_INFINITY) &&
    118           (ll >= Lb (i) + COUENNE_EPS) &&
     121          (ll >= lower_i + COUENNE_EPS) &&
    119122          ((fabs (ll)        < COUENNE_EPS) ||
    120            (fabs (Lb (i)) < COUENNE_EPS) ||
    121            (fabs (ll / (Lb (i)) - 1) > COUENNE_EPS)) ) {
     123           (fabs (lower_i) < COUENNE_EPS) ||
     124           (fabs (ll / (lower_i) - 1) > COUENNE_EPS)) ) {
    122125
    123126        if (Jnlst()->ProduceOutput(J_DETAILED, J_BOUNDTIGHTENING)) {
     
    125128          Jnlst()->Printf(J_DETAILED, J_BOUNDTIGHTENING,
    126129                          "  prop L %2d [%g,(%g)] -> [%g,(%g)] (%g) ",
    127                           i, Lb (i), Ub (i), ll, uu, Lb (i) - ll);
     130                          i, lower_i, upper_i, ll, uu, lower_i - ll);
    128131          Var (i) -> print (std::cout);
    129132
     
    136139
    137140          if (optimum_ &&
    138               (optimum_ [i] >= Lb (i)) &&
     141              (optimum_ [i] >= lower_i) &&
    139142              (optimum_ [i] <= ll - COUENNE_EPS)) {
    140143
    141144            Jnlst()->Printf(J_STRONGWARNING, J_BOUNDTIGHTENING,
    142145                            "Couenne: propagating l_%d cuts optimum: [%g --> %g -X-> %g] :: ",
    143                             i, Lb (i), optimum_ [i], ll);
     146                            i, lower_i, optimum_ [i], ll);
    144147            Var (i) -> Lb () -> print (std::cout);
    145148            Jnlst()->Printf(J_DETAILED, J_BOUNDTIGHTENING," --- ");
     
    149152        }
    150153
    151         Lb (i) = ll;
    152 
    153         if (ll > Ub (i) + COUENNE_EPS * (1. + CoinMin (fabs (ll), fabs (Ub (i))))) {
     154        lower_i = ll;
     155
     156        if (ll > upper_i + COUENNE_EPS * (1. + CoinMin (fabs (ll), fabs (upper_i)))) {
    154157          Jnlst () -> Printf (J_ITERSUMMARY, J_BOUNDTIGHTENING,
    155                               "just-check: w_%d has infeasible bounds [%g,%g]. ", i, Lb (i), Ub (i));
     158                              "just-check: w_%d has infeasible bounds [%g,%g]. ", i, lower_i, upper_i);
    156159          return -1;
    157160        }
     
    163166      // check if upper bound got lower
    164167      if ((uu < COUENNE_INFINITY) &&
    165           (uu <= Ub (i) - COUENNE_EPS) &&
     168          (uu <= upper_i - COUENNE_EPS) &&
    166169          ((fabs (uu)      < COUENNE_EPS) ||
    167            (fabs (Ub (i)) < COUENNE_EPS) ||
    168            (fabs (uu / (Ub (i)) - 1) > COUENNE_EPS)) ) {
     170           (fabs (upper_i) < COUENNE_EPS) ||
     171           (fabs (uu / (upper_i) - 1) > COUENNE_EPS)) ) {
    169172        //      if ((uu < COUENNE_INFINITY) && (uu <= ub_ [i+j] - COUENNE_EPS)) {
    170173
     
    178181          Jnlst()->Printf(J_DETAILED, J_BOUNDTIGHTENING,
    179182                          "  prop U %2d [(%g),%g] -> [(%g),%g] (%g) ",
    180                           i, Lb (i), Ub (i), ll, uu, Ub (i) - uu);
     183                          i, lower_i, upper_i, ll, uu, upper_i - uu);
    181184          Var (i) -> print (std::cout);
    182185
     
    189192
    190193          if (optimum_ &&
    191               (optimum_ [i] <= Ub (i)) &&
     194              (optimum_ [i] <= upper_i) &&
    192195              (optimum_ [i] >= uu + COUENNE_EPS)) {
    193196
    194197            Jnlst()->Printf(J_STRONGWARNING, J_BOUNDTIGHTENING,
    195198                            "Couenne: propagating u_%d cuts optimum: [%g <-X- %g <-- %g] :: ",
    196                             i, uu, optimum_ [i], Ub (i));
     199                            i, uu, optimum_ [i], upper_i);
    197200            Var (i) -> Lb () -> print (std::cout);
    198201            Jnlst()->Printf(J_DETAILED, J_BOUNDTIGHTENING," --- ");
     
    202205        }
    203206
    204         Ub (i) = uu;
    205 
    206         if (uu < Lb (i) - COUENNE_EPS) {
     207        upper_i = uu;
     208
     209        if (uu < lower_i - COUENNE_EPS) {
    207210          Jnlst () -> Printf (J_ITERSUMMARY, J_BOUNDTIGHTENING,
    208                               "just-check: w_%d has infeasible bounds [%g,%g]. ", i, Lb (i), Ub (i));
     211                              "just-check: w_%d has infeasible bounds [%g,%g]. ", i, lower_i, upper_i);
    209212          return -1;
    210213        }
  • stable/0.2/Couenne/src/branch/CouenneBranchingObject.cpp

    r159 r201  
    1 /* $Id: CouenneBranchingObject.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    2 /*
     1/* $Id$
     2 *
    33 * Name:    CouenneBranchingObject.cpp
    44 * Authors: Pierre Bonami, IBM Corp.
  • stable/0.2/Couenne/src/branch/CouenneChooseStrong.cpp

    r159 r201  
    1313#include "CouenneBranchingObject.hpp"
    1414
    15 namespace Bonmin {
     15//namespace Bonmin {
    1616
    1717  /// constructor
    18   CouenneChooseStrong::CouenneChooseStrong (BabSetupBase &b, CouenneProblem* p, JnlstPtr jnlst) :
     18  CouenneChooseStrong::CouenneChooseStrong (Bonmin::BabSetupBase &b,
     19                                            CouenneProblem* p, JnlstPtr jnlst) :
    1920
    2021    BonChooseVariable (b, b.continuousSolver()),
     
    145146    return problem_ -> checkNLP (solution, obj);
    146147  }
    147 }
     148//}
  • stable/0.2/Couenne/src/branch/CouenneChooseStrong.hpp

    r159 r201  
    2020class CouenneSolverInterface;
    2121
    22 namespace Bonmin {
     22//namespace Bonmin {
    2323
    24   class CouenneChooseStrong : public BonChooseVariable  {
     24class CouenneChooseStrong : public Bonmin::BonChooseVariable  {
    2525
    2626  public:
    2727
    2828    /// Constructor from solver (so we can set up arrays etc)
    29     CouenneChooseStrong (BabSetupBase& b, CouenneProblem* problem, JnlstPtr jnlst);
     29  CouenneChooseStrong (Bonmin::BabSetupBase& b, CouenneProblem* problem, JnlstPtr jnlst);
    3030
    3131    /// Copy constructor
     
    9292    JnlstPtr jnlst_;
    9393  };
    94 }
     94//}
    9595
    9696#endif
  • stable/0.2/Couenne/src/branch/CouenneObject.cpp

    r159 r201  
    498498  if (info &&
    499499      ((pseudoMultType_ == INTERVAL_LP) ||
    500        (pseudoMultType_ == INTERVAL_LP_REV))) {
     500       (pseudoMultType_ == INTERVAL_LP_REV)))
    501501
    502502    point = info -> solution_ [index];
    503503
    504     CouNumber delta = closeToBounds * (info -> upper_ [index] - info -> lower_ [index]);
    505 
    506     if      (point < info -> lower_ [index] + delta)
    507       point        = info -> lower_ [index] + delta;
    508     else if (point > info -> upper_ [index] - delta)
    509       point        = info -> upper_ [index] - delta;
    510   }
    511504  else if (brpoint &&
    512505           ((pseudoMultType_ == INTERVAL_BR) ||
     
    514507   
    515508    point = *brpoint;
     509
     510  // now move it away from the bounds
     511
     512  point = midInterval (point,
     513                       info -> lower_ [index],
     514                       info -> upper_ [index]);
     515
     516  CouNumber delta = closeToBounds * (info -> upper_ [index] - info -> lower_ [index]);
     517
     518  if      (point < info -> lower_ [index] + delta)
     519    point        = info -> lower_ [index] + delta;
     520  else if (point > info -> upper_ [index] - delta)
     521    point        = info -> upper_ [index] - delta;
    516522
    517523  ///////////////////////////////////////////////////////////
     
    540546  }
    541547
     548//   if (downEstimate_ <= 0.0 || upEstimate_ <= 0.0)
     549//     printf ("%g [%g,%g] ---> [%g,%g]\n",
     550//          point,
     551//          info -> lower_ [index],
     552//          info -> upper_ [index],
     553//          downEstimate_, upEstimate_);
     554
    542555  if (reference_ -> isInteger ()) {
    543556    if (downEstimate_ <       point  - floor (point)) downEstimate_ =       point  - floor (point);
  • stable/0.2/Couenne/src/branch/doStrongBranching.cpp

    r159 r201  
    1 /* $Id: doStrongBranching.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    2 /*
     1/* $Id$
     2 *
    33 * Name:    doStrongBranching.cpp
    44 * Authors: Andreas Waechter, IBM Corp.
     
    66 * Purpose: actual strong branching method
    77 *
    8  * (C) Carnegie-Mellon University, 2008.
     8 * (C) Carnegie-Mellon University, 2008-09.
    99 * This file is licensed under the Common Public License (CPL)
    1010 */
     
    4242
    4343
    44 namespace Bonmin {
     44//namespace Bonmin {
    4545
    4646  /**  This is a utility function which does strong branching on
     
    5858  int CouenneChooseStrong::doStrongBranching (CouenneSolverInterface * solver,
    5959                                              OsiBranchingInformation *info,
    60                                               int numberToDo, int returnCriterion)
    61   {
     60                                              int numberToDo, int returnCriterion) {
    6261
    6362    jnlst_ -> Printf (J_ITERSUMMARY, J_BRANCHING,
     
    9998    for (;iDo < numberToDo; iDo++) {
    10099
    101       HotInfo * result = results_ () + iDo; // retrieve i-th object to test
    102 
    103       CouenneObject *CouObj = dynamic_cast <CouenneObject *>
    104         (solver_ -> objects () [result -> whichObject ()]);
     100      Bonmin::HotInfo * result = results_ () + iDo; // retrieve i-th object to test
     101
     102      OsiObject     *Object = solver_ -> objects () [result -> whichObject ()];
     103      CouenneObject *CouObj = dynamic_cast <CouenneObject *> (Object);
    105104
    106105      // For now just 2 way
     
    113112      /* Try the first direction.  Each subsequent call to branch()
    114113         performs the specified branch and advances the branch object
    115          state to the next branch alternative.) */
     114         state to the next branch alternative. */
    116115
    117116      int
     
    130129        else { // branch is feasible, solve and compare
    131130
    132           solver -> solveFromHotStart ();
    133           if (pseudoUpdateLP_ && CouObj && solver -> isProvenOptimal ()) {
    134             CouNumber dist = distance (lpSol, solver -> getColSolution (), numberColumns);
    135             if (dist > COUENNE_EPS)
    136               CouObj -> setEstimate (dist, 0);
     131          bool infeasible = false;
     132
     133          // Bound tightening if not a CouenneObject -- explicit bound tightening
     134          if (!CouObj) {
     135
     136            int
     137              indVar = Object   -> columnNumber (),
     138              nvars  = problem_ -> nVars ();
     139
     140            t_chg_bounds *chg_bds = new t_chg_bounds [nvars];
     141
     142            chg_bds [indVar].setUpper (t_chg_bounds::CHANGED);
     143
     144            if (problem_ -> doFBBT ()) {         // problem allowed to do FBBT
     145
     146              problem_ -> installCutOff ();
     147
     148              if (!problem_ -> btCore (chg_bds)) // done FBBT and this branch is infeasible
     149                infeasible = true;        // ==> report it
     150
     151              else {
     152                const double
     153                  *lb = solver -> getColLower (),
     154                  *ub = solver -> getColUpper ();
     155
     156                for (int i=0; i<nvars; i++) {
     157                  if (problem_ -> Lb (i) > lb [i]) solver -> setColLower (i, problem_ -> Lb (i));
     158                  if (problem_ -> Ub (i) < ub [i]) solver -> setColUpper (i, problem_ -> Ub (i));
     159                }
     160              }
     161            }
     162
     163            delete [] chg_bds;
     164          }
     165
     166          if (infeasible) result -> setDownStatus (status0 = 1);
     167          else {
     168            solver -> solveFromHotStart ();
     169            //solver -> solveFromHotStart ();
     170
     171            if (pseudoUpdateLP_ && CouObj && solver -> isProvenOptimal ()) {
     172              CouNumber dist = distance (lpSol, solver -> getColSolution (), numberColumns);
     173              if (dist > COUENNE_EPS)
     174                CouObj -> setEstimate (dist, 0);
     175            }
    137176          }
    138177        }
     
    156195            if (dist > COUENNE_EPS)
    157196              CouObj -> setEstimate (dist, 0);
    158             //CouObj -> setEstimate (distance (lpSol, thisSolver->getColSolution (),numberColumns), 0);
    159197          }
    160198        }
     
    163201      // can check if we got solution
    164202      // status is 0 finished, 1 infeasible and 2 unfinished and 3 is solution
     203
     204      /*if (CouObj)
     205        jnlst_ -> Printf (J_ITERSUMMARY, J_BRANCHING, "dnEst %g upEst %g\n",
     206                          CouObj->downEstimate(),
     207                          CouObj->upEstimate());*/
    165208
    166209      // only update information if this branch is feasible
     
    202245
    203246        else {
    204           solver -> solveFromHotStart ();
    205           if (pseudoUpdateLP_ && CouObj && solver -> isProvenOptimal ()) {
    206             CouNumber dist = distance (lpSol, solver -> getColSolution (), numberColumns);
    207             if (dist > COUENNE_EPS)
    208               CouObj -> setEstimate (dist, 1);
    209             //CouObj -> setEstimate (distance (lpSol, solver -> getColSolution (), numberColumns), 1);
     247
     248          bool infeasible = false;
     249
     250          // Bound tightening if not a CouenneObject -- explicit bound tightening
     251          if (!CouObj) {
     252
     253            int
     254              indVar = Object   -> columnNumber (),
     255              nvars  = problem_ -> nVars ();
     256
     257            t_chg_bounds *chg_bds = new t_chg_bounds [nvars];
     258
     259            chg_bds [indVar].setLower (t_chg_bounds::CHANGED);
     260
     261            if (problem_ -> doFBBT ()) {         // problem allowed to do FBBT
     262
     263              problem_ -> installCutOff ();
     264
     265              if (!problem_ -> btCore (chg_bds)) // done FBBT and this branch is infeasible
     266                infeasible = true;        // ==> report it
     267
     268              else {
     269                const double
     270                  *lb = solver -> getColLower (),
     271                  *ub = solver -> getColUpper ();
     272
     273                for (int i=0; i<nvars; i++) {
     274                  if (problem_ -> Lb (i) > lb [i]) solver -> setColLower (i, problem_ -> Lb (i));
     275                  if (problem_ -> Ub (i) < ub [i]) solver -> setColUpper (i, problem_ -> Ub (i));
     276                }
     277              }
     278            }
     279
     280            delete [] chg_bds;
     281          }
     282
     283          if (infeasible) result -> setUpStatus (status0 = 1);
     284          else {
     285
     286            solver -> solveFromHotStart ();
     287
     288            if (pseudoUpdateLP_ && CouObj && solver -> isProvenOptimal ()) {
     289              CouNumber dist = distance (lpSol, solver -> getColSolution (), numberColumns);
     290              if (dist > COUENNE_EPS)
     291                CouObj -> setEstimate (dist, 1);
     292            }
    210293          }
    211294        }
     
    228311            if (dist > COUENNE_EPS)
    229312              CouObj -> setEstimate (dist, 1);
    230             //CouObj -> setEstimate (distance (lpSol, thisSolver->getColSolution (),numberColumns), 1);
    231313          }
    232314        }
     
    235317      // can check if we got solution
    236318      // status is 0 finished, 1 infeasible and 2 unfinished and 3 is solution
     319
     320      /*if (CouObj)
     321        jnlst_ -> Printf (J_ITERSUMMARY, J_BRANCHING, "dnEst %g upEst %g\n",
     322                          CouObj->downEstimate(),
     323                          CouObj->upEstimate());*/
    237324
    238325      // only update information if this branch is feasible
     
    375462    return returnCode;
    376463  }
    377 }
     464//}
  • stable/0.2/Couenne/src/convex/CouenneCutGenerator.cpp

    r159 r201  
    3434  BabPtr_         (NULL),
    3535  infeasNode_     (false),
    36   jnlst_          (base -> journalist ()),
     36  jnlst_          (base ? base -> journalist () : NULL),
    3737  rootTime_       (-1.) {
    3838
    39   base -> options () -> GetIntegerValue ("convexification_points", nSamples_, "couenne.");
    40 
    41   std::string s;
    42 
    43   base -> options () -> GetStringValue ("convexification_type", s, "couenne.");
    44   if      (s == "current-point-only") convtype_ = CURRENT_ONLY;
    45   else if (s == "uniform-grid")       convtype_ = UNIFORM_GRID;
    46   else                                convtype_ = AROUND_CURPOINT;
    47 
    48   base -> options () -> GetStringValue ("violated_cuts_only", s, "couenne.");
    49   addviolated_ = (s == "yes");
    50 
    51   base -> options () -> GetStringValue ("check_lp", s, "couenne.");
    52   check_lp_ = (s == "yes");
     39  if (base) {
     40
     41    base -> options () -> GetIntegerValue ("convexification_points", nSamples_, "couenne.");
     42
     43    std::string s;
     44
     45    base -> options () -> GetStringValue ("convexification_type", s, "couenne.");
     46    if      (s == "current-point-only") convtype_ = CURRENT_ONLY;
     47    else if (s == "uniform-grid")       convtype_ = UNIFORM_GRID;
     48    else                                convtype_ = AROUND_CURPOINT;
     49
     50    base -> options () -> GetStringValue ("violated_cuts_only", s, "couenne.");
     51    addviolated_ = (s == "yes");
     52
     53    base -> options () -> GetStringValue ("check_lp", s, "couenne.");
     54    check_lp_ = (s == "yes");
     55
     56    base -> options () -> GetStringValue ("enable_lp_implied_bounds", s, "couenne.");
     57    enable_lp_implied_bounds_ = (s == "yes");
     58
     59  } else {
     60
     61    nSamples_                 = 4;
     62    convtype_                 = CURRENT_ONLY;
     63    addviolated_              = true;
     64    check_lp_                 = false;
     65    enable_lp_implied_bounds_ = false;
     66  }
    5367
    5468  if (asl) // deal with problems not originating from AMPL
     
    8195  jnlst_       (src. jnlst_),
    8296  rootTime_    (src. rootTime_),
    83   check_lp_    (src. check_lp_)
     97  check_lp_    (src. check_lp_),
     98  enable_lp_implied_bounds_ (src.enable_lp_implied_bounds_)
    8499{}
    85100
     
    177192     "yes","");
    178193
    179   CouenneProblem                :: registerOptions (roptions);
    180   Bonmin::CouenneChooseStrong   :: registerOptions (roptions);
    181   CouenneChooseVariable         :: registerOptions (roptions);
     194  roptions -> AddStringOption2
     195    ("enable_lp_implied_bounds",
     196     "Enable OsiSolverInterface::tightenBounds () -- warning: it has caused "
     197     "some trouble to Couenne",
     198     "no",
     199     "no","",
     200     "yes","");
     201
     202  CouenneProblem        :: registerOptions (roptions);
     203  CouenneChooseStrong   :: registerOptions (roptions);
     204  CouenneChooseVariable :: registerOptions (roptions);
    182205}
  • stable/0.2/Couenne/src/convex/CouenneCutGenerator.hpp

    r159 r201  
    1 /* $Id: CouenneCutGenerator.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    2 /*
     1/* $Id$
     2 *
    33 * Name:    CouenneCutGenerator.hpp
    44 * Author:  Pietro Belotti
     
    8686  bool check_lp_;
    8787
     88  /// Take advantage of OsiClpSolverInterface::tightenBounds (), known
     89  /// to have caused some problems some time ago
     90  bool enable_lp_implied_bounds_;
     91
    8892 public:
    8993
     
    105109  /// return pointer to symbolic problem
    106110  inline CouenneProblem *Problem () const
    107     {return problem_;}
     111  {return problem_;}
    108112
    109113  /// return pointer to symbolic problem
    110114  inline void setProblem (CouenneProblem *p)
    111     {problem_ = p;}
     115  {problem_ = p;}
    112116
    113117  /// total number of variables (original + auxiliary)
     
    116120  /// has generateCuts been called yet?
    117121  inline bool isFirst () const
    118     {return firstcall_;}
     122  {return firstcall_;}
    119123
    120124  /// should we add the violated cuts only (true), or all of them (false)?
    121125  inline bool addViolated () const
    122     {return addviolated_;}
     126  {return addviolated_;}
    123127
    124128  /// get convexification type (see CouenneTypes.h)
    125129  inline enum conv_type ConvType () const
    126     {return convtype_;}
     130  {return convtype_;}
    127131
    128132  /// get number of convexification samples
    129133  inline int nSamples () const
    130     {return nSamples_;}
     134  {return nSamples_;}
    131135
    132136  /// the main CglCutGenerator
     
    217221  {return ConstPtr (jnlst_);}
    218222
     223  void setJnlst(JnlstPtr jnlst__)
     224  { jnlst_ = jnlst__; }
     225
    219226  /// Time spent at root node
    220227  double &rootTime ()
     
    222229
    223230  /// return check_lp flag (used in CouenneSolverInterface)
    224   bool check_lp ()
     231  bool check_lp () const
    225232  {return check_lp_;}
     233
     234  /// returns value of enable_lp_implied_bounds_
     235  bool enableLpImpliedBounds () const
     236  {return enable_lp_implied_bounds_;}
    226237};
    227238
  • stable/0.2/Couenne/src/convex/generateCuts.cpp

    r159 r201  
    1616#include "CouenneSolverInterface.hpp"
    1717
    18 #define Couenne_large_bound2 9.99e30
     18#define Couenne_large_bound2 9.99e12
    1919
    2020// checks bad cuts against known optimum
  • stable/0.2/Couenne/src/convex/operators/conv-exprGroup.cpp

    r159 r201  
    176176    }
    177177
    178     if (inf_lb) lb = -COUENNE_INFINITY;
    179     if (inf_ub) ub =  COUENNE_INFINITY;
    180 
    181     if (inf_lb && inf_ub) break; // no need to keep computing...
     178    if (inf_lb)
     179      lb = -COUENNE_INFINITY;
     180
     181    if (inf_ub) {
     182      ub =  COUENNE_INFINITY;
     183      if (inf_lb)
     184        break;
     185    }
     186
     187    //if (inf_lb && inf_ub) break; // no need to keep computing...
    182188  }
    183189}
  • stable/0.2/Couenne/src/disjunctive/separateWithDisjunction.cpp

    r159 r201  
    7979  sparse2dense (ncols, chg, changed, nchanged);
    8080
    81   couenneCG_ -> genRowCuts (si, *cuts,
    82                             nchanged, changed, // nchanged and changed are NULL for now
    83                             chg);
     81  couenneCG_ -> genRowCuts (si, *cuts, nchanged, changed, chg);
    8482
    8583  p -> domain () -> pop ();
     
    8785  delete [] chg;
    8886
     87  if (changed)
     88    free (changed);
     89
    8990  return COUENNE_FEASIBLE;
    9091}
  • stable/0.2/Couenne/src/expression/exprAux.cpp

    r159 r201  
    277277                                     JnlstPtr jnlst) {
    278278
    279   CouenneObject *retp = NULL;
    280 
    281279  /*if (image_ -> code () == COU_EXPRMUL) printf ("OK1\n");
    282280  if (image_ -> ArgList () [0] -> Index () >= 0) printf ("OK2\n");
     
    302300    return obj;
    303301  }
    304 
    305   //  return (*retp);
    306 }
     302}
  • stable/0.2/Couenne/src/main/Makefile.am

    r104 r201  
    2929        $(OSIOBJDIR)/src/OsiClp/libOsiClp.la \
    3030        $(BONMINOBJDIR)/src/CbcBonmin/libbonmin.la \
     31        $(BONMINOBJDIR)/src/Algorithms/Branching/libbonbranching.la \
    3132        $(BONMINOBJDIR)/src/Interfaces/libbonmininterfaces.la \
    3233        $(IPOPTOBJDIR)/src/Interfaces/libipopt.la \
  • stable/0.2/Couenne/src/main/Makefile.in

    r104 r201  
    8484        $(OSIOBJDIR)/src/OsiClp/libOsiClp.la \
    8585        $(BONMINOBJDIR)/src/CbcBonmin/libbonmin.la \
     86        $(BONMINOBJDIR)/src/Algorithms/Branching/libbonbranching.la \
    8687        $(BONMINOBJDIR)/src/Interfaces/libbonmininterfaces.la \
    8788        $(IPOPTOBJDIR)/src/Interfaces/libipopt.la \
     
    302303        $(OSIOBJDIR)/src/OsiClp/libOsiClp.la \
    303304        $(BONMINOBJDIR)/src/CbcBonmin/libbonmin.la \
     305        $(BONMINOBJDIR)/src/Algorithms/Branching/libbonbranching.la \
    304306        $(BONMINOBJDIR)/src/Interfaces/libbonmininterfaces.la \
    305307        $(IPOPTOBJDIR)/src/Interfaces/libipopt.la \
  • stable/0.2/Couenne/src/problem/CouenneLPtightenBounds.cpp

    r159 r201  
    1 /* $Id: CouenneLPtightenBounds.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    2 /*
    3  * Name:    CouenneLPtightenBounds.hpp
     1/* $Id$
     2 *
     3 * Name:    CouenneLPtightenBounds.cpp
    44 * Authors: Pietro Belotti, Carnegie Mellon University
    55 * Purpose: tighten LP bounds on all variables (including continuous)
    66 *
    7  * (C) Carnegie-Mellon University, 2008.
     7 * (C) Carnegie-Mellon University, 2008-09.
    88 * This file is licensed under the Common Public License (CPL)
    99 */
     
    1717int CouenneSolverInterface::tightenBounds (int lightweight) {
    1818
    19   // not yet...
    20   return OsiClpSolverInterface::tightenBounds (lightweight);
     19  if (!(cutgen_ -> enableLpImpliedBounds ()))
     20    return 0;
    2121
    2222  int
     
    3131  CoinCopyN (getColUpper (), ncols, oldUpper);
    3232
    33   nTightened = OsiClpSolverInterface::tightenBounds (lightweight);
     33//   printf ("-------- BOUNDS BEFORE ------------\n  ");
     34//   int j=0;
     35//   for (int i=0; i < ncols; i++) {
     36//     printf("x_%03d [%+15.8g %+15.8g] ", i, oldLower [i], oldUpper [i]);
     37//     if (!(++j % 6)) printf ("\n  ");
     38//   }
     39//   if (j % 6) printf ("\n");
     40
     41  nTightened = tightenBoundsCLP (lightweight);
     42
     43  if (nTightened < 0)
     44    return nTightened;
     45
     46//   printf ("-------- BOUNDS DURING ------------\n  ");
     47//   j=0;
     48//   for (int i=0; i < ncols; i++) {
     49//     printf("x_%03d [%+15.8g %+15.8g] ", i, getColLower () [i], getColUpper () [i]);
     50//     if (!(++j % 6)) printf ("\n  ");
     51//   }
     52//   if (j % 6) printf ("\n");
    3453
    3554  if (nTightened > 0) {
     
    7493    }
    7594
     95    const double
     96      *newerLower = cutgen_ -> Problem () -> Lb (),
     97      *newerUpper = cutgen_ -> Problem () -> Ub ();
     98
     99//     printf ("-------- BOUNDS AFTER ------------\n  ");
     100//     for (int i=0; i < ncols; i++) {
     101//       printf("x_%03d [%+15.8g %+15.8g] ", i, newerLower [i], newerUpper [i]);
     102//       if (!(++j % 6)) printf ("\n  ");
     103//     }
     104//     if (j % 6) printf ("\n");
     105
    76106    cutgen_ -> Problem () -> domain () -> pop ();
    77107
  • stable/0.2/Couenne/src/problem/CouenneSolverInterface.cpp

    r159 r201  
    1 /* $Id: CouenneSolverInterface.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    2 /*
     1/* $Id$
     2 *
    33 * Name:    CouenneSolverInterface.cpp
    44 * Authors: Pietro Belotti, Carnegie Mellon University
     
    2626
    2727  // prevents from running OsiClpSolverInterface::tightenBounds()
    28   specialOptions_ = specialOptions_ | 262144;
     28  if (cutgen_ && !(cutgen_ -> enableLpImpliedBounds ()))
     29    specialOptions_ = specialOptions_ | 262144;
    2930}
    3031
  • stable/0.2/Couenne/src/problem/CouenneSolverInterface.hpp

    r159 r201  
    5555  /// pointer due to cut generator cloning (it happens twice in the
    5656  /// algorithm)
    57   void setCutGenPtr (CouenneCutGenerator *cg)
    58   {cutgen_ = cg;}
     57  void setCutGenPtr (CouenneCutGenerator *cg) {
     58    cutgen_ = cg;
     59    if (cutgen_ && !(cutgen_ -> enableLpImpliedBounds ()))
     60      specialOptions_ = specialOptions_ | 262144;
     61  }
    5962
    6063  /// Solve initial LP relaxation
     
    8386  /// Tighten bounds on all variables (including continuous).
    8487  virtual int tightenBounds (int lightweight);
     88
     89  /// Copy of the Clp version --- not light version
     90  virtual int tightenBoundsCLP (int lightweight);
     91
     92  /// Copy of the Clp version --- light version
     93  virtual int tightenBoundsCLP_Light (int lightweight);
    8594
    8695  /// Returns pointer to CLP structure.
  • stable/0.2/Couenne/src/problem/Makefile.am

    r110 r201  
    2121        CouenneSolverInterface.cpp \
    2222        CouenneLPtightenBounds.cpp \
     23        CouenneLPtightenBoundsCLP.cpp \
     24        CouenneLPtightenBoundsCLP-light.cpp \
    2325        checkNLP.cpp \
    2426        getIntegerCandidate.cpp \
     
    3032        depGraph/depGraph.cpp \
    3133        depGraph/checkCycles.cpp
    32        
     34
    3335if COIN_HAS_ASL
    3436libCouenneProblem_la_SOURCES += \
  • stable/0.2/Couenne/src/problem/Makefile.in

    r110 r201  
    7575        fillQuadIndices.cpp fillDependence.cpp \
    7676        CouenneSolverInterface.cpp CouenneLPtightenBounds.cpp \
    77         checkNLP.cpp getIntegerCandidate.cpp testIntFix.cpp \
    78         CouenneSOS.cpp CouenneProblemConstructors.cpp \
    79         CouenneRestoreUnused.cpp reformulate.cpp depGraph/depGraph.cpp \
    80         depGraph/checkCycles.cpp ../readnl/readnl.cpp \
    81         ../readnl/nl2e.cpp ../readnl/invmap.cpp \
     77        CouenneLPtightenBoundsCLP.cpp \
     78        CouenneLPtightenBoundsCLP-light.cpp checkNLP.cpp \
     79        getIntegerCandidate.cpp testIntFix.cpp CouenneSOS.cpp \
     80        CouenneProblemConstructors.cpp CouenneRestoreUnused.cpp \
     81        reformulate.cpp depGraph/depGraph.cpp depGraph/checkCycles.cpp \
     82        ../readnl/readnl.cpp ../readnl/nl2e.cpp ../readnl/invmap.cpp \
    8283        ../readnl/readASLfg.cpp
    8384@COIN_HAS_ASL_TRUE@am__objects_1 = readnl.lo nl2e.lo invmap.lo \
     
    8687        problemIO.lo writeAMPL.lo writeGAMS.lo constraint.lo \
    8788        fillQuadIndices.lo fillDependence.lo CouenneSolverInterface.lo \
    88         CouenneLPtightenBounds.lo checkNLP.lo getIntegerCandidate.lo \
    89         testIntFix.lo CouenneSOS.lo CouenneProblemConstructors.lo \
    90         CouenneRestoreUnused.lo reformulate.lo depGraph.lo \
    91         checkCycles.lo $(am__objects_1)
     89        CouenneLPtightenBounds.lo CouenneLPtightenBoundsCLP.lo \
     90        CouenneLPtightenBoundsCLP-light.lo checkNLP.lo \
     91        getIntegerCandidate.lo testIntFix.lo CouenneSOS.lo \
     92        CouenneProblemConstructors.lo CouenneRestoreUnused.lo \
     93        reformulate.lo depGraph.lo checkCycles.lo $(am__objects_1)
    9294libCouenneProblem_la_OBJECTS = $(am_libCouenneProblem_la_OBJECTS)
    9395DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/inc
     
    300302        fillQuadIndices.cpp fillDependence.cpp \
    301303        CouenneSolverInterface.cpp CouenneLPtightenBounds.cpp \
    302         checkNLP.cpp getIntegerCandidate.cpp testIntFix.cpp \
    303         CouenneSOS.cpp CouenneProblemConstructors.cpp \
    304         CouenneRestoreUnused.cpp reformulate.cpp depGraph/depGraph.cpp \
    305         depGraph/checkCycles.cpp $(am__append_1)
     304        CouenneLPtightenBoundsCLP.cpp \
     305        CouenneLPtightenBoundsCLP-light.cpp checkNLP.cpp \
     306        getIntegerCandidate.cpp testIntFix.cpp CouenneSOS.cpp \
     307        CouenneProblemConstructors.cpp CouenneRestoreUnused.cpp \
     308        reformulate.cpp depGraph/depGraph.cpp depGraph/checkCycles.cpp \
     309        $(am__append_1)
    306310libCouenneProblem_la_DEPENDENCIES = $(libCouenneProblem_la_LIBADD)
    307311
     
    377381
    378382@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CouenneLPtightenBounds.Plo@am__quote@
     383@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CouenneLPtightenBoundsCLP-light.Plo@am__quote@
     384@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CouenneLPtightenBoundsCLP.Plo@am__quote@
    379385@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CouenneProblem.Plo@am__quote@
    380386@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CouenneProblemConstructors.Plo@am__quote@
  • stable/0.2/Couenne/src/readnl/readnl.cpp

    r159 r201  
    1 /* $Id: readnl.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    2 /*
     1/* $Id$
     2 *
    33 * Name:    readnl.cpp
    44 * Author:  Pietro Belotti
     
    1010
    1111#include "CouenneProblem.hpp"
     12
     13#if   defined HAVE_CSTDINT
     14#include "cstdint"
     15#elif defined HAVE_STDINT_H
     16#include "stdint.h"
     17#endif
    1218
    1319#include "CouenneTypes.hpp"
  • stable/0.2/Couenne/src/standardize/standardize.cpp

    r159 r201  
    278278
    279279  std::string delete_redund;
    280   bonBase_ -> options () -> GetStringValue ("delete_redundant", delete_redund, "couenne.");
     280  if (bonBase_)
     281    bonBase_ -> options () -> GetStringValue ("delete_redundant", delete_redund, "couenne.");
     282  else
     283    delete_redund = "yes";
    281284
    282285  if (delete_redund == "yes")
Note: See TracChangeset for help on using the changeset viewer.