Changeset 534


Ignore:
Timestamp:
May 7, 2007 1:44:28 PM (12 years ago)
Author:
pbelotti
Message:

moved include files to make them doxygenable. Introduced three-way branching, with fixed intervals for now. Added check for small bound interval within all generateCuts()

Location:
branches/Couenne/Couenne/src
Files:
16 edited
35 moved

Legend:

Unmodified
Added
Removed
  • branches/Couenne/Couenne/src/Makefile.am

    r531 r534  
    105105# Here list all include flags, relative to this "srcdir" directory.  This
    106106# "cygpath" stuff is necessary to compile with native compilers on Windows.
    107 AM_CPPFLAGS = -I`$(CYGPATH_W) $(COUENNESRCDIR)/src/include` \
    108         -I`$(CYGPATH_W) $(COUENNESRCDIR)/src/include/operators` \
     107AM_CPPFLAGS = -I`$(CYGPATH_W) $(COUENNESRCDIR)/src/expression` \
     108        -I`$(CYGPATH_W) $(COUENNESRCDIR)/src/expression/operators` \
    109109        -I`$(CYGPATH_W) $(COUENNESRCDIR)/src/branch` \
     110        -I`$(CYGPATH_W) $(COUENNESRCDIR)/src/util` \
     111        -I`$(CYGPATH_W) $(COUENNESRCDIR)/src/convex` \
     112        -I`$(CYGPATH_W) $(COUENNESRCDIR)/src/problem` \
    110113        -I`$(CYGPATH_W) $(OSISRCDIR)/src` \
    111114        -I`$(CYGPATH_W) $(OSISRCDIR)/src/OsiClp` \
     
    151154        branch/CouenneBranchingObject.hpp \
    152155        branch/CouenneChooseVariable.hpp \
    153         include/operators/exprAbs.h \
    154         include/operators/exprExp.h \
    155         include/operators/exprInv.h \
    156         include/operators/exprMul.h \
    157         include/operators/exprOpp.h \
    158         include/operators/exprBMul.h \
    159         include/operators/exprLog.h \
    160         include/operators/exprDiv.h \
    161         include/operators/exprMin.h \
    162         include/operators/exprBDiv.h \
    163         include/operators/exprSum.h \
    164         include/operators/exprMax.h \
    165         include/operators/exprPow.h \
    166         include/operators/exprSin.h \
    167         include/operators/exprCos.h \
    168         include/operators/exprBSin.h \
    169         include/operators/exprBCos.h \
    170         include/operators/exprSub.h \
    171         include/operators/exprGroup.h \
    172         include/exprConst.h \
    173         include/exprIVar.h \
    174         include/exprVar.h \
    175         include/exprAux.h \
    176         include/exprUnary.h \
    177         include/expression.h \
    178         include/exprClone.h \
    179         include/exprBound.h \
    180         include/exprCopy.h \
    181         include/exprOp.h \
    182         include/CouennePrecisions.h \
    183         include/CouenneProblemElem.h \
    184         include/CouenneProblem.h \
    185         include/CouenneTypes.h \
    186         include/rootQ.h \
    187         include/CouenneCutGenerator.h
     156        expression/operators/exprAbs.h \
     157        expression/operators/exprExp.h \
     158        expression/operators/exprInv.h \
     159        expression/operators/exprMul.h \
     160        expression/operators/exprOpp.h \
     161        expression/operators/exprBMul.h \
     162        expression/operators/exprLog.h \
     163        expression/operators/exprDiv.h \
     164        expression/operators/exprMin.h \
     165        expression/operators/exprBDiv.h \
     166        expression/operators/exprSum.h \
     167        expression/operators/exprMax.h \
     168        expression/operators/exprPow.h \
     169        expression/operators/exprSin.h \
     170        expression/operators/exprCos.h \
     171        expression/operators/exprBSin.h \
     172        expression/operators/exprBCos.h \
     173        expression/operators/exprSub.h \
     174        expression/operators/exprGroup.h \
     175        expression/exprConst.h \
     176        expression/exprIVar.h \
     177        expression/exprVar.h \
     178        expression/exprAux.h \
     179        expression/exprUnary.h \
     180        expression/expression.h \
     181        expression/exprClone.h \
     182        expression/exprBound.h \
     183        expression/exprCopy.h \
     184        expression/exprOp.h \
     185        expression/CouennePrecisions.h \
     186        problem/CouenneProblemElem.h \
     187        problem/CouenneProblem.h \
     188        expression/CouenneTypes.h \
     189        util/rootQ.h \
     190        convex/CouenneCutGenerator.h
    188191
    189192#############################################################################
  • branches/Couenne/Couenne/src/Makefile.in

    r531 r534  
    413413# Here list all include flags, relative to this "srcdir" directory.  This
    414414# "cygpath" stuff is necessary to compile with native compilers on Windows.
    415 AM_CPPFLAGS = -I`$(CYGPATH_W) $(COUENNESRCDIR)/src/include` \
    416         -I`$(CYGPATH_W) $(COUENNESRCDIR)/src/include/operators` \
     415AM_CPPFLAGS = -I`$(CYGPATH_W) $(COUENNESRCDIR)/src/expression` \
     416        -I`$(CYGPATH_W) $(COUENNESRCDIR)/src/expression/operators` \
    417417        -I`$(CYGPATH_W) $(COUENNESRCDIR)/src/branch` -I`$(CYGPATH_W) \
     418        $(COUENNESRCDIR)/src/util` -I`$(CYGPATH_W) \
     419        $(COUENNESRCDIR)/src/convex` -I`$(CYGPATH_W) \
     420        $(COUENNESRCDIR)/src/problem` -I`$(CYGPATH_W) \
    418421        $(OSISRCDIR)/src` -I`$(CYGPATH_W) $(OSISRCDIR)/src/OsiClp` \
    419422        -I`$(CYGPATH_W) $(OSIOBJDIR)/inc` -I`$(CYGPATH_W) \
     
    449452        branch/CouenneBranchingObject.hpp \
    450453        branch/CouenneChooseVariable.hpp \
    451         include/operators/exprAbs.h \
    452         include/operators/exprExp.h \
    453         include/operators/exprInv.h \
    454         include/operators/exprMul.h \
    455         include/operators/exprOpp.h \
    456         include/operators/exprBMul.h \
    457         include/operators/exprLog.h \
    458         include/operators/exprDiv.h \
    459         include/operators/exprMin.h \
    460         include/operators/exprBDiv.h \
    461         include/operators/exprSum.h \
    462         include/operators/exprMax.h \
    463         include/operators/exprPow.h \
    464         include/operators/exprSin.h \
    465         include/operators/exprCos.h \
    466         include/operators/exprBSin.h \
    467         include/operators/exprBCos.h \
    468         include/operators/exprSub.h \
    469         include/operators/exprGroup.h \
    470         include/exprConst.h \
    471         include/exprIVar.h \
    472         include/exprVar.h \
    473         include/exprAux.h \
    474         include/exprUnary.h \
    475         include/expression.h \
    476         include/exprClone.h \
    477         include/exprBound.h \
    478         include/exprCopy.h \
    479         include/exprOp.h \
    480         include/CouennePrecisions.h \
    481         include/CouenneProblemElem.h \
    482         include/CouenneProblem.h \
    483         include/CouenneTypes.h \
    484         include/rootQ.h \
    485         include/CouenneCutGenerator.h
     454        expression/operators/exprAbs.h \
     455        expression/operators/exprExp.h \
     456        expression/operators/exprInv.h \
     457        expression/operators/exprMul.h \
     458        expression/operators/exprOpp.h \
     459        expression/operators/exprBMul.h \
     460        expression/operators/exprLog.h \
     461        expression/operators/exprDiv.h \
     462        expression/operators/exprMin.h \
     463        expression/operators/exprBDiv.h \
     464        expression/operators/exprSum.h \
     465        expression/operators/exprMax.h \
     466        expression/operators/exprPow.h \
     467        expression/operators/exprSin.h \
     468        expression/operators/exprCos.h \
     469        expression/operators/exprBSin.h \
     470        expression/operators/exprBCos.h \
     471        expression/operators/exprSub.h \
     472        expression/operators/exprGroup.h \
     473        expression/exprConst.h \
     474        expression/exprIVar.h \
     475        expression/exprVar.h \
     476        expression/exprAux.h \
     477        expression/exprUnary.h \
     478        expression/expression.h \
     479        expression/exprClone.h \
     480        expression/exprBound.h \
     481        expression/exprCopy.h \
     482        expression/exprOp.h \
     483        expression/CouennePrecisions.h \
     484        problem/CouenneProblemElem.h \
     485        problem/CouenneProblem.h \
     486        expression/CouenneTypes.h \
     487        util/rootQ.h \
     488        convex/CouenneCutGenerator.h
    486489
    487490
     
    12001203
    12011204distdir: $(DISTFILES)
    1202         $(mkdir_p) $(distdir)/../inc $(distdir)/branch $(distdir)/include $(distdir)/include/operators
     1205        $(mkdir_p) $(distdir)/../inc $(distdir)/branch $(distdir)/convex $(distdir)/expression $(distdir)/expression/operators $(distdir)/problem $(distdir)/util
    12031206        @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
    12041207        topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
  • branches/Couenne/Couenne/src/branch/CouenneBranchingObject.cpp

    r531 r534  
    1010#include <CouenneBranchingObject.hpp>
    1111
    12 
    1312/// make branching point $\alpha$ away from current point:
    1413/// bp = alpha * current + (1-alpha) * midpoint
    1514
    16 CouNumber CouenneBranchingObject::alpha_ = 0.5;
     15CouNumber CouenneBranchingObject::alpha_ = 0.25;
    1716
    1817
     
    3029  int index = reference_ -> Index ();
    3130
     31  if (index < 0)
     32    printf ("Couenne: Warning, CouenneBranchingObject has negative reference's index\n");
     33
    3234  long double
    3335    x = expression::Variable (index),   // current solution
     
    3941  else if (x>u) x = u;
    4042
    41   if ((x > l + COUENNE_EPS) &&
    42       (x < u - COUENNE_EPS))      // x is not at the boundary
     43  // This two-way branching rule is only applied when both lower and
     44  // upper bound are finite. Otherwise, a CouenneThreeWayBranchObj is
     45  // used (see CouenneThreeWayBranchObj.hpp).
     46  //
     47  // The rule is as follows:
     48  //
     49  // - if x is well inside the interval (both bounds are infinite or
     50  // there is a difference of at least COU_NEAR_BOUND), set
     51  // value_ to x;
     52  //
     53  // - otherwise, try to get far from bounds by setting value_ to a
     54  // convex combination of current and midpoint
     55  //
     56  // TODO: consider branching value that maximizes distance from
     57  // current point (how?)
     58
     59  if (fabs (u-l) < COUENNE_EPS)
     60    printf ("Warning, interval is really tiny\n");
     61
     62  if ((x-l < COUENNE_NEAR_BOUND) ||
     63      (u-x < COUENNE_NEAR_BOUND))
     64    value_ = alpha * x + (1. - alpha) * (l + u) / 2.;
     65  else value_ = x;
     66
     67  /*
     68  if ((x > l + COUENNE_NEAR_BOUND) &&
     69      (x < u - COUENNE_NEAR_BOUND))      // x is not at the boundary
    4370    value_ = x;
    44 
    4571  else // current point is at one of the bounds
    46     if ((l > - COUENNE_INFINITY + 1) &&
    47         (u <   COUENNE_INFINITY - 1))
     72    if ((l > - COUENNE_INFINITY) &&
     73        (u <   COUENNE_INFINITY))
    4874      // finite bounds, apply midpoint rule
    4975      value_ = alpha * x + (1. - alpha) * (l + u) / 2.;
     
    5581      if (fabs (x-l) < COUENNE_EPS) value_ = l + (1+fabs (l)) / 2.;
    5682      else                          value_ = u - (1+fabs (u)) / 2.;
     83  */
    5784
    5885  if (0) {
     
    6693  }
    6794}
     95
    6896
    6997/** \brief Execute the actions required to branch, as specified by the
     
    80108  int way = (!branchIndex_) ? firstBranch_ : !firstBranch_,
    81109      ind = reference_ -> Index ();
     110
    82111  CouNumber l = solver -> getColLower () [ind],
    83112            u = solver -> getColUpper () [ind];
  • branches/Couenne/Couenne/src/branch/CouenneBranchingObject.hpp

    r531 r534  
    1414#include <OsiBranchingObject.hpp>
    1515#include <exprAux.h>
     16
     17#define COUENNE_CROP 1
     18#define COUENNE_LCROP (1e2*COUENNE_CROP)
     19
     20#define COUENNE_LARGE_INTERVAL 1e4
     21#define COUENNE_NEAR_BOUND 1e-2
    1622
    1723
     
    3238  /// Copy constructor
    3339  CouenneBranchingObject (const CouenneBranchingObject &src):
     40    OsiTwoWayBranchingObject (src),
    3441    reference_ (src.reference_) {}
    3542
     
    4956  /// The variable this branching object refers to. If the
    5057  /// corresponding CouenneObject was created on w=f(x,y), it is
    51   /// either x or y.
     58  /// either x or y, chosen previously with a call to getFixVar()
    5259  expression *reference_;
    5360
  • branches/Couenne/Couenne/src/branch/CouenneObject.cpp

    r531 r534  
    1111#include <exprGroup.h>
    1212#include <CouenneBranchingObject.hpp>
     13#include <CouenneThreeWayBranchObj.hpp>
    1314
    1415#define WEI_INF   1.
     
    122123    index = expr -> Argument () -> Index ();
    123124
    124     if (index > -1) {
     125    if (index >= 0) {
    125126
    126127      val = info -> solution_ [index];
     
    140141        index = args [i] -> Index();
    141142
    142         if (index > -1) {
     143        if (index >= 0) {
    143144
    144145          val = info -> solution_ [index];
     
    154155
    155156    exprGroup *e = dynamic_cast <exprGroup *> (expr);
    156     int *indices = e -> getIndices (), index;
     157    int *indices = e -> getIndices ();
    157158
    158159    for (; *indices >= 0; indices++) {
     
    188189                      const_cast <CouNumber *> (info -> upper_));
    189190
     191  OsiBranchingObject *opobj = reference_ -> BranchObject ();
     192
     193  if (opobj)
     194    return opobj;
     195
    190196  expression *depvar = reference_ -> Image () -> getFixVar ();
    191197  int index;
    192198
    193   if (depvar && (index = depvar -> Index ())>= 0) {
     199  // Create a two- or three-way branching object according to
     200  // finiteness of the intervals. For now only check if argument
     201  // bounds are finite.
     202
     203  // TODO: check if function is finite within the interval (if so,
     204  // two-way, if not, three-way). Could be operator-dependent, that
     205  // is,
     206  //
     207  // return reference_ -> BranchObject ();
     208
     209  if (depvar && ((index = depvar -> Index ()) >= 0)) {
    194210
    195211    int ref_ind = reference_ -> Index ();
     
    198214              l  = info -> lower_    [index],
    199215              u  = info -> upper_    [index],
     216
    200217              xr = info -> solution_ [ref_ind],
    201218              lr = info -> lower_    [ref_ind],
    202219              ur = info -> upper_    [ref_ind];
    203 
    204     if ((fabs (x-l) > COUENNE_EPS) &&
    205         (fabs (u-x) > COUENNE_EPS) &&
    206         (fabs (u-l) > COUENNE_EPS)
     220    /*
     221    if (((x-l > COUENNE_LARGE_INTERVAL) &&
     222         (u-x > COUENNE_LARGE_INTERVAL))
     223        ||
     224        (((x-l > COUENNE_LARGE_INTERVAL) ||
     225          (u-x > COUENNE_LARGE_INTERVAL)) &&
     226         ((x-l < COUENNE_NEAR_BOUND) ||
     227          (u-x < COUENNE_NEAR_BOUND))))
     228      return new CouenneThreeWayBranchObj (depvar, x, l, u);
     229    */
     230    if (((fabs (x-l) > COUENNE_EPS) &&
     231         (fabs (u-x) > COUENNE_EPS) &&
     232         (fabs (u-l) > COUENNE_EPS))
    207233        || (fabs (xr-lr) < COUENNE_EPS)
    208234        || (fabs (ur-xr) < COUENNE_EPS)
  • branches/Couenne/Couenne/src/branch/CouenneObject.hpp

    r531 r534  
    4343  virtual double infeasibility (const OsiBranchingInformation*, int &) const;
    4444
    45   /// fix (one of the) argument of reference auxiliary variable
     45  /// fix (one of the) arguments of reference auxiliary variable
    4646  virtual double feasibleRegion (OsiSolverInterface*, const OsiBranchingInformation*) const;
    4747
    48   /// create CouenneBranchingObject based on this object
     48  /// create CouenneBranchingObject or CouenneThreeWayBranchObj based
     49  /// on this object
    4950  virtual OsiBranchingObject* createBranch (OsiSolverInterface*,
    5051                                            const OsiBranchingInformation*, int) const;
    5152
    5253  /// return reference auxiliary variable
    53   exprAux *Reference () 
     54  exprAux *Reference ()
    5455  {return reference_;}
    5556
  • branches/Couenne/Couenne/src/branch/CouenneThreeWayBranchObj.cpp

    r531 r534  
    77 */
    88
     9#include <CouenneBranchingObject.hpp>
    910#include <CouenneThreeWayBranchObj.hpp>
    10 
    11 
    12 //CouNumber CouenneThreeWayBranchObj::lcrop_ = 0.8;
    13 //CouNumber CouenneThreeWayBranchObj::rcrop_ = 0.8;
    1411
    1512
     
    1815*/
    1916
    20 CouenneThreeWayBranchObj::CouenneThreeWayBranchObj (expression *var):
     17CouenneThreeWayBranchObj::CouenneThreeWayBranchObj (expression *var,
     18                                                    CouNumber x,
     19                                                    CouNumber l,
     20                                                    CouNumber u):
     21  reference_      (var) {
    2122
    22   reference_ (var) {
     23  value_          = x;
     24  numberBranches_ = 3;
    2325
    24   // set the branching value at the current point
    25   //  value_ = expression::Variable (reference_ -> Index ());
     26  // Depending on where x, l, and u are, divide bound interval into
     27  // three and set lcrop_ and rcrop_ accordingly.
    2628
    27   int index = reference_ -> Index ();
     29  // if l and u are unbounded, crop around x using COUENNE_CROP
    2830
    29   long double
    30     x = expression::Variable (index),   // current solution
    31     l = expression::Lbound   (index),   //         lower bound
    32     u = expression::Ubound   (index),   //         upper
    33     alpha = 0;//CouenneBranchingObject::Alpha ();
    34 
    35   if      (x<l) x = l;
    36   else if (x>u) x = u;
    37 
    38   if ((x > l + COUENNE_EPS) &&
    39       (x < u - COUENNE_EPS))      // x is not at the boundary
    40     value_ = x;
    41 
    42   else // current point is at one of the bounds
    43     if ((l > - COUENNE_INFINITY + 1) &&
    44         (u <   COUENNE_INFINITY - 1))
    45       // finite bounds, apply midpoint rule
    46       value_ = alpha * x + (1. - alpha) * (l + u) / 2.;
    47 
     31  if ((x-l > COUENNE_LARGE_INTERVAL) &&
     32      (u-x > COUENNE_LARGE_INTERVAL)) {
     33    lcrop_ = x - COUENNE_CROP;
     34    rcrop_ = x + COUENNE_CROP;
     35    first_ = 1;
     36  }
     37  else
     38    if ((x-l > COUENNE_LARGE_INTERVAL) &&
     39        (u-x < COUENNE_NEAR_BOUND)) {
     40      lcrop_ = x - COUENNE_CROP;
     41      rcrop_ = x - COUENNE_LCROP;
     42      first_ = 2;
     43    }
    4844    else
    49       // infinite (one direction) bound interval, x is at the boundary
    50       // push it inwards
    51       // TODO: look for a proper displacement
    52       if (fabs (x-l) < COUENNE_EPS) value_ = l + (1+fabs (l)) / 2.;
    53       else                          value_ = u - (1+fabs (u)) / 2.;
    54 
    55   if (0) {
    56     printf ("Branch::constructor: ");
    57     reference_ -> print (std::cout);
    58     printf (" on %.6e (%.6e) [%.6e,%.6e]\n",
    59             value_,
    60             expression::Variable (reference_ -> Index ()),
    61             expression::Lbound   (reference_ -> Index ()),
    62             expression::Ubound   (reference_ -> Index ()));
    63   }
     45      if ((x-l < COUENNE_NEAR_BOUND) &&
     46          (u-x > COUENNE_LARGE_INTERVAL)) {
     47        lcrop_ = x + COUENNE_CROP;
     48        rcrop_ = x + COUENNE_LCROP;
     49        first_ = 0;
     50      }
    6451}
    6552
     
    7764  //        1 if ">= b"  node
    7865
    79   int way = branchIndex_ - 1,
    80       ind = reference_ -> Index ();
     66  int way, ind = reference_ -> Index ();
    8167
    82   /*CouNumber l = solver -> getColLower () [ind],
    83             u = solver -> getColUpper () [ind];
     68  switch (branchIndex_) {
     69  case 0:
     70    way = first_;   // if first offspring, let first_ decide who's first
     71    break;
     72  case 1:
     73    way = (first_ == 0) ? 1 : 0;
     74    break;
     75  case 2:
     76    way = (first_ == 2) ? 1 : 2;
     77    break;
     78  default:
     79    printf ("Warning, branchIndex_ has a strange value (%d)\n", branchIndex_);
     80  }
    8481
    85   if (way) {
    86     if      (value_ < l)             printf ("Nonsense up-branch: [ %f ,(%f)] -> [%f\n", l,u,value_);
    87     else if (value_ < l+COUENNE_EPS) printf ("## WEAK  up-branch: [ %f ,(%f)] -> [%f\n", l,u,value_);
    88   } else {
    89     if      (value_ > u)             printf ("Nonsense dn-branch: [(%f), %f ] -> %f]\n", l,u,value_);
    90     else if (value_ > u+COUENNE_EPS) printf ("## WEAK  dn-branch: [(%f), %f ] -> %f]\n", l,u,value_);
    91   }
    92   */
     82  way --; // from {0,1,2} to {-1,0,1}
    9383
    9484  // set lower or upper bound (round if this variable is integer)
     
    9989
    10090  case -1: // left interval
     91    //    printf ("Left branch: x%d <= %.3f\n", ind, lcrop_);
    10192    solver -> setColUpper (ind, intvar ? floor (lcrop_) : lcrop_);
    10293    break;
    10394  case  0: // central interval
     95    //    printf ("Central branch: %.3f <= x%d <= %.3f\n", lcrop_, ind, rcrop_);
    10496    solver -> setColLower (ind, intvar ? ceil  (lcrop_) : lcrop_);
    10597    solver -> setColUpper (ind, intvar ? floor (rcrop_) : rcrop_);
    10698    break;
    10799  case  1: // right interval
     100    //    printf ("Right branch: x%d >= %.3f\n", ind, rcrop_);
    108101    solver -> setColLower (ind, intvar ? ceil  (rcrop_) : rcrop_);
    109102    break;
  • branches/Couenne/Couenne/src/branch/CouenneThreeWayBranchObj.hpp

    r531 r534  
    1616
    1717
    18 /// Spatial, Three-way Branching object. Branching is performed on
     18/// Spatial, three-way branching object. Branching is performed on
    1919/// continuous variables but a better convexification is sought around
    2020/// the current point by dividing the interval in three parts
     
    2525
    2626  /// Constructor
    27   CouenneThreeWayBranchObj (expression * = NULL);
     27  CouenneThreeWayBranchObj (expression *, CouNumber, CouNumber, CouNumber);
    2828
    2929  /// Copy constructor
    3030  CouenneThreeWayBranchObj (const CouenneThreeWayBranchObj &src):
     31    OsiBranchingObject (src),
    3132    reference_ (src.reference_),
    3233    lcrop_     (src.lcrop_),
     
    3435
    3536  /// Cloning method
    36   virtual OsiBranchingObject * clone() const
     37  virtual OsiBranchingObject * clone () const
    3738  {return new CouenneThreeWayBranchObj (*this);}
    3839
     
    4041             current state of the branching object, and advance the object's
    4142             state.
    42              Returns change in guessed objective on next branch
     43             Returns change in guessed objective on next (what does
     44             "next" mean here?) branch
    4345  */
    4446  virtual double branch (OsiSolverInterface * solver = NULL);
     
    5456  CouNumber lcrop_;
    5557  CouNumber rcrop_;
     58
     59  /// first branch to be performed: 0 is left, 1 is central, 2 is right
     60  int first_;
    5661};
    5762
  • branches/Couenne/Couenne/src/convex/CouenneCutGenerator.h

    r531 r534  
    117117
    118118  /// create cut and check violation. Insert and return status
    119   int createCut (OsiCuts &, // cutset to insert
    120                  CouNumber, // rhs
    121                  int,       // sign: -1: <=, 0: =, +1: >=
    122                                        // index, coeff  (index -1: "don't care")
    123                  int,    CouNumber,    // of first  term
    124                  int=-1, CouNumber=0., // of second term
    125                  int=-1, CouNumber=0., // of third  term
    126                  bool = false) const;  // is it a global cut? No, by default
     119  int createCut (OsiCuts &, /// cutset to insert
     120                 CouNumber, /// rhs
     121                 int,       /// sign: -1: <=, 0: =, +1: >=
     122                            /// index, coeff  (index -1: "don't care")
     123                 int,    CouNumber,    /// of first  term
     124                 int=-1, CouNumber=0., /// of second term
     125                 int=-1, CouNumber=0., /// of third  term
     126                 bool = false) const;  /// is it a global cut? No, by default
    127127
    128128  /// add general linear envelope to convex function, given its
  • branches/Couenne/Couenne/src/convex/addEnvelope.cpp

    r520 r534  
    2323
    2424  // TODO: remove check of !firstcall_ if point is available already
     25
     26  // if bounds are very close, convexify with a single line
     27
     28  if (fabs (u - l) < COUENNE_EPS) {
     29
     30    CouNumber x0 = 0.5 * (u+l), fp0 = fprime (x0);
     31    createCut (cs, f(x0) - fp0 * x0, 0, w_ind, 1., x_ind, - fp0);
     32    return;
     33  }
    2534
    2635  // Add tangent in any case
  • branches/Couenne/Couenne/src/convex/operators/conv-exprAbs.cpp

    r497 r534  
    4343    }
    4444
    45     // otherwise check if at most one of the bounds is infinite:
    46     // even so so, we can still add a plane, whose slope will be 1
    47     // (if x is unbounded from above) or -1 (from below)
     45    // otherwise check if at most one of the bounds is infinite: even
     46    // so, we can still add a plane, whose slope will be 1 (if x is
     47    // unbounded from above) or -1 (from below)
    4848
    49     if (l > - COUENNE_INFINITY + 1) {
     49    if (l > - COUENNE_INFINITY) {
    5050
    51       if (u < COUENNE_INFINITY - 1) { // the upper approximation has slope other than -1, 1
     51      if (u < COUENNE_INFINITY) { // the upper approximation has slope other than -1, 1
    5252
    5353          CouNumber slope = (u+l) / (u-l);
     
    5858          cg -> createCut (cs, -2*l, -1, w_ind, 1., x_ind, -1.);
    5959      }
    60       else if (u < COUENNE_INFINITY - 1) // slope = -1
     60      else if (u < COUENNE_INFINITY) // slope = -1
    6161        cg -> createCut (cs, 2*u, -1, w_ind, 1., x_ind, 1.);
    6262    }
  • branches/Couenne/Couenne/src/convex/operators/conv-exprDiv.cpp

    r480 r534  
    2828                            OsiCuts &cs, const CouenneCutGenerator *cg) {
    2929
     30
    3031  // TODO: Use method on Tawarmalani-Sahinidis //////////////////////////////
    3132
    32   // get bounds of numerator and denominator
     33  // compute y bounds
    3334
    34   expression *yle, *yue;
    35 
    36   arglist_ [1] -> getBounds (yle, yue);
     35  expression *yle, *yue, *ye = arglist_ [1];
     36  ye -> getBounds (yle, yue);
    3737
    3838  CouNumber yl = (*yle) (),
    39             yu = (*yue) ();
     39            yu = (*yue) (), k;
     40
     41  delete yle; delete yue;
     42
     43  int xi = arglist_ [0] -> Index (),
     44      wi = w  -> Index (),
     45      yi = ye -> Index ();
    4046
    4147  // if the denominator's bound interval has 0 as internal point,
    4248  // there is no convexification
    4349
    44   if ((yl < - COUENNE_EPS) &&
    45       (yu >   COUENNE_EPS))
     50  if ((yl < -0) && (yu >  0))
    4651    return;
    4752
    48   expression *xle, *xue, *wle, *wue;
     53  // special case #1: y is almost constant (nonzero) --> y = k. We
     54  // only need a single plane w = x/k.
    4955
    50   arglist_ [0] -> getBounds (xle, xue);
    51   w            -> getBounds (wle, wue);
     56  if ((fabs (yl-yu) < COUENNE_EPS) && ((k = fabs (yl+yu) / 2) > COUENNE_EPS)) {
     57    cg -> createCut (cs, 0., 0, wi, -1, xi, 1/k);
     58    return;
     59  }
    5260
    53   expression *xe = arglist_ [0];
    54   expression *ye = arglist_ [1];
     61  // compute w bounds
    5562
    56   CouNumber wl = (*wle) (), wu = (*wue) ();
     63  expression *wle, *wue;
     64  w -> getBounds (wle, wue);
    5765
    58   delete yle; delete yue;
     66  CouNumber wl = (*wle) (),
     67            wu = (*wue) ();
     68
    5969  delete wle; delete wue;
    60   delete xle; delete xue;
     70
     71  // special case #2: w is almost constant (nonzero) --> w = x/y = k. We
     72  // only need a single plane x = y*k.
     73
     74  if ((fabs (wl-wu) < COUENNE_EPS) && ((k = fabs (wl+wu) / 2) > COUENNE_EPS)) {
     75    cg -> createCut (cs, 0., 0, yi, k, xi, -1.);
     76    return;
     77  }
    6178
    6279  // Add McCormick convexification cuts. Reduce w = x/y to x = wy and
     
    6986  // 4) x <= yu w + wl y - yu wl
    7087
    71   int xi = xe -> Index (),
    72       wi = w  -> Index (),
    73       yi = ye -> Index ();
    74 
    7588  if (is_boundbox_regular (yl, wl)) cg -> createCut (cs, yl*wl, -1, xi, -1., wi, yl, yi, wl);
    7689  if (is_boundbox_regular (yu, wu)) cg -> createCut (cs, yu*wu, -1, xi, -1., wi, yu, yi, wu);
  • branches/Couenne/Couenne/src/convex/operators/conv-exprExp.cpp

    r525 r534  
    2525  argument_ -> getBounds (le, ue);
    2626
    27   CouNumber x = (cg -> isFirst ()) ?
    28                  0 : powNewton ((*argument_) (), (*aux) (), exp, exp, exp),
    29             l = (*le) (),
     27  CouNumber l = (*le) (),
    3028            u = (*ue) ();
    3129
    3230  int w_ind = aux       -> Index (),
    3331      x_ind = argument_ -> Index ();
     32
     33  // if bounds are very close, convexify with a single line
     34
     35  if (fabs (u - l) < COUENNE_EPS) {
     36
     37    CouNumber x0 = 0.5 * (u+l), ex0 = exp (x0);
     38    cg -> createCut (cs, ex0 * (1 - x0), 0, w_ind, 1., x_ind, - ex0);
     39    return;
     40  }
     41
     42  CouNumber x = (cg -> isFirst ()) ?
     43                 0 : powNewton ((*argument_) (), (*aux) (), exp, exp, exp);
    3444
    3545  // upper segment
  • branches/Couenne/Couenne/src/convex/operators/conv-exprInv.cpp

    r520 r534  
    7878      x_ind = argument_ -> Index ();
    7979
     80  // special case: l and u are very close, replace function with
     81  // linear term
     82
     83  if (fabs (u - l) < COUENNE_EPS) {
     84
     85    CouNumber x0 = 0.5 * (u+l);
     86    cg -> createCut (cs, 2/x0, 0, w_ind, 1., x_ind, 1/(x0*x0));
     87    return;
     88  }
     89
    8090  // choose sampling points. If unbounded, bound using a rule of thumb
    8191
    8292  int ns = cg -> nSamples ();
    8393
    84   if      (l < - COUENNE_INFINITY + 1) l = ns * (u-1); // (-infinity, u] where u < 0
    85   else if (u >   COUENNE_INFINITY - 1) u = ns * (l+1); // [l, +infinity) where l > 0
     94  if      (l < - COUENNE_INFINITY) l = ns * (u-1); // (-infinity, u] where u < 0
     95  else if (u >   COUENNE_INFINITY) u = ns * (l+1); // [l, +infinity) where l > 0
    8696
    8797  // make bounds nonzero
  • branches/Couenne/Couenne/src/convex/operators/conv-exprLog.cpp

    r525 r534  
    2929  argument_ -> getBounds (le, ue);
    3030
    31   CouNumber x = (cg -> isFirst ()) ?
    32                  1 : powNewton ((*argument_) (), (*aux) (), log, inv, oppInvSqr),
    33             l = (*le) (),
     31  CouNumber l = (*le) (),
    3432            u = (*ue) ();
    3533
    3634  int w_ind = aux       -> Index ();
    3735  int x_ind = argument_ -> Index ();
     36
     37  // if bounds are very close, convexify with a single line
     38
     39  if ((fabs (u - l) < COUENNE_EPS) && (l > COUENNE_EPS)) {
     40
     41    CouNumber x0 = 0.5 * (u+l);
     42    cg -> createCut (cs, log (x0) - 1, 0,
     43                     w_ind, 1., x_ind, - 1/x0);
     44    return;
     45  }
     46
     47  CouNumber x = (cg -> isFirst ()) ?
     48                 1 : powNewton ((*argument_) (), (*aux) (), log, inv, oppInvSqr);
    3849
    3950  // fix lower bound
  • branches/Couenne/Couenne/src/convex/operators/conv-exprSinCos.cpp

    r531 r534  
    6565  int x_ind = arg -> Index ();
    6666  int w_ind = aux -> Index ();
    67 
     67  /*
     68  if (fabs (ub - lb) < COUENNE_EPS) {
     69
     70    CouNumber x0 = 0.5 * (ub+lb), f, fp;
     71
     72    if (which_trig == COU_SINE) {f = sin (x0); fp =  cos (x0);}
     73    else                        {f = cos (x0); fp = -sin (x0);}
     74
     75    cg -> createCut (cs, f - fp*x0, 0, w_ind, 1., x_ind, -fp);
     76    return;
     77  }
     78  */
    6879  // add the lower envelope
    6980  cg -> createCut (cs, f (lb) - lb, -1, w_ind, 1., x_ind, -1.); // left:  w - x <= f lb - lb
     
    111122  int xi = arg -> Index (),
    112123      wi = w   -> Index ();
     124
     125  if (fabs (ub - lb) < COUENNE_EPS) {
     126
     127    CouNumber x0 = 0.5 * (ub+lb), f, fp;
     128
     129    if (which_trig == COU_SINE) {f = sin (x0); fp =  cos (x0);}
     130    else                        {f = cos (x0); fp = -sin (x0);}
     131
     132    cg -> createCut (cs, f - fp*x0, 0, wi, 1., xi, -fp);
     133    return;
     134  }
    113135
    114136  // true if, in the first call (lb), a lower/upper chord was added
  • branches/Couenne/Couenne/src/convex/operators/powNewton.cpp

    r506 r534  
    1010#include <CouenneTypes.h>
    1111
    12 #define MAX_ITER 1000
     12#define MAX_ITER 100
    1313#define COU_POW_TOLERANCE 1e-12
    1414
  • branches/Couenne/Couenne/src/expression/CouennePrecisions.h

    r530 r534  
    77 */
    88
    9 #ifndef COUENNE_PRECISION_H
    10 #define COUENNE_PRECISION_H
     9#ifndef COUENNE_PRECISIONS_H
     10#define COUENNE_PRECISIONS_H
    1111
    1212#include <CouenneTypes.h>
    1313#include <math.h>
    1414
    15 /* keep it at least 1e-7 or strange things happen */
     15/* keep it at least 1e-7, or strange things happen */
    1616#define COUENNE_EPS       1e-7
     17#define COUENNE_EPS_CHK       1e-7
     18#define COUENNE_EPS_SET       1e-15
     19
    1720#define COUENNE_EPS_SIMPL 1e-20
     21
    1822#define COUENNE_INFINITY  1e+50
     23#define COUENNE_INFINITY_CHK  1e+30
     24#define COUENNE_INFINITY_SET  1e+60
     25
    1926#define COU_MAX_COEFF     1e6
    2027
    21 #define COUENNE_round(x) ((int) (floor ((x)+0.5)))
     28#define COUENNE_round(x) ((int) (floor ((x) + 0.5)))
    2229
    2330#endif
  • branches/Couenne/Couenne/src/expression/exprAux.h

    r530 r534  
    2020
    2121
    22 // expression base class
     22/// expression base class
    2323
    2424class exprAux: public exprVar {
     
    4646 public:
    4747
    48   // Node type
     48  /// Node type
    4949  inline enum nodeType Type ()
    5050    {return AUX;}
    5151
    52   // Constructor
     52  /// Constructor
    5353  exprAux (expression *, int, int);
    5454
    55   // Destructor
     55  /// Destructor
    5656  ~exprAux () {
    5757    delete image_;
     
    6060  }
    6161
    62   // copy constructor
     62  /// copy constructor
    6363  exprAux (const exprAux &e):
    6464    exprVar       (e.varIndex_),
     
    7070
    7171    image_ -> getBounds (lb_, ub_);
    72     //getBounds (lb_, ub_);
     72    // getBounds (lb_, ub_);
    7373
    7474    lb_ = new exprMax (lb_, new exprLowerBound (varIndex_));
     
    7676  }
    7777
    78   // cloning method
     78  /// cloning method
    7979  virtual exprAux *clone () const
    8080    {return new exprAux (*this);}
    8181
    82   // Bound get
     82  /// Bound get
    8383  expression *Lb () {return lb_;}
    8484  expression *Ub () {return ub_;}
    8585
    86   // I/O
     86  /// I/O
    8787  void print (std::ostream &out) const
    8888    {out << "w_" << varIndex_;}
    8989
    90   // The expression associated with this auxiliary variable
     90  /// The expression associated with this auxiliary variable
    9191  inline expression *Image () const
    9292    {return image_;}
    9393
    94   // Null function for evaluating the expression
     94  /// Null function for evaluating the expression
    9595  inline CouNumber operator () ()
    9696    {return (currValue_ = expression::Variable (varIndex_));}
    9797
    98   // Differentiation
     98  /// Differentiation
    9999  inline expression *differentiate (int index)
    100100    {return image_ -> differentiate (index);}
    101101
    102   // Dependence on variable set
     102  /// Dependence on variable set
    103103  inline bool dependsOn (int *indices, int num)
    104104    {return image_ -> dependsOn (indices, num);}
    105105
    106   // Get a measure of "how linear" the expression is (see CouenneTypes.h)
     106  /// Get a measure of "how linear" the expression is (see CouenneTypes.h)
    107107  inline int Linearity ()
    108108    {return LINEAR;}
    109109    /*return image_ -> Linearity ();*/
    110110
    111   // Get lower and upper bound of an expression (if any)
     111  /// Get lower and upper bound of an expression (if any)
    112112  inline void getBounds (expression *&lb, expression *&ub) {
    113113
    114     // this replaces the previous
    115     //
    116     //    image_ -> getBounds (lb0, ub0);
    117     //
    118     // which created large expression trees, now useless since all
    119     // auxiliaries are standardized.
     114    /// this replaces the previous
     115    ///
     116    ///    image_ -> getBounds (lb0, ub0);
     117    ///
     118    /// which created large expression trees, now useless since all
     119    /// auxiliaries are standardized.
    120120
    121121    lb = new exprLowerBound (varIndex_);
     
    136136  }
    137137
    138   // generate cuts for expression associated with this auxiliary
     138  /// generate cuts for expression associated with this auxiliary
    139139  void generateCuts (const OsiSolverInterface &,
    140140                     OsiCuts &, const CouenneCutGenerator *);
  • branches/Couenne/Couenne/src/expression/exprCopy.h

    r530 r534  
    2222 protected:
    2323
    24   // the expression this object is a (reference) copy of
     24  /// the expression this object is a (reference) copy of
    2525  expression *copy_;
    2626
    2727 public:
    2828
    29   // node type
     29  /// node type
    3030  inline enum nodeType Type ()
    3131    {return copy_ -> Type ();}
    3232
    33   // Constructor, destructor
     33  /// Constructor, destructor
    3434  exprCopy  (expression *copy):
    3535    copy_ (copy) {}
    3636
    37   // copy constructor
     37  /// copy constructor
    3838  exprCopy (const exprCopy &e) {
    3939    copy_ = e.Original () -> clone ();
    4040  }
    4141
    42   // cloning method
     42  /// cloning method
    4343  virtual exprCopy *clone () const
    4444    {return new exprCopy (*this);}
    4545
    46   // If this is an exprClone of a exprClone of an expr???, point to
    47   // the original expr??? instead of an exprClone -- improves computing
    48   // efficiency
     46  /// If this is an exprClone of a exprClone of an expr???, point to
     47  /// the original expr??? instead of an exprClone -- improves computing
     48  /// efficiency
    4949  inline const expression *Original () const
    5050    {return copy_ -> Original ();}
    5151
    52   // get variable index in problem
     52  /// get variable index in problem
    5353  inline int Index () const
    5454    {return copy_ -> Index ();}
    5555
    56   // I/O
     56  /// I/O
    5757  virtual void print (std::ostream &out) const
    5858  {out << "["; copy_ -> Original () -> print (out); out << "]";}
    5959
    60   // value (empty)
     60  /// value (empty)
    6161  virtual inline CouNumber Value () const
    6262    //    {return currValue_;}
     
    6767  // in successive evaluations.
    6868
    69   // null function for evaluating the expression
     69  /// null function for evaluating the expression
    7070  virtual inline CouNumber operator () ()
    7171    {return (currValue_ = (*copy_) ());}
    7272  //    {return (currValue_ = copy_ -> Value ());}
    7373
    74   // differentiation
     74  /// differentiation
    7575  inline expression *differentiate (int index)
    7676    {return copy_ -> differentiate (index);}
    7777
    78   // dependence on variable set
     78  /// dependence on variable set
    7979  inline bool dependsOn (int *varlist, int n)
    8080    {return copy_ -> dependsOn (varlist, n);}
    8181
    82   // simplify expression (useful for derivatives)
     82  /// simplify expression (useful for derivatives)
    8383  inline expression *simplify ()
    8484    {return copy_ -> simplify ();}
    8585
    86   // get a measure of "how linear" the expression is (see CouenneTypes.h)
     86  /// get a measure of "how linear" the expression is (see CouenneTypes.h)
    8787  inline int Linearity ()
    8888    {return copy_ -> Linearity ();}
    8989
    90   // Get lower and upper bound of an expression (if any)
     90  /// Get lower and upper bound of an expression (if any)
    9191  inline void getBounds (expression *&lower, expression *&upper)
    9292    {copy_ -> getBounds (lower, upper);}
    9393
    94   // Create standard formulation of this expression
     94  /// Create standard formulation of this expression
    9595  inline exprAux *standardize (CouenneProblem *p)
    9696    {return copy_ -> standardize (p);}
    9797
    98   // generate convexification cut for constraint w = this
     98  /// generate convexification cut for constraint w = this
    9999  inline void generateCuts (exprAux *w, const OsiSolverInterface &si,
    100100                            OsiCuts &cs, const CouenneCutGenerator *cg)
    101101    {copy_ -> generateCuts (w, si, cs, cg);}
    102102
    103   // return an index to the variable's argument that is better fixed
    104   // in a branching rule for solving a nonconvexity gap
     103  /// return an index to the variable's argument that is better fixed
     104  /// in a branching rule for solving a nonconvexity gap
    105105  virtual expression *getFixVar ()
    106106    {return copy_ -> getFixVar ();}
    107107
    108   ///
     108  /// code for comparisons
    109109  virtual enum expr_type code ()
    110110    {return copy_ -> code ();}
    111111
    112   ///
     112  /// compare this with other expression
    113113  int compare (expression &e)
    114114    {return copy_ -> compare (e);}
  • branches/Couenne/Couenne/src/expression/exprIVar.h

    r530 r534  
    2020
    2121
    22 // variable-type operator. All variables of the expression must be
    23 // objects of this class
     22/// variable-type operator. All variables of the expression must be
     23/// objects of this class
    2424
    2525class exprIVar: public exprVar {
     
    2727 public:
    2828
    29   // Constructor
     29  /// Constructor
    3030  exprIVar (int varIndex):
    3131    exprVar (varIndex) {}
    3232
    33   // copy constructor
     33  /// copy constructor
    3434  exprIVar (const exprIVar &e):
    3535    exprVar (e.Index ()) {}
    3636
    37   // cloning method
     37  /// cloning method
    3838  virtual exprIVar *clone () const
    3939    {return new exprIVar (*this);}
    4040
    41   // print
     41  /// print
    4242  virtual void print (std::ostream &out) const
    4343    {out << "y_" << varIndex_;}
    4444
    45   // is this expression integer?
     45  /// is this expression integer?
    4646  virtual bool isInteger ()
    4747    {return true;}
  • branches/Couenne/Couenne/src/expression/exprUnary.h

    r530 r534  
    2121
    2222
    23 //
    24 // univariate operator-type expression: requires single argument. All
    25 // unary functions are derived from this base class, which has a lot
    26 // of common methods that need not be re-implemented by any univariate
    27 // class.
    28 //
     23/// univariate operator-type expression: requires single argument. All
     24/// unary functions are derived from this base class, which has a lot
     25/// of common methods that need not be re-implemented by any univariate
     26/// class.
    2927
    3028class exprUnary: public expression {
     
    6563    {return &argument_;}
    6664
    67   // I/O
     65  /// I/O
    6866  virtual void print (std::ostream &, const std::string &, enum pos) const;
    6967
    70   // compute value of unary operator
     68  /// compute value of unary operator
    7169  virtual inline CouNumber operator () ()
    7270    {return (currValue_ = (F ()) ((*argument_) ()));}
    7371
    74   // dependence on variable set
     72  /// dependence on variable set
    7573  bool inline dependsOn (int *list, int n)
    7674    {return argument_ -> dependsOn (list, n);}
    7775
    78   // simplification
     76  /// simplification
    7977  expression *simplify ();
    8078
    81   // get a measure of "how linear" the expression is (see CouenneTypes.h)
    82   // for general univariate functions, return nonlinear.
     79  /// get a measure of "how linear" the expression is (see CouenneTypes.h)
     80  /// for general univariate functions, return nonlinear.
    8381  virtual inline int Linearity ()
    8482    {return NONLINEAR;}
    8583
    86   // reduce expression in standard form, creating additional aux
    87   // variables (and constraints)
     84  /// reduce expression in standard form, creating additional aux
     85  /// variables (and constraints)
    8886  virtual exprAux *standardize (CouenneProblem *);
    8987
    90   // return an index to the variable's argument that is better fixed
    91   // in a branching rule for solving a nonconvexity gap
     88  /// return an index to the variable's argument that is better fixed
     89  /// in a branching rule for solving a nonconvexity gap
    9290  virtual expression *getFixVar ()
    9391    {return argument_;}
  • branches/Couenne/Couenne/src/expression/expression.h

    r530 r534  
    1313
    1414#include <iostream>
     15
    1516#include <CouennePrecisions.h>
    1617#include <CouenneTypes.h>
    1718
     19class OsiBranchingObject;
    1820class CouenneProblem;
    1921class CouenneCutGenerator;
     
    2527class exprCopy;
    2628
    27 // expression base class
     29/// expression base class
    2830
    2931class expression {
     
    218220  virtual int Multiplicity ()
    219221    {return 1;}
     222
     223  /// branching object best suited for this expression
     224  virtual OsiBranchingObject *BranchObject ()
     225    {return NULL;}
    220226};
    221227
  • branches/Couenne/Couenne/src/problem/CouenneProblemElem.h

    r530 r534  
    2323 protected:
    2424
    25   // a general constraint is defined as lb_ <= body_ <= ub_, where all
    26   // three components are expressions, depending on variables,
    27   // auxiliaries and bounds. If the constraint is 2 <= exp (x1+x2) <=
    28   // 4, then:
     25  /// a general constraint is defined as lb_ <= body_ <= ub_, where all
     26  /// three components are expressions, depending on variables,
     27  /// auxiliaries and bounds. If the constraint is 2 <= exp (x1+x2) <=
     28  /// 4, then:
    2929
    30   // body_ = exp (x1+x2), that is,
    31   // new exprExp (new exprSum (new exprVar (1), new exprVar (2)),
     30  /// body_ = exp (x1+x2), that is,
     31  /// new exprExp (new exprSum (new exprVar (1), new exprVar (2)),
    3232  expression *body_;
    3333
    34   // while lb_ = new exprConst (2) and ub_ = new exprConst (4).
     34  /// while lb_ = new exprConst (2) and ub_ = new exprConst (4).
    3535  expression *lb_;
    3636  expression *ub_;
     
    3838 public:
    3939
    40   // constructor
     40  /// constructor
    4141  CouenneConstraint  (expression *body = NULL,
    4242                      expression *lb   = NULL,
     
    5555  }
    5656
    57   // destructor
     57  /// destructor
    5858  ~CouenneConstraint () {
    5959    delete body_;
     
    6262  }
    6363
    64   // copy constructor
     64  /// copy constructor
    6565  CouenneConstraint  (const CouenneConstraint &c):
    6666    body_  (c.Body () -> clone ()),
     
    6868    ub_    (c.Ub   () -> clone ()) {}
    6969
    70   // cloning method
     70  /// cloning method
    7171  inline CouenneConstraint *clone () const
    7272    {return new CouenneConstraint (*this);}
    7373
    74   // get constraint's elements
     74  /// get constraint's elements
    7575  inline expression *Lb   () const {return lb_;}
    7676  inline expression *Ub   () const {return ub_;}
    7777  inline expression *Body () const {return body_;}
    7878
    79   // set body of constraint
     79  /// set body of constraint
    8080  inline expression *Body (expression *newBody)
    8181    {body_ = newBody; return body_;}
    8282
    83   // decompose body of constraint through auxiliary variables
     83  /// decompose body of constraint through auxiliary variables
    8484  inline exprAux *standardize (CouenneProblem *p)
    8585    {return body_ -> standardize (p);}
    8686
    87   // print constraint
     87  /// print constraint
    8888  void print (std::ostream &);
    8989};
    9090
    9191
    92 // Objective function class, with an expression and an optimization
    93 // direction
     92/// Objective function class, with an expression and an optimization
     93/// direction
    9494
    9595class Objective {
     
    9797 protected:
    9898
    99   // expression to optimize
     99  /// expression to optimize
    100100  expression *body_;
    101101
    102   // can be COUENNE_MAXIMIZE or COUENNE_MINIMIZE
     102  /// can be COUENNE_MAXIMIZE or COUENNE_MINIMIZE
    103103  enum opt_sense sense_;
    104104
    105105 public:
    106106
    107   // constructor
     107  /// constructor
    108108  Objective  (expression *body, enum opt_sense sense):
    109109    body_ (body), sense_ (sense) {}
    110110
    111   // destructor
     111  /// destructor
    112112  ~Objective ()
    113113    {delete body_;}
    114114
    115   // copy constructor
     115  /// copy constructor
    116116  Objective  (const Objective &o):
    117117    body_  (o.Body  () -> clone ()),
    118118    sense_ (o.Sense ()) {}
    119119
    120   // cloning method
     120  /// cloning method
    121121  inline Objective *clone () const
    122122    {return new Objective (*this);}
    123123
    124   // optimization sense
     124  /// optimization sense
    125125  inline enum opt_sense Sense () const
    126126    {return sense_;}
    127127
    128   // get body
     128  /// get body
    129129  inline expression *Body () const
    130130    {return body_;}
    131131
    132   // set body
     132  /// set body
    133133  expression *Body (expression *newBody)
    134134    {body_ = newBody; return body_;}
    135135
    136   // get standard form of this objective function
     136  /// get standard form of this objective function
    137137  inline exprAux *standardize (CouenneProblem *p)
    138138    {return body_ -> standardize (p);}
    139139
    140   // I/O
     140  /// I/O
    141141  void print (std::ostream &out = std::cout) {
    142142    out << (sense_ == MAXIMIZE ? "max " : "min ");
  • branches/Couenne/Couenne/src/util/rootQ.h

    r530 r534  
    1717}
    1818
    19 // class that stores result of previous calls to rootQ into a map for
    20 // faster access
     19/// class that stores result of previous calls to rootQ into a map for
     20/// faster access
    2121
    2222class Qroot {
     
    3030 public:
    3131
    32   // empty constructors (we only need the method to work on the static
    33   // structure)
     32  /// empty constructors (we only need the method to work on the static
     33  /// structure)
    3434 
    3535  Qroot  () {}
    3636  ~Qroot () {}
    3737
    38   // retrieve root of Q with order = k. If no such computation has
    39   // been performed yet, do it here
     38  /// retrieve root of Q with order = k. If no such computation has
     39  /// been performed yet, do it here
    4040
    4141  inline CouNumber operator () (int k) {
Note: See TracChangeset for help on using the changeset viewer.