Changeset 159


Ignore:
Timestamp:
Jun 24, 2009 10:54:00 AM (11 years ago)
Author:
pbelotti
Message:

created new stable branch 0.2 from trunk (rev. 157)

Location:
stable/0.2
Files:
2 added
1 deleted
213 edited
1 copied

Legend:

Unmodified
Added
Removed
  • stable/0.2

    • Property svn:externals
      •  

        old new  
        1 BuildTools https://projects.coin-or.org/svn/BuildTools/trunk
        2 ThirdParty/Blas https://projects.coin-or.org/svn/BuildTools/ThirdParty/Blas/trunk
        3 ThirdParty/Lapack https://projects.coin-or.org/svn/BuildTools/ThirdParty/Lapack/trunk
        4 ThirdParty/HSL https://projects.coin-or.org/svn/BuildTools/ThirdParty/HSL/trunk
        5 ThirdParty/ASL https://projects.coin-or.org/svn/BuildTools/ThirdParty/ASL/trunk
        6 ThirdParty/Mumps https://projects.coin-or.org/svn/BuildTools/ThirdParty/Mumps/trunk
        7 CoinUtils https://projects.coin-or.org/svn/CoinUtils/trunk/CoinUtils
        8 Cbc https://projects.coin-or.org/svn/Cbc/trunk/Cbc
        9 Cgl https://projects.coin-or.org/svn/Cgl/trunk/Cgl
        10 Clp https://projects.coin-or.org/svn/Clp/trunk/Clp
        11 Ipopt https://projects.coin-or.org/svn/Ipopt/trunk/Ipopt
        12 Osi https://projects.coin-or.org/svn/Osi/trunk/Osi
        13 Bonmin https://projects.coin-or.org/svn/Bonmin/trunk/Bonmin
         1BuildTools     https://projects.coin-or.org/svn/BuildTools/stable/0.5
         2CoinUtils      https://projects.coin-or.org/svn/CoinUtils/stable/2.6/CoinUtils
         3ThirdParty/ASL https://projects.coin-or.org/svn/BuildTools/ThirdParty/ASL/stable/1.0
         4ThirdParty/Blas https://projects.coin-or.org/svn/BuildTools/ThirdParty/Blas/stable/1.0
         5ThirdParty/HSL https://projects.coin-or.org/svn/BuildTools/ThirdParty/HSL/stable/1.1
         6ThirdParty/Lapack https://projects.coin-or.org/svn/BuildTools/ThirdParty/Lapack/stable/1.0
         7ThirdParty/Mumps https://projects.coin-or.org/svn/BuildTools/ThirdParty/Mumps/stable/1.1
         8Cbc            https://projects.coin-or.org/svn/Cbc/stable/2.3/Cbc
         9Cgl            https://projects.coin-or.org/svn/Cgl/stable/0.54/Cgl
         10Clp            https://projects.coin-or.org/svn/Clp/stable/1.10/Clp
         11Osi            https://projects.coin-or.org/svn/Osi/stable/0.100/Osi
         12Ipopt          https://projects.coin-or.org/svn/Ipopt/stable/3.6/Ipopt
         13Bonmin         https://projects.coin-or.org/svn/Bonmin/stable/1.1/Bonmin
  • stable/0.2/Couenne/src/bound_tightening/aggressiveBT.cpp

    r39 r159  
     1/* $Id: aggressiveBT.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    aggressiveBT.cpp
     
    67 *          bounds/infeasibility
    78 *
    8  * (C) Carnegie-Mellon University, 2007-08.
     9 * (C) Carnegie-Mellon University, 2007-09.
    910 * This file is licensed under the Common Public License (CPL)
    1011 */
    1112
     13#include "BonTNLPSolver.hpp"
     14#include "BonNlpHeuristic.hpp"
    1215#include "CoinHelperFunctions.hpp"
    1316#include "BonCouenneInfo.hpp"
     
    115118    nlp -> setColSolution (Y);
    116119
    117     nlp -> initialSolve ();
    118 
     120    try {
     121      nlp -> initialSolve ();
     122    }
     123    catch (Bonmin::TNLPSolver::UnsolvedError *E) {
     124    }
     125   
    119126    delete [] Y;
    120127    delete [] lower;
     
    237244                                 "Couenne infeasible node from aggressive BT\n");
    238245
    239     int       objind = Obj (0) -> Body  () -> Index ();
     246    int objind = Obj (0) -> Body  () -> Index ();
    240247
    241248    Jnlst()->Printf(J_ITERSUMMARY, J_BOUNDTIGHTENING,
     
    243250                    Lb (objind), getCutOff (), ncols);
    244251
    245     for (int i=0; i<nOrigVars_; i++)
    246       Jnlst()->Printf(J_DETAILED, J_BOUNDTIGHTENING,
    247                       "   x%02d [%+20g %+20g]  | %+20g\n",
    248                       i, Lb (i), Ub (i), X [i]);
    249 
    250     for (int i=nOrigVars_; i<ncols; i++)
    251       Jnlst()->Printf(J_MOREDETAILED, J_BOUNDTIGHTENING,
    252                       "   w%02d [%+20g %+20g]  | %+20g\n", i, Lb (i), Ub (i), X [i]);
     252    if (Jnlst()->ProduceOutput(J_DETAILED, J_BOUNDTIGHTENING))
     253      for (int i=0; i<nOrigVars_; i++)
     254        printf("   x%02d [%+20g %+20g]  | %+20g\n",
     255               i, Lb (i), Ub (i), X [i]);
     256
     257    if (Jnlst()->ProduceOutput(J_MOREDETAILED, J_BOUNDTIGHTENING))
     258      for (int i=nOrigVars_; i<ncols; i++)
     259        printf ("   w%02d [%+20g %+20g]  | %+20g\n", i, Lb (i), Ub (i), X [i]);
    253260  }
    254261
  • stable/0.2/Couenne/src/bound_tightening/boundTightening.cpp

    r112 r159  
    1 /*
     1/* $Id: boundTightening.cpp 151 2009-06-16 03:31:06Z pbelotti $
     2 *
    23 * Name:    boundTightening.cpp
    34 * Author:  Pietro Belotti
     
    3738  if (optimum_ != NULL) {
    3839    contains_optimum = true;
    39     for (int i=0; i<nOrigVars_; i++)
     40    for (int i=0; i < nVars (); i++)
    4041      if ((optimum_ [i] < Lb (i) * (1 - COUENNE_EPS) - COUENNE_EPS) ||
    4142          (optimum_ [i] > Ub (i) * (1 + COUENNE_EPS) + COUENNE_EPS)) {
     
    7071
    7172    if ((ntightened < 0) || (nbwtightened < 0)) {
    72       Jnlst()->Printf(J_DETAILED, J_BOUNDTIGHTENING, "infeasible BT\n");
     73      Jnlst()->Printf(J_ITERSUMMARY, J_BOUNDTIGHTENING, "infeasible BT\n");
    7374      return false;
    7475    }
     
    7879
    7980    if (contains_optimum) {
    80       for (int i=0; i<nOrigVars_; i++)
    81         if ((optimum_ [i] < Lb (i) * (1 - COUENNE_EPS) - COUENNE_EPS) ||
    82             (optimum_ [i] > Ub (i) * (1 + COUENNE_EPS) + COUENNE_EPS)) {
     81      for (int i=0; i<nVars (); i++)
     82        if ((optimum_[i] < Lb(i) - COUENNE_EPS * (1. + CoinMin (fabs(optimum_ [i]), fabs (Lb(i))))) ||
     83            (optimum_[i] > Ub(i) + COUENNE_EPS * (1. + CoinMin (fabs(optimum_ [i]), fabs (Ub(i)))))) {
    8384          printf ("bound tightening FAIL: %d [%e,%e] (%e) -- %e\n",
    8485                  i, Lb (i), Ub (i), optimum_ [i],
     
    108109
    109110      // final test
    110       if ((Lb (i) > Ub (i) + COUENNE_EPS) ||
     111      if ((Lb (i) > Ub (i) + COUENNE_EPS * (1 + CoinMin (fabs (Lb (i)), fabs (Ub (i))))) ||
    111112          (Ub (i) < - MAX_BOUND) ||
    112113          (Lb (i) >   MAX_BOUND)) {
    113114
    114         Jnlst()->Printf(J_DETAILED, J_BOUNDTIGHTENING, "final test: infeasible BT\n");
     115        Jnlst()->Printf(J_ITERSUMMARY, J_BOUNDTIGHTENING, "final test: infeasible BT\n");
    115116        return false;
    116117      }
  • stable/0.2/Couenne/src/bound_tightening/fake_tightening.cpp

    r39 r159  
     1/* $Id: fake_tightening.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    fake_tightening.cpp
     
    1314//#define DEBUG
    1415
    15 #define MAX_ITER  2 // max # fake tightening (inner) iterations
     16#define MAX_ITER  10 // max # fake tightening (inner) iterations
    1617#define AGGR_MUL  2 // the larger,  the more conservative. Must be > 0
    1718#define AGGR_DIV  2 // the smaller, the more conservative. Must be > 1
     
    8990#endif
    9091
     92  /*if (index == objind)
     93    printf ("  x_%d [%g,%g].  x = %10g, break at %g, cutoff = %g-----------------\n",
     94    index, Lb (index), Ub (index), xcur, fb, getCutOff());*/
     95
    9196  for (int iter = 0; iter < MAX_ITER; iter++) {
    9297
     
    137142      feasible  = btCore (f_chg),             // true if feasible with fake bound
    138143      betterbds = Lb (objind) > getCutOff (); // true if over cutoff
    139      
    140144
    141145#ifdef DEBUG
     
    227231
    228232    // TODO: compute golden section
    229     fb = (inner + outer) / 2;
     233    //fb = (inner + outer) / 2;
     234
     235    //fb = fictBounds (direction, fb, CoinMin (inner, outer), CoinMax (inner, outer));
     236
     237    CouNumber diff = fabs (inner-outer);
     238
     239    if (diff == 0.) break;
     240
     241    if (diff > 1) {
     242
     243      CouNumber L = log (diff) / log (10.);
     244
     245      if (direction) fb = inner + exp (log (10.) * L/2);
     246      else           fb = inner - exp (log (10.) * L/2);
     247
     248    } else fb = (inner+outer)/2;
    230249
    231250    //    if () fb = (          inner + (phi-1) * outer) / phi;
     
    236255    //       direction ? lb [index] : outer,
    237256    //       direction ? outer      : ub [index]);
    238     //    fb = fictBounds (direction, xcur, CoinMin (inner, outer), CoinMax (inner, outer));
    239257
    240258#ifdef DEBUG
     
    242260#endif
    243261  }
    244 
    245262
    246263  Jnlst()->Printf(Ipopt::J_MOREVECTOR, J_BOUNDTIGHTENING, "\n");
  • stable/0.2/Couenne/src/bound_tightening/impliedBounds.cpp

    r112 r159  
     1/* $Id: impliedBounds.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    impliedBounds.cpp
     
    3738        (variables_ [i] -> Multiplicity () > 0)) {
    3839
    39       if (Lb (i) > Ub (i) + COUENNE_EPS) {
    40         Jnlst()->Printf(Ipopt::J_DETAILED, J_BOUNDTIGHTENING,
    41                         "  implied bounds: w_%d has infeasible bounds [%g,%g]\n",
    42                         i, Lb (i), Ub (i));
     40      if (Lb (i) > Ub (i) + COUENNE_EPS * (1 + CoinMin (fabs (Lb (i)), fabs (Ub (i))))) {
     41        Jnlst () -> Printf (Ipopt::J_DETAILED, J_BOUNDTIGHTENING,
     42                            "  implied bounds: w_%d has infeasible bounds [%g,%g]\n",
     43                            i, Lb (i), Ub (i));
    4344        return -1;
    4445      }
     
    8687                          i, l0, u0, Lb (i), Ub (i));
    8788
    88           variables_ [i]             -> print (std::cout);
     89          variables_ [i] -> print (std::cout);
    8990
    9091          if (Jnlst()->ProduceOutput(Ipopt::J_MOREVECTOR, J_BOUNDTIGHTENING)) {
  • stable/0.2/Couenne/src/bound_tightening/obbt.cpp

    r39 r159  
     1/* $Id: obbt.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    obbt.cpp
     
    164165
    165166    csi -> setupForRepeatedUse ();
     167    csi -> doingResolve () = false;
     168
    166169    //csi -> setHintParam (OsiDoDualInResolve, false);
    167170
     
    172175    while (!notImproved &&
    173176           (nIter++ < MAX_OBBT_ITER) &&
    174            ((nImprov = obbtInner (csi, cs, chg_bds, babInfo)) > 0)) {
    175 
    176       if (CoinCpuTime () > maxCpuTime_)
    177         break;
     177           ((nImprov = obbtInner (csi, cs, chg_bds, babInfo)) > 0) &&
     178           (CoinCpuTime () < maxCpuTime_)) {
    178179
    179180      int nchanged, *changed = NULL;
     
    198199        free (changed);
    199200    }
     201
     202    csi -> doingResolve () = true;
    200203
    201204    delete csi;
  • stable/0.2/Couenne/src/bound_tightening/obbt_iter.cpp

    r39 r159  
     1/* $Id: obbt_iter.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    obbt.cpp
  • stable/0.2/Couenne/src/bound_tightening/operators/impliedBounds-exprDiv.cpp

    r1 r159  
     1/* $Id: impliedBounds-exprDiv.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    impliedBounds-exprDiv.cpp
  • stable/0.2/Couenne/src/bound_tightening/operators/impliedBounds-exprMul.cpp

    r79 r159  
     1/* $Id: impliedBounds-exprMul.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    impliedBounds-exprMul.cpp
  • stable/0.2/Couenne/src/bound_tightening/operators/impliedBounds-exprPow.cpp

    r54 r159  
     1/* $Id: impliedBounds-exprPow.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    impliedBounds-exprPow.cpp
  • stable/0.2/Couenne/src/bound_tightening/operators/impliedBounds-exprQuad.cpp

    r1 r159  
     1/* $Id: impliedBounds-exprQuad.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    impliedBounds-exprQuad.cpp
  • stable/0.2/Couenne/src/bound_tightening/operators/impliedBounds-exprSum.cpp

    r116 r159  
     1/* $Id: impliedBounds-exprSum.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    impliedBounds-exprSum.cpp
  • stable/0.2/Couenne/src/bound_tightening/operators/impliedBounds-mul.cpp

    r1 r159  
     1/* $Id: impliedBounds-mul.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    impliedBounds-mul.cpp
  • stable/0.2/Couenne/src/bound_tightening/operators/impliedBounds-sum.cpp

    r1 r159  
     1/* $Id: impliedBounds-sum.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    impliedBounds-sum.cpp
  • stable/0.2/Couenne/src/bound_tightening/tightenBounds.cpp

    r112 r159  
     1/* $Id: tightenBounds.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    tightenBounds.cpp
     
    5253    // early test to avoid a loop
    5354
    54     if ((Lb (i) > Ub (i) + COUENNE_EPS) ||
     55    if ((Lb (i) > Ub (i) + COUENNE_EPS * (1 + CoinMin (fabs (Lb (i)), fabs (Ub (i))))) ||
    5556        (Ub (i) < - MAX_BOUND) ||
    5657        (Lb (i) >   MAX_BOUND)) {
    5758
    58       //if (Jnlst()->ProduceOutput(J_ITERSUMMARY, J_BOUNDTIGHTENING)) {
    59 
    60       Jnlst()->Printf(J_ITERSUMMARY, J_BOUNDTIGHTENING,
    61                       "pre-check: w_%d has infeasible bounds [%.10e,%.10e]. ", i, Lb (i), Ub (i));
    62 
    63       if (Jnlst()->ProduceOutput(J_DETAILED, J_BOUNDTIGHTENING)) {
    64         Var (i) -> Lb () -> print (std::cout);
    65         Jnlst()->Printf(J_DETAILED, J_BOUNDTIGHTENING," --- ");
    66         Var (i) -> Ub () -> print (std::cout);
    67       }
    68 
    69       Jnlst()->Printf(J_ITERSUMMARY, J_BOUNDTIGHTENING,"\n");
    70         //}
     59      if (Jnlst()->ProduceOutput(J_ITERSUMMARY, J_BOUNDTIGHTENING)) {
     60
     61        Jnlst()->Printf(J_ITERSUMMARY, J_BOUNDTIGHTENING,
     62                        "pre-check: w_%d has infeasible bounds [%.10e,%.10e]. ", i, Lb (i), Ub (i));
     63
     64        if (Jnlst()->ProduceOutput(J_DETAILED, J_BOUNDTIGHTENING)) {
     65          Var (i) -> Lb () -> print (std::cout);
     66          Jnlst()->Printf(J_DETAILED, J_BOUNDTIGHTENING," --- ");
     67          Var (i) -> Ub () -> print (std::cout);
     68        }
     69
     70        Jnlst()->Printf(J_ITERSUMMARY, J_BOUNDTIGHTENING,"\n");
     71      }
    7172
    7273      return -1; // declare this node infeasible
     
    7980      }*/
    8081
    81     if (Var (i) -> Type         () == AUX) {
     82    if (Var (i) -> Type () == AUX) {
    8283        // TODO: also test if any indep variable of this expression
    8384        // have changed. If not, skip
     
    9495      }
    9596
    96       if (ll > uu + COUENNE_EPS) {
     97      if (ll - uu > COUENNE_EPS * (1 + CoinMin (fabs (ll), fabs (uu)))) {
    9798
    9899        //if (Jnlst()->ProduceOutput(J_ITERSUMMARY, J_BOUNDTIGHTENING)) {
     
    150151        Lb (i) = ll;
    151152
    152         if (ll > Ub (i) + COUENNE_EPS) {
     153        if (ll > Ub (i) + COUENNE_EPS * (1. + CoinMin (fabs (ll), fabs (Ub (i))))) {
    153154          Jnlst () -> Printf (J_ITERSUMMARY, J_BOUNDTIGHTENING,
    154155                              "just-check: w_%d has infeasible bounds [%g,%g]. ", i, Lb (i), Ub (i));
  • stable/0.2/Couenne/src/branch/CouenneBranchingObject.cpp

    r39 r159  
     1/* $Id: CouenneBranchingObject.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouenneBranchingObject.cpp
  • stable/0.2/Couenne/src/branch/CouenneBranchingObject.hpp

    r1 r159  
     1/* $Id: CouenneBranchingObject.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouenneBranchingObject.hpp
  • stable/0.2/Couenne/src/branch/CouenneChooseStrong.cpp

    r39 r159  
     1/* $Id: CouenneChooseStrong.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouenneChooseStrong.cpp
  • stable/0.2/Couenne/src/branch/CouenneChooseStrong.hpp

    r1 r159  
     1/* $Id: CouenneChooseStrong.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouenneChooseStrong.hpp
     
    1718// Forward declaration
    1819class CouenneProblem;
     20class CouenneSolverInterface;
    1921
    2022namespace Bonmin {
     
    5456         3 - returning because max time
    5557    */
    56     virtual int doStrongBranching( OsiSolverInterface * solver,
     58    virtual int doStrongBranching( CouenneSolverInterface * solver,
    5759                                   OsiBranchingInformation *info,
    5860                                   int numberToDo, int returnCriterion);
  • stable/0.2/Couenne/src/branch/CouenneChooseVariable.cpp

    r112 r159  
     1/* $Id: CouenneChooseVariable.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouenneChooseVariable.cpp
  • stable/0.2/Couenne/src/branch/CouenneChooseVariable.hpp

    r1 r159  
     1/* $Id: CouenneChooseVariable.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouenneChooseVariable.hpp
  • stable/0.2/Couenne/src/branch/CouenneComplBranchingObject.cpp

    r39 r159  
     1/* $Id: CouenneComplBranchingObject.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouenneComplBranchingObject.cpp
  • stable/0.2/Couenne/src/branch/CouenneComplBranchingObject.hpp

    r39 r159  
     1/* $Id: CouenneComplBranchingObject.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouenneComplBranchingObject.hpp
  • stable/0.2/Couenne/src/branch/CouenneComplObject.cpp

    r39 r159  
    1 /*
     1/* $Id: CouenneComplObject.cpp 155 2009-06-16 20:19:39Z pbelotti $
     2 *
    23 * Name:    CouenneComplObject.cpp
    34 * Authors: Pietro Belotti, Lehigh University
  • stable/0.2/Couenne/src/branch/CouenneComplObject.hpp

    r39 r159  
    1 /*
     1/* $Id: CouenneComplObject.hpp 155 2009-06-16 20:19:39Z pbelotti $
     2 *
    23 * Name:    CouenneComplObject.hpp
    34 * Authors: Pietro Belotti, Lehigh University
  • stable/0.2/Couenne/src/branch/CouenneObject.cpp

    r123 r159  
     1/* $Id: CouenneObject.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouenneObject.cpp
     
    56 * Purpose: Base object for variables (to be used in branching)
    67 *
    7  * (C) Carnegie-Mellon University, 2006-08.
     8 * (C) Carnegie-Mellon University, 2006-09.
    89 * This file is licensed under the Common Public License (CPL)
    910 */
     
    342343
    343344  // check if fval is a number (happens with e.g. w13 = w12/w5 and w5=0, see test/harker.nl)
    344   if (CoinIsnan(fval)) {
     345  if (CoinIsnan (fval)) {
    345346    fval = vval + 1.;
    346347    denom = 1.;
    347348  }
     349
     350  if (fabs (fval) > COUENNE_INFINITY)
     351    fval = COUENNE_INFINITY;
    348352
    349353  double
     
    367371    printf ("\n");
    368372  }
     373
     374  // Need to allow infeasibility for a variable without making the
     375  // whole problem infeasible with an infeasibility = 1e+50. Check
     376  // BonChooseVariable.cpp:382
     377
     378  if (retval > 1.e40)
     379    retval = 1.e20;
    369380
    370381  return (reference_ -> isInteger ()) ?
  • stable/0.2/Couenne/src/branch/CouenneObject.hpp

    r39 r159  
     1/* $Id: CouenneObject.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouenneObject.hpp
  • stable/0.2/Couenne/src/branch/CouenneSOSObject.cpp

    r39 r159  
     1/* $Id: CouenneSOSObject.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouenneSOSObject.cpp
     
    3132  // Apply SOS branching first
    3233  double retval = OsiSOSBranchingObject::branch (solver);
    33 
    3434
    3535  CouenneSolverInterface *couenneSolver = dynamic_cast <CouenneSolverInterface *> (solver);
  • stable/0.2/Couenne/src/branch/CouenneSOSObject.hpp

    r64 r159  
     1/* $Id: CouenneSOSObject.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouenneSOSObject.hpp
     
    1617class CouenneSOSObject;
    1718
     19// TODO: SOS of the form sum x_i \le k with k small. Instead of
     20// branching on a single variable do a SOS-like branching
    1821
    1922class CouenneSOSBranchingObject: public OsiSOSBranchingObject {
  • stable/0.2/Couenne/src/branch/CouenneThreeWayBranchObj.cpp

    r1 r159  
     1/* $Id: CouenneThreeWayBranchObj.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouenneThreeWayBranchObj.cpp
  • stable/0.2/Couenne/src/branch/CouenneThreeWayBranchObj.hpp

    r1 r159  
     1/* $Id: CouenneThreeWayBranchObj.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouenneThreeWayBranchObj.hpp
  • stable/0.2/Couenne/src/branch/CouenneVTObject.hpp

    r1 r159  
     1/* $Id: CouenneVTObject.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouenneVTObject.hpp
  • stable/0.2/Couenne/src/branch/CouenneVarObject.cpp

    r71 r159  
    1 /*
     1/* $Id: CouenneVarObject.cpp 155 2009-06-16 20:19:39Z pbelotti $
     2 *
    23 * Name:    CouenneVarObject.cpp
    34 * Authors: Pietro Belotti, Carnegie Mellon University
     
    113114  for (std::set <int>::iterator i = deplist.begin (); i != deplist.end (); ++i) {
    114115
    115     CouenneObject *obj = problem_ -> Objects () [*i];
     116    const CouenneObject &obj = problem_ -> Objects () [*i];
    116117
    117118    CouNumber improv = 0.;
    118119
    119     assert (obj -> Reference ());
     120    assert (obj. Reference ());
    120121
    121122    if (jnlst_ -> ProduceOutput (J_MATRIX, J_BRANCHING)) {
    122123      printf ("  ** ");
    123       obj -> Reference ()            -> print ();
    124       if (reference_ -> Image ()) {printf (" := "); obj -> Reference () -> Image () -> print ();}
     124      obj. Reference () -> print ();
     125      if (reference_ -> Image ()) {printf (" := "); obj. Reference () -> Image () -> print ();}
    125126      printf ("\n");
    126127    }
    127128
    128     if (obj -> Reference ()) {
    129       if (obj -> Reference () -> Image ())
    130         improv = obj -> Reference () -> Image ()
    131           -> selectBranch (obj, info,                      // input parameters
     129    if (obj. Reference ()) {
     130      if (obj. Reference () -> Image ())
     131        improv = obj. Reference () -> Image ()
     132          -> selectBranch (&obj, info,                      // input parameters
    132133                           brVar, brPts, brDist, whichWay); // result: who, where, distances, direction
    133134      else {
    134         brVar = obj -> Reference ();
     135        brVar = obj. Reference ();
    135136        brPts  = (double *) realloc (brPts, sizeof (double));
    136137        brDist = (double *) realloc (brDist, 2 * sizeof (double));
    137138
    138         double point = info -> solution_ [obj -> Reference () -> Index ()];
     139        double point = info -> solution_ [obj. Reference () -> Index ()];
    139140
    140141        *brPts = point;
     
    164165        (fabs (*brPts) < COU_MAX_COEFF)) { // and branching pt is limited
    165166
    166       criticalObject = problem_ -> Objects () [*i]; // set this object as the branch creator
     167      criticalObject = &(problem_ -> Objects () [*i]); // set this object as the branch creator
    167168
    168169      brdistDn = brDist [0];
     
    272273bool CouenneVarObject::isCuttable () const {
    273274
    274   const std::set <int>                &deplist = problem_ -> Dependence () [reference_ -> Index ()];
    275   const std::vector <CouenneObject *> &objects = problem_ -> Objects ();
     275  const std::set <int>              &deplist = problem_ -> Dependence () [reference_ -> Index ()];
     276  const std::vector <CouenneObject> &objects = problem_ -> Objects ();
    276277
    277278  for (std::set <int>::const_iterator depvar = deplist. begin ();
    278279       depvar != deplist. end (); ++depvar)
    279     if (!(objects [*depvar] -> isCuttable ()))
     280    if (!(objects [*depvar]. isCuttable ()))
    280281      return false;
    281282
  • stable/0.2/Couenne/src/branch/CouenneVarObject.hpp

    r39 r159  
     1/* $Id: CouenneVarObject.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouenneVarObject.hpp
  • stable/0.2/Couenne/src/branch/doStrongBranching.cpp

    r39 r159  
     1/* $Id: doStrongBranching.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    doStrongBranching.cpp
     
    1314#include "CouenneProblem.hpp"
    1415#include "CouenneBranchingObject.hpp"
     16#include "CouenneSolverInterface.hpp"
    1517
    1618/// compute Euclidean distance between two points (most likely LP solutions)
     
    5456       3 - returning because max time
    5557  */
    56   int CouenneChooseStrong::doStrongBranching (OsiSolverInterface * solver,
     58  int CouenneChooseStrong::doStrongBranching (CouenneSolverInterface * solver,
    5759                                              OsiBranchingInformation *info,
    5860                                              int numberToDo, int returnCriterion)
     
    6163    jnlst_ -> Printf (J_ITERSUMMARY, J_BRANCHING,
    6264                      "\n-\n------- CCS: trying %d objects:\n", numberToDo);
     65
     66    solver -> doingResolve () = false; // turns off setCutoff and restoreUnused
    6367
    6468    int numberColumns = solver -> getNumCols ();
     
    367371    solver -> unmarkHotStart ();     // Delete the snapshot
    368372
     373    solver -> doingResolve () = true;
     374
    369375    return returnCode;
    370376  }
  • stable/0.2/Couenne/src/branch/feasibleRegion.cpp

    r98 r159  
     1/* $Id: feasibleRegion.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    feasibleRegion.cpp
  • stable/0.2/Couenne/src/branch/infeasibility.cpp

    r121 r159  
    1 /*
     1/* $Id: infeasibility.cpp 155 2009-06-16 20:19:39Z pbelotti $
     2 *
    23 * Name:    infeasibility.cpp
    34 * Authors: Pietro Belotti, Carnegie Mellon University
    45 * Purpose: Compute infeasibility of a variable, looking at all expressions it appears in
    56 *
    6  * (C) Carnegie-Mellon University, 2008.
     7 * (C) Carnegie-Mellon University, 2008-09.
    78 * This file is licensed under the Common Public License (CPL)
    89 */
     
    115116    // otherwise, return a nonzero infeasibility, if necessary. It
    116117    // might make sense to branch on it
    117     const CouenneObject *obj = problem_ -> Objects () [reference_ -> Index ()];
     118    const CouenneObject &obj = problem_ -> Objects () [reference_ -> Index ()];
    118119
    119     double retval = (obj -> Reference ()) ?
     120    double retval = (obj. Reference ()) ?
    120121      (1. - 1. / (1. + info -> upper_ [index] - info -> lower_ [index])) *
    121       weiSum * obj ->checkInfeasibility (info) : 0.;
     122      weiSum * obj. checkInfeasibility (info) : 0.;
    122123
    123124    return retval;
     
    139140      // *i is the index of an auxiliary that depends on reference_
    140141
    141       const CouenneObject *obj = problem_ -> Objects () [*i];
    142       CouNumber infeas = (obj -> Reference ()) ? obj -> checkInfeasibility (info) : 0.;
     142      const CouenneObject &obj = problem_ -> Objects () [*i];
     143      CouNumber infeas = (obj. Reference ()) ? obj. checkInfeasibility (info) : 0.;
    143144
    144145      if (infeas > infmax) infmax = infeas;
     
    148149
    149150    double retval =
    150       // neglect it if variable has small bound interval (chech
     151      // neglect it if variable has small bound interval (check
    151152      // x84=x83/x5 in csched1.nl)
    152153      (1. - 1. / (1. + info -> upper_ [index] - info -> lower_ [index])) *
  • stable/0.2/Couenne/src/branch/infeasibilityVT.cpp

    r43 r159  
    1 /*
     1/* $Id: infeasibilityVT.cpp 155 2009-06-16 20:19:39Z pbelotti $
     2 *
    23 * Name:    infeasibilityVT.cpp
    34 * Authors: Pietro Belotti, Carnegie Mellon University
     
    102103         i != dependence.end (); ++i) {
    103104
    104       const CouenneObject *obj = problem_ -> Objects () [*i];
    105       assert (obj -> Reference ());
     105      const CouenneObject &obj = problem_ -> Objects () [*i];
     106      assert (obj. Reference ());
    106107
    107108      CouNumber
    108109        left   = xcurr,
    109110        right  = xcurr,
    110         infeas = obj -> checkInfeasibility (info);
     111        infeas = obj. checkInfeasibility (info);
    111112
    112113      if (infeas > maxInf)
     
    120121        // MathProg A: 99, pp. 563-591)
    121122        //if (obj. Reference () -> Image ()) // not needed! obj only has nonlinear objects
    122         obj -> Reference () -> Image () -> closestFeasible
    123           (reference_, obj -> Reference (), left, right);
     123        obj. Reference () -> Image () -> closestFeasible
     124          (reference_, obj. Reference (), left, right);
    124125
    125126        if (left  < lFeas) lFeas = left;
     
    130131        jnlst_ -> Printf (J_MATRIX, J_BRANCHING, "[%g,%g] --> %g - %g = %g (diff = %g - %g = %g): ",
    131132                          left, right, rFeas, lFeas, rFeas - lFeas,
    132                           (obj -> Reference () -> Image ()) ?
    133                           (*(obj -> Reference () -> Image ())) () : 0., 
    134                           (*(obj -> Reference ())) (),
    135                           (obj -> Reference () -> Image ()) ?
    136                           (*(obj -> Reference () -> Image ())) () - (*(obj -> Reference ())) () : 0.);
    137         obj ->Reference () -> print ();
    138         if (obj -> Reference () -> Image ())
    139           {printf (" := "); obj -> Reference() -> Image() -> print();}
     133                          (obj. Reference () -> Image ()) ?
     134                          (*(obj. Reference () -> Image ())) () : 0., 
     135                          (*(obj. Reference ())) (),
     136                          (obj. Reference () -> Image ()) ?
     137                          (*(obj. Reference () -> Image ())) () - (*(obj. Reference ())) () : 0.);
     138        obj. Reference () -> print ();
     139        if (obj. Reference () -> Image ())
     140          {printf (" := "); obj. Reference() -> Image() -> print();}
    140141        printf ("\n");
    141142      }
  • stable/0.2/Couenne/src/branch/operators/branchExprAbs.cpp

    r1 r159  
     1/* $Id: branchExprAbs.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    branchExprAbs.cpp
  • stable/0.2/Couenne/src/branch/operators/branchExprDiv.cpp

    r1 r159  
     1/* $Id: branchExprDiv.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    branchExprDiv.cpp
  • stable/0.2/Couenne/src/branch/operators/branchExprExp.cpp

    r68 r159  
     1/* $Id: branchExprExp.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    branchExprExp.cpp
  • stable/0.2/Couenne/src/branch/operators/branchExprInv.cpp

    r1 r159  
     1/* $Id: branchExprInv.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    branchExprInv.cpp
  • stable/0.2/Couenne/src/branch/operators/branchExprLog.cpp

    r1 r159  
     1/* $Id: branchExprLog.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    branchExprLog.cpp
  • stable/0.2/Couenne/src/branch/operators/branchExprMul.cpp

    r1 r159  
     1/* $Id: branchExprMul.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    branchExprMul.cpp
  • stable/0.2/Couenne/src/branch/operators/branchExprPow.cpp

    r1 r159  
     1/* $Id: branchExprPow.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    branchExprPow.cpp
  • stable/0.2/Couenne/src/branch/operators/branchExprQuad.cpp

    r1 r159  
     1/* $Id: branchExprQuad.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    branchExprQuad.cpp
  • stable/0.2/Couenne/src/branch/operators/branchExprSinCos.cpp

    r1 r159  
     1/* $Id: branchExprSinCos.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    branchExprSinCos.cpp
  • stable/0.2/Couenne/src/branch/operators/computeMulBrDist.cpp

    r1 r159  
     1/* $Id: computeMulBrDist.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    computeMulBrDist.cpp
  • stable/0.2/Couenne/src/branch/operators/minMaxDelta.cpp

    r1 r159  
     1/* $Id: minMaxDelta.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    minMaxDelta.cpp
  • stable/0.2/Couenne/src/branch/projections.cpp

    r1 r159  
     1/* $Id: projections.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    projections.cpp
  • stable/0.2/Couenne/src/branch/projections.hpp

    r1 r159  
     1/* $Id: projections.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    projections.hpp
  • stable/0.2/Couenne/src/convex/CouenneCutGenerator.cpp

    r103 r159  
     1/* $Id: CouenneCutGenerator.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouenneCutGenerator.cpp
  • stable/0.2/Couenne/src/convex/CouenneCutGenerator.hpp

    r103 r159  
     1/* $Id: CouenneCutGenerator.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouenneCutGenerator.hpp
  • stable/0.2/Couenne/src/convex/addEnvelope.cpp

    r1 r159  
     1/* $Id: addEnvelope.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * File: addEnvelope.cpp
  • stable/0.2/Couenne/src/convex/createCuts.cpp

    r39 r159  
     1/* $Id: createCuts.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    createCuts.cpp
  • stable/0.2/Couenne/src/convex/genColCuts.cpp

    r1 r159  
     1/* $Id: genColCuts.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    genColCuts.cpp
     
    2728      *indLow = new int [ncols], // indices for OsiColCut
    2829      *indUpp = new int [ncols], //
    29        nLow, nUpp = nLow = 0,
    30        ind_obj = problem_ -> Obj (0) -> Body () -> Index ();
     30       nLow, nUpp = nLow = 0;
     31    //ind_obj = problem_ -> Obj (0) -> Body () -> Index ();
    3132
    3233  // values fo OsiColCut
     
    5657    //assert (problem_ -> Var (index) -> Multiplicity () > 0);
    5758
    58     if ((index == ind_obj) ||
     59    if (//(index == ind_obj) ||
    5960        (problem_ -> Var (index) -> Multiplicity () <= 0))
    6061      continue;
  • stable/0.2/Couenne/src/convex/genRowCuts.cpp

    r1 r159  
     1/* $Id: genRowCuts.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    genRowCuts.cpp
  • stable/0.2/Couenne/src/convex/generateCuts.cpp

    r112 r159  
    1 /*
     1/* $Id: generateCuts.cpp 141 2009-06-03 04:19:19Z pbelotti $
     2 *
    23 * Name:    generateCuts.cpp
    34 * Author:  Pietro Belotti
     
    1516#include "CouenneSolverInterface.hpp"
    1617
     18#define Couenne_large_bound2 9.99e30
     19
     20// checks bad cuts against known optimum
     21bool isOptimumCut (const CouNumber *opt, OsiCuts &cs, CouenneProblem *p);
    1722
    1823// set and lift bound for auxiliary variable associated with objective
     
    2328
    2429  // fictitious bound for initial unbounded lp relaxations
    25   const CouNumber large_bound =  9.999e12;
    26   const CouNumber large_tol = (large_bound / 1e6);
     30  const CouNumber large_tol = (Couenne_large_bound2 / 1e6);
    2731
    2832  // set trivial dual bound to objective function, if there is none
     
    3842  if (action)
    3943    //if (sense<0)
    40       {if (p -> Lb (ind_obj) < - large_bound) p -> Lb (ind_obj) = - large_bound;}
    41   //else         {if (p -> Ub (ind_obj) >   large_bound) p -> Ub (ind_obj) =   large_bound;}
     44      {if (p -> Lb (ind_obj) < - Couenne_large_bound2) p -> Lb (ind_obj) = - Couenne_large_bound2;}
     45  //else         {if (p -> Ub (ind_obj) >   large_bound2) p -> Ub (ind_obj) =   large_bound2;}
    4246  else
    43     //if (sense>0) {if (fabs (p->Ub(ind_obj)-large_bound)<large_tol) p->Ub(ind_obj)=COUENNE_INFINITY;}
     47    //if (sense>0) {if (fabs (p->Ub(ind_obj)-large_bound2)<large_tol) p->Ub(ind_obj)=COUENNE_INFINITY;}
    4448    //else         
    45       {if (fabs (p->Lb(ind_obj)+large_bound)<large_tol) p->Lb(ind_obj) =-COUENNE_INFINITY;}
     49      {if (fabs (p->Lb(ind_obj)+Couenne_large_bound2)<large_tol) p->Lb(ind_obj) =-COUENNE_INFINITY;}
    4650}
    4751
     
    9296
    9397    const CouNumber
    94       *lb = si.getColLower (),
    95       *ub = si.getColUpper ();
    96 
    97     for (int i=problem_ -> nOrigVars (); i--; opt++, lb++, ub++)
    98       if ((*opt < *lb - COUENNE_EPS) || (*opt > *ub + COUENNE_EPS)) {
    99         //printf ("out of bounds, ignore (%d,%g) [%g,%g]\n",
    100         //problem_ -> nOrigVars () - i - 1, *opt, *lb, *ub);
     98      *sol = si.getColSolution (),
     99      *lb  = si.getColLower (),
     100      *ub  = si.getColUpper ();
     101
     102    int objind = problem_ -> Obj (0) -> Body () -> Index ();
     103
     104    for (int j=0, i=problem_ -> nVars (); i--; j++, opt++, lb++, ub++)
     105      if ((j != objind) &&
     106          ((*opt < *lb - COUENNE_EPS * (1 + CoinMin (fabs (*opt), fabs (*lb)))) ||
     107           (*opt > *ub + COUENNE_EPS * (1 + CoinMin (fabs (*opt), fabs (*ub)))))) {
     108       
     109        jnlst_ -> Printf (J_VECTOR, J_CONVEXIFYING,
     110                          "out of bounds, ignore x%d = %g [%g,%g] opt = %g\n",
     111                          problem_ -> nVars () - i - 1, *sol, *lb, *ub, *opt);
     112
    101113        // optimal point is not in current bounding box,
    102114        // pretend realOpt is NULL until we return from this procedure
    103         //realOpt = NULL;
     115        realOpt = NULL;
    104116        break;
    105117      }
     
    327339    // Reduced Cost BT -- to be done first to use rcost correctly
    328340    if (!firstcall_  &&                         // have a linearization already
     341        problem_ -> doRCBT () &&                // authorized to do reduced cost tightening
    329342        problem_ -> redCostBT (&si, chg_bds) && // some variables were tightened with reduced cost
    330343        !(problem_ -> btCore (chg_bds)))        // in this case, do another round of FBBT
     
    406419      // fill originals with nlp values
    407420      CoinCopyN (nlpSol, problem_ -> nOrigVars (), problem_ -> domain () -> x ());
    408       problem_ -> initAuxs ();
     421      //problem_ -> initAuxs ();
     422
     423      problem_ -> getAuxs (problem_ -> domain () -> x ());
    409424
    410425      if (jnlst_ -> ProduceOutput (J_VECTOR, J_CONVEXIFYING)) {
     
    451466      jnlst_->Printf(J_ITERSUMMARY, J_CONVEXIFYING,
    452467                     "Couenne: %d initial row cuts\n", cs.sizeRowCuts ());
    453   }
    454 
    455   // end of OBBT //////////////////////////////////////////////////////////////////////
     468
     469    if (realOpt && // this is a good time to check if we have messed up with the optimal solution
     470        isOptimumCut (realOpt, cs, problem_))
     471      jnlst_->Printf(J_ITERSUMMARY, J_CONVEXIFYING,
     472                     "\n\n CUT OPTIMUM\n\n");
     473  }
    456474
    457475  catch (int exception) {
  • stable/0.2/Couenne/src/convex/operators/alphaConvexify.cpp

    r61 r159  
     1/* $Id: alphaConvexify.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    alphaConvexify.cpp
  • stable/0.2/Couenne/src/convex/operators/conv-exprAbs.cpp

    r1 r159  
     1/* $Id: conv-exprAbs.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    conv-exprAbs.cpp
  • stable/0.2/Couenne/src/convex/operators/conv-exprDiv.cpp

    r1 r159  
     1/* $Id: conv-exprDiv.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    conv-exprDiv.cpp
  • stable/0.2/Couenne/src/convex/operators/conv-exprExp.cpp

    r1 r159  
     1/* $Id: conv-exprExp.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    conv-exprExp.cpp
  • stable/0.2/Couenne/src/convex/operators/conv-exprGroup.cpp

    r34 r159  
     1/* $Id: conv-exprGroup.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    conv-exprGroup.cpp
  • stable/0.2/Couenne/src/convex/operators/conv-exprInv.cpp

    r34 r159  
     1/* $Id: conv-exprInv.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    conv-exprInv.cpp
  • stable/0.2/Couenne/src/convex/operators/conv-exprLog.cpp

    r1 r159  
     1/* $Id: conv-exprLog.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    conv-exprLog.cpp
  • stable/0.2/Couenne/src/convex/operators/conv-exprMul-genCuts.cpp

    r1 r159  
     1/* $Id: conv-exprMul-genCuts.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    conv-exprMul-genCuts.cpp
  • stable/0.2/Couenne/src/convex/operators/conv-exprMul.cpp

    r61 r159  
     1/* $Id: conv-exprMul.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    conv-exprMul.cpp
  • stable/0.2/Couenne/src/convex/operators/conv-exprOpp.cpp

    r1 r159  
     1/* $Id: conv-exprOpp.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    conv-exprOpp.cpp
  • stable/0.2/Couenne/src/convex/operators/conv-exprPow-envelope.cpp

    r1 r159  
     1/* $Id: conv-exprPow-envelope.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    conv-exprPow-envelope.cpp
  • stable/0.2/Couenne/src/convex/operators/conv-exprPow-getBounds.cpp

    r39 r159  
    1 /*
     1/* $Id: conv-exprPow-getBounds.cpp 139 2009-06-03 03:56:30Z pbelotti $
     2 *
    23 * Name:    conv-exprPow-getBounds.cpp
    34 * Author:  Pietro Belotti
    45 * Purpose: method to get lower and upper bounds of a power x^y
    56 *
    6  * (C) Carnegie-Mellon University, 2006.
     7 * (C) Carnegie-Mellon University, 2006-09.
    78 * This file is licensed under the Common Public License (CPL)
    89 */
     
    7980
    8081      if (expon > 0)
    81         all [1] = new exprPow (new exprClone (lbbase), new exprConst (expon));
     82        all    [1] = new exprPow (new exprClone (lbbase), new exprConst (expon));
    8283      else all [1] = new exprPow (new exprClone (ubbase), new exprConst (expon));
    8384
     
    121122        ub = new exprMax (new exprPow (new exprClone (lbbase), new exprConst (expon)),
    122123                          new exprPow (new exprClone (ubbase), new exprConst (expon)));
    123       } else {
     124
     125      } else { // from this point on, expon < 0
    124126
    125127        expression **alu = new expression * [6];
     
    129131        alu [4] = new exprClone (ubbase);
    130132
    131         if ((expon > 0) || ((isInt || isInvInt) && !(rndexp % 2)))
    132           alu    [1] = new exprPow (new exprClone (ubbase), new exprConst (expon));
    133         else alu [1] = new exprPow (new exprClone (lbbase), new exprConst (expon));
     133        //if ((isInt || isInvInt) && !(rndexp % 2))
     134        //alu    [1] = new exprPow (new exprClone (ubbase), new exprConst (expon));
     135        //else
     136
     137        // if negative exponent and base has nonnegative lower bound,
     138        // the upper bound can only be lb^k
     139        alu [1] = new exprPow (new exprClone (lbbase), new exprConst (expon));
    134140
    135141        // alu [3] is upper bound when lbbase <= 0 <= ubbase
    136142
    137         if (expon < - COUENNE_EPS)
    138           alu [3] = new exprConst (COUENNE_INFINITY);
    139         else if (isInt && !(rndexp % 2))
    140           alu [3] = new exprPow (new exprMax (new exprClone (lbbase), new exprClone (ubbase)),
    141                                  new exprConst (expon));
    142         else alu [3] = new exprPow (new exprClone (ubbase), new exprConst (expon));
     143        //if (expon < - COUENNE_EPS)
     144        alu [3] = new exprConst (COUENNE_INFINITY);
     145        //else if (isInt && !(rndexp % 2))
     146        //alu [3] = new exprPow (new exprMax (new exprClone (lbbase), new exprClone (ubbase)),
     147        //new exprConst (expon));
     148        //else alu [3] = new exprPow (new exprClone (ubbase), new exprConst (expon));
    143149
    144150        // alu [5] is the upper bound value when lbbase <= ubbase <= 0
    145151
    146         if (expon > COUENNE_EPS) {
     152        /*if (expon > COUENNE_EPS) {
    147153
    148154          if (isInt && !(rndexp % 2))
     
    150156          else alu [5] = new exprConst (0.);
    151157        }
    152         else {
    153           if (isInt || isInvInt)
    154             alu [5] = new exprPow (new exprClone(ubbase), new exprConst(expon));
    155           else alu [5] = new exprConst (COUENNE_INFINITY);
    156         }
     158        else {*/
     159        if (isInt || isInvInt)
     160          alu [5] = new exprPow (new exprClone (ubbase), new exprConst (expon));
     161        else alu [5] = new exprConst (COUENNE_INFINITY);
     162          //}
    157163
    158164        ub = new exprMin (alu, 6);
  • stable/0.2/Couenne/src/convex/operators/conv-exprPow.cpp

    r34 r159  
    1 /*
     1/* $Id: conv-exprPow.cpp 151 2009-06-16 03:31:06Z pbelotti $
     2 *
    23 * Name:    conv-exprPow.cpp
    34 * Author:  Pietro Belotti
  • stable/0.2/Couenne/src/convex/operators/conv-exprQuad.cpp

    r61 r159  
     1/* $Id: conv-exprQuad.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    conv-exprQuad.cpp
  • stable/0.2/Couenne/src/convex/operators/conv-exprSinCos.cpp

    r1 r159  
     1/* $Id: conv-exprSinCos.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    conv-exprSinCos.cpp
  • stable/0.2/Couenne/src/convex/operators/conv-exprSub.cpp

    r1 r159  
     1/* $Id: conv-exprSub.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    exprSub.cpp
  • stable/0.2/Couenne/src/convex/operators/conv-exprSum.cpp

    r1 r159  
     1/* $Id: conv-exprSum.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    conv-exprSum.cpp
  • stable/0.2/Couenne/src/convex/operators/powNewton.cpp

    r1 r159  
     1/* $Id: powNewton.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    powNewton.cpp
  • stable/0.2/Couenne/src/convex/operators/quadCuts.cpp

    r1 r159  
     1/* $Id: quadCuts.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    quadCuts.cpp
  • stable/0.2/Couenne/src/convex/operators/trigNewton.cpp

    r1 r159  
     1/* $Id: trigNewton.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    trigNewton.cpp
  • stable/0.2/Couenne/src/convex/operators/unifiedProdCuts.cpp

    r1 r159  
     1/* $Id: unifiedProdCuts.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    unifiedProdCuts.cpp
  • stable/0.2/Couenne/src/convex/updateBranchInfo.cpp

    r1 r159  
     1/* $Id: updateBranchInfo.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    updateBranchInfo.cpp
  • stable/0.2/Couenne/src/disjunctive/CouenneDisjCuts.cpp

    r39 r159  
     1/* $Id: CouenneDisjCuts.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouenneDisjCuts.cpp
  • stable/0.2/Couenne/src/disjunctive/CouenneDisjCuts.hpp

    r39 r159  
     1/* $Id: CouenneDisjCuts.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouenneDisjCuts.hpp
  • stable/0.2/Couenne/src/disjunctive/OsiCuts2MatrVec.cpp

    r39 r159  
     1/* $Id: OsiCuts2MatrVec.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    OsiCuts2MatrVec.cpp
  • stable/0.2/Couenne/src/disjunctive/OsiLinear2MatrVec.cpp

    r39 r159  
    1 /*
     1/* $Id: OsiLinear2MatrVec.cpp 154 2009-06-16 18:52:53Z pbelotti $
     2 *
    23 * Name:    OsiLinear2MatrVec.cpp
    34 * Author:  Pietro Belotti
  • stable/0.2/Couenne/src/disjunctive/disjCut.cpp

    r112 r159  
    1 /*
     1/* $Id: disjCut.cpp 154 2009-06-16 18:52:53Z pbelotti $
     2 *
    23 * Name:    disjCut.cpp
    34 * Author:  Pietro Belotti
  • stable/0.2/Couenne/src/disjunctive/dummyVecMatr.cpp

    r39 r159  
     1/* $Id: dummyVecMatr.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    dummyVecMatr.cpp
  • stable/0.2/Couenne/src/disjunctive/generateDisjCuts.cpp

    r39 r159  
    1 /*
     1/* $Id: generateDisjCuts.cpp 154 2009-06-16 18:52:53Z pbelotti $
     2 *
    23 * Name:    generateDisjCuts.cpp
    34 * Author:  Pietro Belotti
  • stable/0.2/Couenne/src/disjunctive/getDisjunctions.cpp

    r39 r159  
     1/* $Id: getDisjunctions.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    getDisjunctions.cpp
  • stable/0.2/Couenne/src/disjunctive/separateWithDisjunction.cpp

    r64 r159  
     1/* $Id: separateWithDisjunction.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    separateWithDisjunction.cpp
  • stable/0.2/Couenne/src/disjunctive/singleDisjunctions.cpp

    r39 r159  
     1/* $Id: singleDisjunctions.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    singleDisjunctions.cpp
  • stable/0.2/Couenne/src/expression/CouExpr.cpp

    r103 r159  
     1/* $Id$ */
    12/*
    23 * Name:    CouExpr.hpp
  • stable/0.2/Couenne/src/expression/CouExpr.hpp

    r103 r159  
     1/* $Id$ */
    12/*
    23 * Name:    CouExpr.hpp
  • stable/0.2/Couenne/src/expression/CouennePrecisions.hpp

    r1 r159  
     1/* $Id: CouennePrecisions.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouennePrecisions.hpp
     
    3637#define MAX_BOUND 1.e45
    3738
     39/// used to declare LP unbounded
     40const double Couenne_large_bound =  9.999e12;
     41
    3842#endif
  • stable/0.2/Couenne/src/expression/CouenneTypes.hpp

    r39 r159  
     1/* $Id: CouenneTypes.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    CouenneTypes.hpp
  • stable/0.2/Couenne/src/expression/domain.cpp

    r69 r159  
     1/* $Id: domain.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    domain.cpp
  • stable/0.2/Couenne/src/expression/domain.hpp

    r69 r159  
     1/* $Id: domain.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    domain.hpp
  • stable/0.2/Couenne/src/expression/exprAux.cpp

    r75 r159  
    1 /*
     1/* $Id: exprAux.cpp 156 2009-06-16 20:24:38Z pbelotti $
     2 *
    23 * Name:    exprAux.cpp
    34 * Author:  Pietro Belotti
     
    272273/// return proper object to handle expression associated with this
    273274/// variable (NULL if this is not an auxiliary)
    274 CouenneObject *exprAux::properObject (CouenneProblem *p,
    275                                       Bonmin::BabSetupBase *base,
    276                                       JnlstPtr jnlst) {
     275CouenneObject exprAux::properObject (CouenneProblem *p,
     276                                     Bonmin::BabSetupBase *base,
     277                                     JnlstPtr jnlst) {
     278
     279  CouenneObject *retp = NULL;
    277280
    278281  /*if (image_ -> code () == COU_EXPRMUL) printf ("OK1\n");
     
    288291      (image_ -> ArgList () [1] -> Index () >= 0) &&
    289292      (fabs (lb ()) < COUENNE_EPS) &&
    290       (fabs (ub ()) < COUENNE_EPS))
     293      (fabs (ub ()) < COUENNE_EPS)) {
    291294
    292295    // it's a complementarity constraint object!
    293296
    294     return new CouenneComplObject (p, this, base, jnlst);
    295   else return new CouenneObject (p, this, base, jnlst);
    296 }
     297    CouenneComplObject obj (p, this, base, jnlst);
     298    return obj;
     299  }
     300  else {
     301    CouenneObject obj (p, this, base, jnlst);
     302    return obj;
     303  }
     304
     305  //  return (*retp);
     306}
  • stable/0.2/Couenne/src/expression/exprAux.hpp

    r76 r159  
    1 /*
     1/* $Id: exprAux.hpp 156 2009-06-16 20:24:38Z pbelotti $
     2 *
    23 * Name:    exprAux.hpp
    34 * Author:  Pietro Belotti
     
    183184  /// return proper object to handle expression associated with this
    184185  /// variable (NULL if this is not an auxiliary)
    185   CouenneObject *properObject (CouenneProblem *p,
    186                                Bonmin::BabSetupBase *base,
    187                                JnlstPtr jnlst);
     186  CouenneObject properObject (CouenneProblem *p,
     187                              Bonmin::BabSetupBase *base,
     188                              JnlstPtr jnlst);
    188189};
    189190
  • stable/0.2/Couenne/src/expression/exprBound.hpp

    r1 r159  
     1/* $Id: exprBound.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    exprBound.hpp
  • stable/0.2/Couenne/src/expression/exprClone.hpp

    r33 r159  
     1/* $Id: exprClone.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    exprClone.hpp
  • stable/0.2/Couenne/src/expression/exprConst.hpp

    r34 r159  
     1/* $Id: exprConst.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    exprConst.hpp
  • stable/0.2/Couenne/src/expression/exprCopy.hpp

    r34 r159  
     1/* $Id: exprCopy.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    exprCopy.hpp
  • stable/0.2/Couenne/src/expression/exprIVar.hpp

    r1 r159  
     1/* $Id: exprIVar.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    exprIVar.hpp
  • stable/0.2/Couenne/src/expression/exprOp.cpp

    r114 r159  
     1/* $Id: exprOp.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    exprOp.cpp
  • stable/0.2/Couenne/src/expression/exprOp.hpp

    r34 r159  
     1/* $Id: exprOp.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    exprOp.hpp
  • stable/0.2/Couenne/src/expression/exprStore.hpp

    r33 r159  
     1/* $Id: exprStore.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    exprStore.hpp
  • stable/0.2/Couenne/src/expression/exprUnary.cpp

    r69 r159  
     1/* $Id: exprUnary.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    exprUnary.cpp
  • stable/0.2/Couenne/src/expression/exprUnary.hpp

    r34 r159  
     1/* $Id: exprUnary.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    exprUnary.hpp
  • stable/0.2/Couenne/src/expression/exprVar.cpp

    r34 r159  
    1 /*
     1/* $Id: exprVar.cpp 156 2009-06-16 20:24:38Z pbelotti $
     2 *
    23 * Name:    exprVar.cpp
    34 * Author:  Pietro Belotti
     
    910
    1011#include "CouenneCutGenerator.hpp"
     12#include "CouenneObject.hpp"
    1113#include "exprAux.hpp"
    1214#include "exprVar.hpp"
     
    6365expression *exprVar::Lb () {return new exprLowerBound (varIndex_, domain_);}///< lower bound
    6466expression *exprVar::Ub () {return new exprUpperBound (varIndex_, domain_);}///< upper bound
     67
     68
     69// dummy function -- the real one is in exprAux and returns either a
     70// CouenneObject or a CouenneComplObject
     71CouenneObject exprVar::properObject (CouenneProblem *p,
     72                                      Bonmin::BabSetupBase *base,
     73                                      JnlstPtr jnlst_) {
     74  return CouenneObject ();
     75}
  • stable/0.2/Couenne/src/expression/exprVar.hpp

    r39 r159  
    1 /*
     1/* $Id: exprVar.hpp 156 2009-06-16 20:24:38Z pbelotti $
     2 *
    23 * Name:    exprVar.hpp
    34 * Author:  Pietro Belotti
     
    191192  /// return proper object to handle expression associated with this
    192193  /// variable (NULL if this is not an auxiliary)
    193   virtual CouenneObject *properObject (CouenneProblem *p,
    194                                        Bonmin::BabSetupBase *base,
    195                                        JnlstPtr jnlst_)
    196   {return NULL;}
     194  virtual CouenneObject properObject (CouenneProblem *p,
     195                                      Bonmin::BabSetupBase *base,
     196                                      JnlstPtr jnlst_);
    197197};
    198198
  • stable/0.2/Couenne/src/expression/expression.cpp

    r34 r159  
    1 /*
     1/* $Id: expression.cpp 155 2009-06-16 20:19:39Z pbelotti $
     2 *
    23 * Name:    expression.cpp
    34 * Author:  Pietro Belotti
  • stable/0.2/Couenne/src/expression/expression.hpp

    r39 r159  
    1 /*
     1/* $Id: expression.hpp 154 2009-06-16 18:52:53Z pbelotti $
     2 *
    23 * Name:    expression.hpp
    34 * Author:  Pietro Belotti
  • stable/0.2/Couenne/src/expression/operators/bounds/exprBCos.hpp

    r1 r159  
     1/* $Id: exprBCos.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    exprBCos.hpp
  • stable/0.2/Couenne/src/expression/operators/bounds/exprBDiv.hpp

    r1 r159  
     1/* $Id: exprBDiv.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    exprBDiv.hpp
  • stable/0.2/Couenne/src/expression/operators/bounds/exprBMul.hpp

    r1 r159  
     1/* $Id: exprBMul.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    exprBMul.hpp
  • stable/0.2/Couenne/src/expression/operators/bounds/exprBQuad.cpp

    r1 r159  
     1/* $Id: exprBQuad.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    exprBQuad.cpp
  • stable/0.2/Couenne/src/expression/operators/bounds/exprBQuad.hpp

    r98 r159  
     1/* $Id: exprBQuad.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    exprBQuad.hpp
  • stable/0.2/Couenne/src/expression/operators/bounds/exprBSin.hpp

    r1 r159  
     1/* $Id: exprBSin.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    exprBSin.hpp
  • stable/0.2/Couenne/src/expression/operators/compQuadFinBounds.cpp

    r1 r159  
     1/* $Id: compQuadFinBounds.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    compQuadFinBounds.cpp
  • stable/0.2/Couenne/src/expression/operators/exprAbs.cpp

    r34 r159  
     1/* $Id: exprAbs.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    exprAbs.cpp
  • stable/0.2/Couenne/src/expression/operators/exprAbs.hpp

    r34 r159  
     1/* $Id: exprAbs.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    exprAbs.hpp
  • stable/0.2/Couenne/src/expression/operators/exprCos.cpp

    r34 r159  
     1/* $Id: exprCos.cpp 141 2009-06-03 04:19:19Z pbelotti $ */
    12/*
    23 * Name:    exprCos.cpp
  • stable/0.2/Couenne/src/expression/operators/exprCos.hpp

    r34 r159  
     1/* $Id: exprCos.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprCos.hpp
  • stable/0.2/Couenne/src/expression/operators/exprDiv.cpp

    r34 r159  
     1/* $Id: exprDiv.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprDiv.cpp
  • stable/0.2/Couenne/src/expression/operators/exprDiv.hpp

    r34 r159  
     1/* $Id: exprDiv.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprDiv.hpp
  • stable/0.2/Couenne/src/expression/operators/exprExp.cpp

    r34 r159  
     1/* $Id: exprExp.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprExp.cpp
  • stable/0.2/Couenne/src/expression/operators/exprExp.hpp

    r34 r159  
     1/* $Id: exprExp.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprExp.hpp
  • stable/0.2/Couenne/src/expression/operators/exprGroup.cpp

    r112 r159  
     1/* $Id: exprGroup.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprGroup.cpp
     
    45 * Purpose: implementation of some methods for exprGroup
    56 *
    6  * (C) Carnegie-Mellon University, 2006-08.
     7 * (C) Carnegie-Mellon University, 2006-09.
    78 * This file is licensed under the Common Public License (CPL)
    89 */
     
    1718
    1819class Domain;
     20
     21
     22// eliminates elements with zero coefficients
     23void cleanZeros (std::vector <std::pair <exprVar *, CouNumber> > &lcoeff) {
     24
     25  std::vector <std::pair <exprVar *, CouNumber> >::iterator i = lcoeff.begin ();
     26
     27  int
     28    ind  = 0,
     29    size = lcoeff.size ();
     30 
     31  while (size-- > 0) {
     32    if ((i -> second ==  0.) ||
     33        (i -> second == -0.)) {
     34      lcoeff.erase (i);
     35      i = lcoeff.begin () + ind;
     36    } else {
     37      ++i;
     38      ++ind;
     39    }
     40  }
     41}
     42
     43
    1944
    2045/// Generalized (static) constructor: check parameters and return a
     
    2752  expression *ret = NULL;
    2853
     54  cleanZeros (lcoeff);
     55
    2956  // a constant
    3057  if ((n==0) && (nl==0))
     
    5077  exprSum  (al, n),
    5178  lcoeff_  (lcoeff),
    52   c0_      (c0) {}
     79  c0_      (c0) {
     80
     81  cleanZeros (lcoeff_);
     82}
    5383
    5484
  • stable/0.2/Couenne/src/expression/operators/exprGroup.hpp

    r112 r159  
     1/* $Id: exprGroup.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprGroup.hpp
  • stable/0.2/Couenne/src/expression/operators/exprIf.hpp

    r1 r159  
     1/* $Id: exprIf.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprIf.hpp
  • stable/0.2/Couenne/src/expression/operators/exprInv.cpp

    r1 r159  
     1/* $Id: exprInv.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprInv.cpp
  • stable/0.2/Couenne/src/expression/operators/exprInv.hpp

    r34 r159  
     1/* $Id: exprInv.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprInv.hpp
  • stable/0.2/Couenne/src/expression/operators/exprLog.cpp

    r34 r159  
     1/* $Id: exprLog.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprLog.cpp
  • stable/0.2/Couenne/src/expression/operators/exprLog.hpp

    r34 r159  
     1/* $Id: exprLog.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprLog.hpp
  • stable/0.2/Couenne/src/expression/operators/exprMax.hpp

    r1 r159  
     1/* $Id: exprMax.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprMax.hpp
  • stable/0.2/Couenne/src/expression/operators/exprMin.hpp

    r1 r159  
     1/* $Id: exprMin.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprMin.hpp
  • stable/0.2/Couenne/src/expression/operators/exprMinMax.cpp

    r1 r159  
     1/* $Id: exprMinMax.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprMinMax.cpp
  • stable/0.2/Couenne/src/expression/operators/exprMul.cpp

    r1 r159  
     1/* $Id: exprMul.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprMul.cpp
  • stable/0.2/Couenne/src/expression/operators/exprMul.hpp

    r34 r159  
     1/* $Id: exprMul.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprMul.hpp
  • stable/0.2/Couenne/src/expression/operators/exprNorm.hpp

    r1 r159  
     1/* $Id: exprNorm.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprNorm.hpp
  • stable/0.2/Couenne/src/expression/operators/exprOpp.cpp

    r79 r159  
     1/* $Id: exprOpp.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprOpp.cpp
  • stable/0.2/Couenne/src/expression/operators/exprOpp.hpp

    r34 r159  
     1/* $Id: exprOpp.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprOpp.hpp
  • stable/0.2/Couenne/src/expression/operators/exprPWLinear.hpp

    r1 r159  
     1/* $Id: exprPWLinear.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprPWLinear.hpp
  • stable/0.2/Couenne/src/expression/operators/exprPow.cpp

    r1 r159  
     1/* $Id: exprPow.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprPow.cpp
  • stable/0.2/Couenne/src/expression/operators/exprPow.hpp

    r62 r159  
     1/* $Id: exprPow.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprPow.hpp
  • stable/0.2/Couenne/src/expression/operators/exprQuad.cpp

    r75 r159  
     1/* $Id: exprQuad.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprQuad.cpp
     
    468469
    469470
     471/// Redirect variables to proper variable vector
     472void exprQuad::realign (const CouenneProblem *p) {
     473
     474  for (sparseQ::iterator row = matrix_.begin (); row != matrix_.end (); ++row) {
     475
     476    exprVar * &vr = row -> first;
     477    int indVar;
     478
     479    // substitute variable representing this row with its newest version
     480
     481    if (((vr -> Type () == VAR) ||
     482         (vr -> Type () == AUX)) &&
     483        (vr -> Original () != p -> Var (indVar = vr -> Index ()))) {
     484
     485      expression *trash = vr;
     486      row -> first = p -> Var (indVar);
     487      delete trash;
     488    }
     489
     490    // substitute each variable of this row with its newest version
     491
     492    for (sparseQcol::iterator col = row -> second.begin (); col != row -> second.end (); ++col) {
     493
     494      exprVar * &vc = col -> first;
     495      int indVar;
     496
     497      // substitute variable representing this row with its newest version
     498
     499      if (((vc -> Type () == VAR) ||
     500           (vc -> Type () == AUX)) &&
     501          (vc -> Original () != p -> Var (indVar = vc -> Index ()))) {
     502
     503        expression *trash = vc;
     504        col -> first = p -> Var (indVar);
     505        delete trash;
     506      }
     507    }
     508  }
     509}
     510
     511
    470512/// compute $y^{lv}$ and $y^{uv}$ for Violation Transfer algorithm
    471513void exprQuad::closestFeasible (expression *varind,
     
    473515                                CouNumber &left,
    474516                                CouNumber &right) const {
    475   assert (false);
     517
     518  fprintf (stderr, "exprQuad::closestFeasible() not available for VT\n");
     519  exit (-1);
    476520}
    477521
  • stable/0.2/Couenne/src/expression/operators/exprQuad.hpp

    r75 r159  
     1/* $Id: exprQuad.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/**
    23 * Name:    exprQuad.hpp
     
    257258  virtual void replace (exprVar *x, exprVar *w);
    258259
     260  /// replace variable x with new (aux) w
     261  virtual void realign (const CouenneProblem *p);
     262
    259263  /// implied bound processing
    260264  virtual bool impliedBound (int, CouNumber *, CouNumber *, t_chg_bounds *);
  • stable/0.2/Couenne/src/expression/operators/exprSin.cpp

    r34 r159  
     1/* $Id: exprSin.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprSin.cpp
  • stable/0.2/Couenne/src/expression/operators/exprSin.hpp

    r34 r159  
     1/* $Id: exprSin.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprSin.hpp
  • stable/0.2/Couenne/src/expression/operators/exprSub.cpp

    r64 r159  
     1/* $Id: exprSub.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprSub.cpp
  • stable/0.2/Couenne/src/expression/operators/exprSub.hpp

    r34 r159  
     1/* $Id: exprSub.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprSub.hpp
  • stable/0.2/Couenne/src/expression/operators/exprSum.cpp

    r34 r159  
     1/* $Id: exprSum.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprSum.cpp
  • stable/0.2/Couenne/src/expression/operators/exprSum.hpp

    r34 r159  
     1/* $Id: exprSum.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    exprSum.hpp
  • stable/0.2/Couenne/src/expression/simplify/simplifiers.cpp

    r1 r159  
     1/* $Id: simplifiers.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    simplifiers.cpp
  • stable/0.2/Couenne/src/expression/simplify/simplify.cpp

    r1 r159  
     1/* $Id: simplify.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    simplify.cpp
  • stable/0.2/Couenne/src/main/BonCouenne.cpp

    r103 r159  
     1// $Id: BonCouenne.cpp 154 2009-06-16 18:52:53Z pbelotti $
     2//
    13// (C) Copyright International Business Machines Corporation and Carnegie Mellon University 2006, 2007
    24// All Rights Reserved.
  • stable/0.2/Couenne/src/main/BonCouenneInfo.cpp

    r1 r159  
     1/* $Id: BonCouenneInfo.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12// (C) Copyright International Business Machines Corporation 2007
    23// All Rights Reserved.
  • stable/0.2/Couenne/src/main/BonCouenneInfo.hpp

    r1 r159  
     1/* $Id: BonCouenneInfo.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12// (C) Copyright International Business Machines Corporation 2008
    23// All Rights Reserved.
  • stable/0.2/Couenne/src/main/BonCouenneInterface.cpp

    r115 r159  
     1/* $Id: BonCouenneInterface.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12// (C) Copyright International Business Machines Corporation (IBM) 2006, 2007
    23// All Rights Reserved.
     
    115116        *nub = getColUpper ();
    116117
    117       for (int i=0; i < p -> nOrigVars (); i++)
     118      for (int i=0; i < p -> nOrigVars () - p -> nDefVars (); i++)
    118119        if (p -> Var (i) -> Multiplicity () > 0) {
     120          /*printf ("---- %4d [%g,%g] [%g,%g]\n", i,
     121                  nlb [i], nub [i],
     122                  p -> Lb (i), p -> Ub (i));*/
    119123          if (nlb [i] < p -> Lb (i) - COUENNE_EPS) setColLower (i, p -> Lb (i));
    120124          if (nub [i] > p -> Ub (i) + COUENNE_EPS) setColUpper (i, p -> Ub (i));
     
    124128          setColUpper (i,  COIN_DBL_MAX);
    125129        }
     130    } // ends FBBT part
     131
     132    if (is_feasible) {
     133      try {
     134        initialSolve ();
     135      }
     136      catch (TNLPSolver::UnsolvedError *E) {
     137        // wrong, if NLP has problems this is not necessarily true...
     138        //is_feasible = false;
     139      }
    126140    }
    127141
    128     if (is_feasible)
    129       initialSolve ();
    130     else {
     142    if (!is_feasible) {
    131143      OsiAuxInfo * auxInfo = si.getAuxiliaryInfo ();
    132144      BabInfo * babInfo = dynamic_cast <BabInfo *> (auxInfo);
     
    135147        babInfo -> setInfeasibleNode ();
    136148    }
    137 
     149   
    138150    if (is_feasible && isProvenOptimal ()) {
    139151
     
    204216            setColSolution (Y); // use initial solution given
    205217
    206             resolve (); // solve with integer variables fixed
     218            try {
     219              resolve (); // solve with integer variables fixed
     220            }
     221            catch(TNLPSolver::UnsolvedError *E) {
     222            }
     223
     224            //resolve ();
    207225
    208226            obj      = getObjValue ();
  • stable/0.2/Couenne/src/main/BonCouenneInterface.hpp

    r84 r159  
     1/* $Id: BonCouenneInterface.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12// (C) Copyright International Business Machines Corporation (IBM) 2006-09
    23// All Rights Reserved.
  • stable/0.2/Couenne/src/main/BonCouenneSetup.cpp

    r85 r159  
     1/* $Id: BonCouenneSetup.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12// (C) Copyright International Business Machines Corporation 2007
    23// All Rights Reserved.
     
    176177   
    177178    extraStuff = dynamic_cast <Bonmin::BabInfo *> (continuousSolver_ -> getAuxiliaryInfo ());
    178    
     179
    179180    /* Setup log level*/
    180181    int lpLogLevel;
     
    229230
    230231      nSOS = couenneProb -> findSOS (nonlinearSolver (), objects);
     232
     233      nonlinearSolver () -> addObjects (nSOS, objects);
     234
    231235      //printf ("==================== found %d SOS\n", nSOS);
    232236      //nonlinearSolver () -> addObjects (nSOS, objects);
  • stable/0.2/Couenne/src/main/BonCouenneSetup.hpp

    r42 r159  
     1/* $Id: BonCouenneSetup.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12// (C) Copyright International Business Machines Corporation 2007
    23// All Rights Reserved.
  • stable/0.2/Couenne/src/main/BonInitHeuristic.cpp

    r112 r159  
     1/* $Id: BonInitHeuristic.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12// (C) Copyright International Business Machines Corporation 2007
    23// All Rights Reserved.
  • stable/0.2/Couenne/src/main/BonInitHeuristic.hpp

    r1 r159  
     1/* $Id: BonInitHeuristic.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12// (C) Copyright International Business Machines Corporation 2007
    23// All Rights Reserved.
  • stable/0.2/Couenne/src/main/BonNlpHeuristic.cpp

    r115 r159  
     1/* $Id: BonNlpHeuristic.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12// (C) Copyright International Business Machines Corporation 2007
    23// All Rights Reserved.
     
    280281
    281282      // apply NLP solver /////////////////////////////////
    282       nlp_ -> initialSolve ();
     283      try {
     284        nlp_ -> initialSolve ();
     285      }
     286      catch (TNLPSolver::UnsolvedError *E) {}
    283287
    284288      double obj = (nlp_ -> isProvenOptimal()) ? nlp_ -> getObjValue (): COIN_DBL_MAX;
  • stable/0.2/Couenne/src/main/BonNlpHeuristic.hpp

    r1 r159  
     1/* $Id: BonNlpHeuristic.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12// (C) Copyright International Business Machines Corporation 2007
    23// All Rights Reserved.
  • stable/0.2/Couenne/src/main/CouTight.cpp

    r55 r159  
     1/* $Id: CouTight.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    CouTight.cpp
  • stable/0.2/Couenne/src/main/CouenneOSInterface.cpp

    r100 r159  
     1/* $Id$ */
    12/*
    23 * Name:    CouenneOS.cpp
  • stable/0.2/Couenne/src/problem/CouenneJournalist.hpp

    r39 r159  
    33// This code is published under the Common Public License.
    44//
    5 // $Id: CouenneJournalist.hpp 988 2007-06-01 21:57:27Z andreasw $
     5// $Id: CouenneJournalist.hpp 154 2009-06-16 18:52:53Z pbelotti $
    66//
    77// Author:  Andreas Waechter           IBM    2007-12-04
  • stable/0.2/Couenne/src/problem/CouenneLPtightenBounds.cpp

    r1 r159  
     1/* $Id: CouenneLPtightenBounds.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    CouenneLPtightenBounds.hpp
  • stable/0.2/Couenne/src/problem/CouenneProblem.cpp

    r103 r159  
     1/* $Id: CouenneProblem.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    CouenneProblem.cpp
  • stable/0.2/Couenne/src/problem/CouenneProblem.hpp

    r103 r159  
    1 /*
     1/* $Id: CouenneProblem.hpp 155 2009-06-16 20:19:39Z pbelotti $
     2 *
    23 * Name:    CouenneProblem.hpp
    34 * Author:  Pietro Belotti
     
    131132
    132133  bool doFBBT_;  ///< do Feasibility-based bound tightening
     134  bool doRCBT_;  ///< do reduced cost      bound tightening
    133135  bool doOBBT_;  ///< do Optimality-based  bound tightening
    134136  bool doABT_;   ///< do Aggressive        bound tightening
     
    157159  /// when finding all objects related to (having as argument) a
    158160  /// single variable
    159   std::vector <CouenneObject *> objects_;
     161  std::vector <CouenneObject> objects_;
    160162
    161163  /// each element is true if variable is integer and, if auxiliary,
     
    202204
    203205  inline int nOrigVars    () const {return nOrigVars_;}                ///< Number of orig. variables
     206  inline int nDefVars     () const {return ndefined_;}                 ///< Number of def'd variables
    204207  inline int nOrigIntVars () const {return nOrigIntVars_;}             ///< Number of original integers
    205208  inline int nIntVars     () const {return nIntVars_;}                 ///< Number of integer variables
     
    298301  // bound tightening parameters
    299302  bool doFBBT () const {return doFBBT_;} ///< shall we do Feasibility Based Bound Tightening?
     303  bool doRCBT () const {return doRCBT_;} ///< shall we do reduced cost      Bound Tightening?
    300304  bool doOBBT () const {return doOBBT_;} ///< shall we do Optimality  Based Bound Tightening?
    301305  bool doABT  () const {return doABT_;}  ///< shall we do Aggressive        Bound Tightening?
     
    451455
    452456  /// return object vector
    453   const std::vector <CouenneObject *> &Objects () const
     457  const std::vector <CouenneObject> &Objects () const
    454458  {return objects_;}
    455459
  • stable/0.2/Couenne/src/problem/CouenneProblemConstructors.cpp

    r110 r159  
    1 /*
     1/* $Id$
     2 *
    23 * Name:    CouenneProblemConstructors.cpp
    34 * Author:  Pietro Belotti
     
    4748  created_pcutoff_ (true),
    4849  doFBBT_    (true),
    49   doOBBT_    (false),
     50  doRCBT_    (true),
     51  doOBBT_    (true),
    5052  doABT_     (true),
    5153  logObbtLev_(0),
     
    9496
    9597    base -> options() -> GetStringValue ("feasibility_bt",  s, "couenne."); doFBBT_ = (s == "yes");
     98    base -> options() -> GetStringValue ("redcost_bt",      s, "couenne."); doRCBT_ = (s == "yes");
    9699    base -> options() -> GetStringValue ("optimality_bt",   s, "couenne."); doOBBT_ = (s == "yes");
    97100    base -> options() -> GetStringValue ("aggressive_fbbt", s, "couenne."); doABT_  = (s == "yes");
     
    125128  created_pcutoff_ (false),
    126129  doFBBT_       (p. doFBBT_),
     130  doRCBT_       (p. doRCBT_),
    127131  doOBBT_       (p. doOBBT_),
    128132  doABT_        (p. doABT_),
     
    134138  feas_tolerance_ (p.feas_tolerance_),
    135139  dependence_   (p.dependence_),
    136   objects_      (p.objects_),
     140  objects_      (p.objects_), // NO! have to copy all of them
    137141  integerRank_  (NULL),
    138142  numberInRank_ (p.numberInRank_),
  • stable/0.2/Couenne/src/problem/CouenneProblemElem.hpp

    r33 r159  
     1/* $Id: CouenneProblemElem.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    CouenneProblemElem.hpp
  • stable/0.2/Couenne/src/problem/CouenneRestoreUnused.cpp

    r115 r159  
     1/* $Id$ */
    12/*
    23 * Name:    CouenneRestoreUnused.cpp
  • stable/0.2/Couenne/src/problem/CouenneSOS.cpp

    r98 r159  
     1/* $Id: CouenneSOS.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    CouenneSOS.cpp
     
    4748      bool defVar = true;
    4849
     50      // now check if this is
     51      //
     52      // 1) an auxiliary fixed to one  ==> it's a SOS if its image is x1+x2+...+xk
     53      // 2) an auxiliary fixed to zero ==> it's a SOS if its image is -x1-x2-...-xk+1
     54
    4955      if      (fabs (cterm - 1.) < COUENNE_EPS) defVar = false;
    5056      else if (fabs (cterm)      > COUENNE_EPS) continue; // and defVar is true
     
    6773      // there are two possibilities:
    6874      //
    69       // 1) w is deined as w = 1 - \sum_{i=0}^n x_i  -- defvar = false
     75      // 1) w is defined as w = 1 - \sum_{i=0}^n x_i  -- defvar = false
    7076      //
    7177      // 2) w is defined as \sum_{i=0}^n x_i and w \in [1,1] -- defvar = true
     
    7480        intSOS = (*v) -> isInteger (),
    7581        isSOS  = true,
    76         onlyOrigVars = true; // if SOS constraints only contains
     82        onlyOrigVars = true; // if SOS constraint only contains
    7783                             // original variables, it has been
    7884                             // spotted by Cbc already
     
    116122        indices [i] = lcoe [j++]. first -> Index ();
    117123
    118       CouenneSOSObject *newsos = new CouenneSOSObject (solver, nelem, indices, NULL, 1,
    119                                                        jnlst_, true, true);
     124      // TODO: if use Cbc, add CbcSOSBranchingObject
     125
     126      /*CouenneSOSObject *newsos = new CouenneSOSObject (solver, nelem, indices, NULL, 1,
     127        jnlst_, true, true);*/
     128
     129      OsiSOS *newsos = new OsiSOS (solver, nelem, indices, NULL, 1);
    120130
    121131      objects [nSOS] = newsos;
  • stable/0.2/Couenne/src/problem/CouenneSolverInterface.cpp

    r112 r159  
     1/* $Id: CouenneSolverInterface.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    CouenneSolverInterface.cpp
     
    2021  cutgen_ (cg),
    2122  knowInfeasible_(false),
    22   knowOptimal_(false) {
     23  knowOptimal_(false),
     24  knowDualInfeasible_(false),
     25  doingResolve_ (true) {
    2326
    2427  // prevents from running OsiClpSolverInterface::tightenBounds()
     
    2932CouenneSolverInterface::CouenneSolverInterface (const CouenneSolverInterface &src):
    3033
    31   OsiSolverInterface (src),
     34  OsiSolverInterface    (src),
    3235  OsiClpSolverInterface (src),
    33   cutgen_ (src.cutgen_),
    34   knowInfeasible_ (src.knowInfeasible_),
    35   knowOptimal_ (src.knowOptimal_) {}
     36  cutgen_               (src.cutgen_),
     37  knowInfeasible_       (src.knowInfeasible_),
     38  knowOptimal_          (src.knowOptimal_),
     39  knowDualInfeasible_   (src.knowDualInfeasible_),
     40  doingResolve_         (src.doingResolve_) {}
    3641
    3742/// Destructor
     
    5358            cutgen_ -> Problem () -> print ();*/
    5459
    55   knowInfeasible_ =
    56   knowOptimal_    = false;
     60  knowInfeasible_     =
     61  knowOptimal_        =
     62  knowDualInfeasible_ = false;
    5763
    5864  OsiClpSolverInterface::initialSolve ();
    5965  //writeLp ("initialLP");
     66
     67  if (getObjValue () <= - Couenne_large_bound)
     68    knowDualInfeasible_ = true;
    6069
    6170  // some originals may be unused due to their zero multiplicity (that
     
    92101}
    93102
     103bool CouenneSolverInterface::isProvenDualInfeasible() const {
     104  return knowDualInfeasible_ || OsiClpSolverInterface::isProvenDualInfeasible();
     105}
    94106
    95107/// Defined in Couenne/src/convex/generateCuts.cpp
     
    136148  }
    137149
    138   knowInfeasible_ = false;
    139   knowOptimal_    = false;
     150  knowInfeasible_     =
     151  knowOptimal_        =
     152  knowDualInfeasible_ = false;
    140153
    141154  const CoinWarmStart *ws = NULL;
     
    149162  OsiClpSolverInterface::resolve ();
    150163
     164  if (getObjValue () <= - Couenne_large_bound)
     165    knowDualInfeasible_ = true;
     166
    151167  CouNumber objval = getObjValue (),
    152168    curCutoff = cutgen_ -> Problem () -> getCutOff ();
     169
    153170  // check if resolve found new integer solution
    154   if ((objval < curCutoff - COUENNE_EPS) &&
     171  if (doingResolve () &&                 // this is not called from strong branching
     172      isProvenOptimal () &&
     173      (objval < curCutoff - COUENNE_EPS) &&
    155174      (cutgen_ -> Problem () -> checkNLP (getColSolution (), objval, true)) &&
    156       (objval < curCutoff - COUENNE_EPS)) { // may have changed
     175      (objval < curCutoff - COUENNE_EPS) && // check again as it may have changed
     176      (objval > -COUENNE_INFINITY/2)) {    // check if it makes sense
    157177
    158178    // also save the solution so that cbcModel::setBestSolution saves it too
     
    252272
    253273  //#if 0
    254   knowInfeasible_ = false;
    255   knowOptimal_ = false;
     274  knowInfeasible_     =
     275  knowOptimal_        =
     276  knowDualInfeasible_ = false;
    256277
    257278  /*
     
    338359  resolve();
    339360
     361  if (getObjValue () <= - Couenne_large_bound)
     362    knowDualInfeasible_ = true;
     363
    340364  // some originals may be unused due to their zero multiplicity (that
    341365  // happens when they are duplicates), restore their value
     
    348372  }
    349373
    350   if (isProvenPrimalInfeasible ()) knowInfeasible_ = true;
    351   if (isProvenOptimal ())          knowOptimal_    = true;
     374  if (isProvenPrimalInfeasible ()) knowInfeasible_     = true;
     375  if (isProvenOptimal          ()) knowOptimal_        = true;
     376  if (isProvenDualInfeasible   ()) knowDualInfeasible_ = true;
    352377
    353378  //printf("obj value = %e\n",getObjValue());
  • stable/0.2/Couenne/src/problem/CouenneSolverInterface.hpp

    r103 r159  
     1/* $Id: CouenneSolverInterface.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    CouenneSolverInterface.hpp
     
    8788  {return continuousModel_;}
    8889
    89 private:
     90  /// set doingResolve_
     91  bool &doingResolve ()
     92  {return doingResolve_;}
     93
     94  /// is this problem unbounded?
     95  bool isProvenDualInfeasible () const;
     96  //{return knowDualInfeasible_;}
     97
     98protected:
    9099
    91100  /// The pointer to the Couenne cut generator. Gives us a lot of
     
    99108  /// Flag indicating that optimality was detected during solveFromHotStart
    100109  bool knowOptimal_;
     110
     111  /// Flag indicating this problem's continuous relaxation is unbounded
     112  bool knowDualInfeasible_;
     113
     114  /// flag to indicate this is an LP for the BB, not for (e.g.) strong
     115  /// branching or OBBT
     116  bool doingResolve_;
    101117};
    102118
  • stable/0.2/Couenne/src/problem/checkNLP.cpp

    r115 r159  
     1/* $Id: checkNLP.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    checkNLP.cpp
     
    3435        (fabs (val - COUENNE_round (val)) > feas_tolerance_)) {
    3536
    36       Jnlst()->Printf(Ipopt::J_ITERSUMMARY, J_PROBLEM,
     37      Jnlst()->Printf(Ipopt::J_MOREVECTOR, J_PROBLEM,
    3738                      "checkNLP: integrality %d violated: %.6f [%g,%g]\n",
    3839                      i, val, domain_.lb (i), domain_.ub (i));
     
    8586    if (fabs (realobj - obj) / (1. + fabs (realobj)) > feas_tolerance_) {
    8687
    87       Jnlst()->Printf(Ipopt::J_ITERSUMMARY, J_PROBLEM,
     88      Jnlst()->Printf(Ipopt::J_MOREVECTOR, J_PROBLEM,
    8889                      "checkNLP: false objective. %g != %g (diff. %g)\n",
    8990                      realobj, obj, realobj - obj);
     
    110111          (val < domain_.lb (i) - feas_tolerance_)) {
    111112
    112         Jnlst()->Printf(Ipopt::J_ITERSUMMARY, J_PROBLEM,
     113        Jnlst()->Printf(Ipopt::J_MOREVECTOR, J_PROBLEM,
    113114                        "checkNLP: variable %d out of bounds: %.6f [%g,%g] (diff %g)\n",
    114115                        i, val, domain_.lb (i), domain_.ub (i),
     
    123124          (fabs (val - COUENNE_round (val)) > feas_tolerance_)) {
    124125
    125         Jnlst()->Printf(Ipopt::J_ITERSUMMARY, J_PROBLEM,
     126        Jnlst()->Printf(Ipopt::J_MOREVECTOR, J_PROBLEM,
    126127                        "checkNLP: integrality %d violated: %.6f [%g,%g]\n",
    127128                        i, val, domain_.lb (i), domain_.ub (i));
     
    152153                 (*(variables_ [i] -> Image ())) ()) > feas_tolerance_)) {
    153154
    154         Jnlst()->Printf(Ipopt::J_ITERSUMMARY, J_PROBLEM,
     155        Jnlst()->Printf(Ipopt::J_MOREVECTOR, J_PROBLEM,
    155156                        "checkNLP: auxiliarized %d violated (%g)\n", i, delta);
    156157
     
    175176          (body < lhs - feas_tolerance_ * (1 + CoinMax (fabs (body), fabs (lhs))))) {
    176177
    177         if (Jnlst()->ProduceOutput(Ipopt::J_ITERSUMMARY, J_PROBLEM)) {
     178        if (Jnlst()->ProduceOutput(Ipopt::J_MOREVECTOR, J_PROBLEM)) {
    178179
    179180          Jnlst()->Printf
    180             (Ipopt::J_ITERSUMMARY, J_PROBLEM,
     181            (Ipopt::J_MOREVECTOR, J_PROBLEM,
    181182             "checkNLP: constraint %d violated (lhs=%+e body=%+e rhs=%+e, violation %g): ",
    182183             i, lhs, body, rhs, CoinMax (lhs-body, body-rhs));
  • stable/0.2/Couenne/src/problem/constraint.cpp

    r114 r159  
     1/* $Id: constraint.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    constraint.cpp
  • stable/0.2/Couenne/src/problem/depGraph/checkCycles.cpp

    r1 r159  
     1/* $Id: checkCycles.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    checkCycles.cpp
  • stable/0.2/Couenne/src/problem/depGraph/depGraph.cpp

    r114 r159  
     1/* $Id: depGraph.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    depGraph.cpp
  • stable/0.2/Couenne/src/problem/depGraph/depGraph.hpp

    r1 r159  
     1/* $Id: depGraph.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    depGraph.hpp
  • stable/0.2/Couenne/src/problem/fillDependence.cpp

    r39 r159  
    1 /*
     1/* $Id: fillDependence.cpp 157 2009-06-16 20:31:49Z pbelotti $
     2 *
    23 * Name:    fillDependence.cpp
    34 * Author:  Pietro Belotti
     
    3435        && ((*i) -> Image () -> Linearity () > LINEAR)) {  // and nonlinear
    3536
    36       CouenneObject *infeasObj = (*i) -> properObject (this, base, jnlst_);
     37      CouenneObject infeasObj = (*i) -> properObject (this, base, jnlst_);
    3738
    38       if (!infeasObj) // found something that will never be infeasibl
     39      if (!(infeasObj.Reference ())) // found something that will never be infeasible
    3940        continue;
    4041
     
    5859      }
    5960
    60     } else objects_.push_back (new CouenneObject (nullObject));
     61    } else objects_.push_back (nullObject);
    6162    // null object for original and linear auxiliaries
    6263  }
  • stable/0.2/Couenne/src/problem/fillQuadIndices.cpp

    r1 r159  
     1/* $Id: fillQuadIndices.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    fillQuadIndices.cpp
  • stable/0.2/Couenne/src/problem/getIntegerCandidate.cpp

    r112 r159  
     1/* $Id: getIntegerCandidate.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    getIntegerCandidate.cpp
     
    3435
    3536  int
    36     ncols    = nVars (),
    37     retval   = 0;
     37    ncols  = nVars (),
     38    retval = 0;
    3839
    3940  double
     
    127128    }
    128129
     130
     131    const int
     132      N_VARS_HUGE   = 10000,
     133      N_VARS_LARGE  = 1000,
     134      N_VARS_MEDIUM = 100,
     135      N_VARS_SMALL  = 10,
     136      N_VARS_TINY   = 5;
     137
     138    int
     139      ntrials   = 0,
     140      nvars = nVars (),
     141      maxtrials =
     142      (nvars >= N_VARS_HUGE)   ? 0 :
     143      (nvars >= N_VARS_LARGE)  ? 1 :
     144      (nvars >= N_VARS_MEDIUM) ? 2 :
     145      (nvars >= N_VARS_SMALL)  ? 4 :
     146      (nvars >= N_VARS_TINY)   ? 8 : 16;
     147
    129148    for (std::vector <int>::iterator rNum = numberInRank_.begin();
    130149         ++rNum != numberInRank_.end(); rank++)
     
    171190        //CoinCopyN (xFrac, nOrigVars_, xInt);// TODO: re-copy first nOrigVars_ variables into xInt?
    172191
    173         int
    174           remaining = *rNum,
    175           ntrials   = 0,
    176           maxtrials = 3;// rNum / divider;
     192        int remaining = *rNum;
    177193
    178194        do {
  • stable/0.2/Couenne/src/problem/problem.cpp

    r116 r159  
     1/* $Id: problem.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    problem.cpp
     
    2526#include "lqelems.hpp"
    2627
    27 const CouNumber SafeCutoff = COUENNE_EPS;
     28// tricky... smaller values cut the optimum in OS unitTest
     29const CouNumber SafeCutoff = 1e-4;
    2830
    2931/// initialize auxiliary variables from original variables in the
     
    100102
    101103      Jnlst () -> Printf (Ipopt::J_MOREMATRIX, J_PROBLEM,
    102                           " [ --> w_%04d [%10g,%10g] ] vs [%10g %10g]",
     104                          " ( --> w_%04d [%10g,%10g] ) vs [%10g %10g]",
    103105                          ord, l, u, Lb (ord), Ub (ord));
    104106
     
    347349    ("feasibility_bt",
    348350     "Feasibility-based (cheap) bound tightening",
     351     "yes",
     352     "no","",
     353     "yes","");
     354
     355  roptions -> AddStringOption2
     356    ("redcost_bt",
     357     "Reduced cost bound tightening",
    349358     "yes",
    350359     "no","",
     
    403412     "var_obj",  "use one object for each variable",
    404413     "expr_obj", "use one object for each nonlinear expression");
    405 }
     414
     415  roptions -> AddStringOption2
     416    ("delete_redundant",
     417     "Eliminate redundant variables, which appear in the problem as x_k = x_h",
     418     "yes",
     419     "no","Keep redundant variables, making the problem a bit larger",
     420     "yes","Eliminate redundant (the problem will be equivalent, only smaller)");
     421}
  • stable/0.2/Couenne/src/problem/problemIO.cpp

    r71 r159  
     1/* $Id: problemIO.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    problemIO.cpp
  • stable/0.2/Couenne/src/problem/reformulate.cpp

    r103 r159  
     1/* $Id$ */
    12/*
    23 * Name:    reformulate.cpp
  • stable/0.2/Couenne/src/problem/testIntFix.cpp

    r112 r159  
     1/* $Id: testIntFix.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    testIntFix.cpp
  • stable/0.2/Couenne/src/problem/writeAMPL.cpp

    r1 r159  
     1/* $Id: writeAMPL.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    extended.cpp
  • stable/0.2/Couenne/src/problem/writeGAMS.cpp

    r23 r159  
     1/* $Id: writeGAMS.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    writeGAMS.cpp
  • stable/0.2/Couenne/src/readnl/invmap.cpp

    r82 r159  
     1/* $Id: invmap.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    invmap.cpp
  • stable/0.2/Couenne/src/readnl/nl2e.cpp

    r82 r159  
     1/* $Id: nl2e.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    nl2e.cpp
  • stable/0.2/Couenne/src/readnl/readASLfg.cpp

    r1 r159  
     1/* $Id: readASLfg.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    readASLfg.cpp
  • stable/0.2/Couenne/src/readnl/readnl.cpp

    r112 r159  
     1/* $Id: readnl.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    readnl.cpp
  • stable/0.2/Couenne/src/standardize/analyzeSparsity.cpp

    r1 r159  
     1/* $Id: analyzeSparsity.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    analyzeSparsity.cpp
  • stable/0.2/Couenne/src/standardize/auxiliarize.cpp

    r1 r159  
     1/* $Id: auxiliarize.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    auxiliarize.cpp
  • stable/0.2/Couenne/src/standardize/constrStandardize.cpp

    r64 r159  
     1/* $Id: constrStandardize.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    constrStandardize.cpp
  • stable/0.2/Couenne/src/standardize/decomposeTerm.cpp

    r98 r159  
     1/* $Id: decomposeTerm.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    decomposeTerm.cpp
  • stable/0.2/Couenne/src/standardize/elementBreak.cpp

    r1 r159  
     1/* $Id: elementBreak.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    elementBreak.cpp
  • stable/0.2/Couenne/src/standardize/flattenMul.cpp

    r1 r159  
     1/* $Id: flattenMul.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    flattenMul.cpp
  • stable/0.2/Couenne/src/standardize/linStandardize.cpp

    r112 r159  
     1/* $Id: linStandardize.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    linStandardize.cpp
     
    7576  if ((nq==0) && (nl==0))
    7677
    77     ret = new exprClone (addAuxiliary (new exprConst (c0))); // a constant auxiliary? FIX!
     78    ret = new exprConst (c0); // a constant auxiliary?
    7879
    7980  else if ((nq==0) && (fabs (c0) < COUENNE_EPS) && (nl==1)) { // a linear monomial, cx
    8081
    81     if (fabs (*lc - 1) < COUENNE_EPS)
    82       ret    = new exprClone (Var (*li));
    83     else ret = new exprMul (new exprConst (*lc), new exprClone (Var (*li)));
     82    if      (fabs (*lc - 1.) < COUENNE_EPS) ret = new exprClone (Var (*li));
     83    else if (fabs (*lc + 1.) < COUENNE_EPS) ret = new exprOpp (new exprClone (Var (*li)));
     84    else                                    ret = new exprMul (new exprConst (*lc),
     85                                                               new exprClone (Var (*li)));
    8486
    8587  } else if ((nl==0) && (fabs (c0) < COUENNE_EPS) && (nq==1)) {
  • stable/0.2/Couenne/src/standardize/lqelems.hpp

    r1 r159  
     1/* $Id: lqelems.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/**
    23 * Name:    lqelems.hpp
  • stable/0.2/Couenne/src/standardize/splitAux.cpp

    r112 r159  
     1/* $Id: splitAux.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    splitAux.cpp
  • stable/0.2/Couenne/src/standardize/standardize.cpp

    r112 r159  
    11/*
     2 * $Id: standardize.cpp 154 2009-06-16 18:52:53Z pbelotti $
     3 *
    24 * Name:    standardize.cpp
    35 * Author:  Pietro Belotti
     
    7274    expression *img = naux -> Image ();
    7375
     76    // trick to obtain same index as common expression: create exprAux
     77    // with index initVar and replace occurrences with address of
     78    // newly created exprAux through auxiliarize()
     79
    7480    exprAux *newvar = new exprAux (img, initVar, 1 + img -> rank (), exprAux::Unset, &domain_);
    7581    //img -> isInteger () ? exprAux::Integer : exprAux::Continuous);
     
    8591    if (naux) {
    8692      printf ("done: "); fflush (stdout);
    87       naux -> print (); printf ("\n");
     93      naux -> print ();
    8894      printf (" := "); fflush (stdout);
    8995      naux -> Image () -> print (); printf ("\n..."); fflush (stdout);
     
    269275  }
    270276
    271   // Look for auxiliaries of the form w:=x and replace each occurrence of w with x
    272 
    273277  // TODO: resolve duplicate index in exprQuad before restoring this
    274278
    275   //if (0)
    276   for (std::vector <exprVar *>::iterator i = variables_.begin ();
     279  std::string delete_redund;
     280  bonBase_ -> options () -> GetStringValue ("delete_redundant", delete_redund, "couenne.");
     281
     282  if (delete_redund == "yes")
     283
     284    // Look for auxiliaries of the form w:=x and replace each occurrence of w with x
     285    for (std::vector <exprVar *>::iterator i = variables_.begin ();
    277286       i != variables_.end (); ++i)
    278287
  • stable/0.2/Couenne/src/standardize/sumStandardize.cpp

    r91 r159  
     1/* $Id: sumStandardize.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    sumStandardize.cpp
  • stable/0.2/Couenne/src/util/drawCuts.cpp

    r1 r159  
     1/* $Id: drawCuts.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    drawCuts.cpp
  • stable/0.2/Couenne/src/util/funtriplets.hpp

    r1 r159  
     1/* $Id: funtriplets.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    funtriplets.hpp
  • stable/0.2/Couenne/src/util/rootQ.cpp

    r1 r159  
     1/* $Id: rootQ.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    rootQ.cpp
  • stable/0.2/Couenne/src/util/rootQ.hpp

    r1 r159  
     1/* $Id: rootQ.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
    12/*
    23 * Name:    rootQ.hpp
  • stable/0.2/Externals

    r20 r159  
    1 BuildTools https://projects.coin-or.org/svn/BuildTools/trunk
    2 ThirdParty/Blas https://projects.coin-or.org/svn/BuildTools/ThirdParty/Blas/trunk
    3 ThirdParty/Lapack https://projects.coin-or.org/svn/BuildTools/ThirdParty/Lapack/trunk
    4 ThirdParty/HSL https://projects.coin-or.org/svn/BuildTools/ThirdParty/HSL/trunk
    5 ThirdParty/ASL https://projects.coin-or.org/svn/BuildTools/ThirdParty/ASL/trunk
    6 ThirdParty/Mumps https://projects.coin-or.org/svn/BuildTools/ThirdParty/Mumps/trunk
    7 CoinUtils https://projects.coin-or.org/svn/CoinUtils/trunk/CoinUtils
    8 Cbc https://projects.coin-or.org/svn/Cbc/trunk/Cbc
    9 Cgl https://projects.coin-or.org/svn/Cgl/trunk/Cgl
    10 Clp https://projects.coin-or.org/svn/Clp/trunk/Clp
    11 Ipopt https://projects.coin-or.org/svn/Ipopt/trunk/Ipopt
    12 Osi https://projects.coin-or.org/svn/Osi/trunk/Osi
    13 Bonmin https://projects.coin-or.org/svn/Bonmin/trunk/Bonmin
     1BuildTools     https://projects.coin-or.org/svn/BuildTools/stable/0.5
     2CoinUtils      https://projects.coin-or.org/svn/CoinUtils/stable/2.6/CoinUtils
     3ThirdParty/ASL https://projects.coin-or.org/svn/BuildTools/ThirdParty/ASL/stable/1.0
     4ThirdParty/Blas https://projects.coin-or.org/svn/BuildTools/ThirdParty/Blas/stable/1.0
     5ThirdParty/HSL https://projects.coin-or.org/svn/BuildTools/ThirdParty/HSL/stable/1.1
     6ThirdParty/Lapack https://projects.coin-or.org/svn/BuildTools/ThirdParty/Lapack/stable/1.0
     7ThirdParty/Mumps https://projects.coin-or.org/svn/BuildTools/ThirdParty/Mumps/stable/1.1
     8Cbc            https://projects.coin-or.org/svn/Cbc/stable/2.3/Cbc
     9Cgl            https://projects.coin-or.org/svn/Cgl/stable/0.54/Cgl
     10Clp            https://projects.coin-or.org/svn/Clp/stable/1.10/Clp
     11Osi            https://projects.coin-or.org/svn/Osi/stable/0.100/Osi
     12Ipopt          https://projects.coin-or.org/svn/Ipopt/stable/3.6/Ipopt
     13Bonmin         https://projects.coin-or.org/svn/Bonmin/stable/1.1/Bonmin
  • stable/0.2/INSTALL

    r22 r159  
    1515don't need to):
    1616
    17 $ svn co https://projects.coin-or.org/svn/Couenne/trunk Couenne
     17$ svn co https://projects.coin-or.org/svn/Couenne/stable/0.2 Couenne
    1818
    1919This creates a directory Couenne/ and downloads most of the necessary
  • stable/0.2/configure.ac

    r93 r159  
    66# Template by Andreas Waechter
    77
     8# $Id:$
     9
    810#############################################################################
    911#                       Names and other basic things                        #
     
    1214AC_PREREQ(2.59)
    1315
    14 AC_INIT([Couenne],[0.2],[belotti@lehigh.edu])
     16AC_INIT([Couenne],[0.2stable],[belotti@lehigh.edu])
    1517
    1618AC_COPYRIGHT([
Note: See TracChangeset for help on using the changeset viewer.