Changeset 75


Ignore:
Timestamp:
Mar 3, 2009 10:43:48 AM (12 years ago)
Author:
pbelotti
Message:

fixed segfault with constant objective. Other minor fixes

Location:
trunk/Couenne
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Couenne/acinclude.m4

    r71 r75  
    64006400# This file is distributed under the Common Public License.
    64016401#
    6402 ## $Id: coin.m4 1234 2009-02-09 12:31:12Z andreasw $
     6402## $Id: coin.m4 1237 2009-02-23 15:51:43Z andreasw $
    64036403#
    64046404# Author: Andreas Wachter    IBM      2006-04-14
     
    93809380      fi
    93819381    fi
    9382   else
     9382  elif test "$use_lapack" != no; then
    93839383    AC_MSG_CHECKING([whether user supplied LAPACKLIB=\"$use_lapack\" works])
    93849384    LIBS="$use_lapack $LIBS"
     
    94659465AM_CONDITIONAL([COIN_BUILD_LAPACK],[test "$use_lapack" = BUILD])
    94669466
    9467 if test x"$use_lapack" = x; then
     9467if test x"$use_lapack" = x || test "$use_lapack" = no; then
    94689468  coin_has_lapack=no
    94699469else
  • trunk/Couenne/src/expression/exprAux.cpp

    r39 r75  
    8181/// Destructor
    8282exprAux::~exprAux () {
    83   if (image_) delete image_;
     83  if (image_) {
     84    //printf ("deleting %x: ", this);   fflush (stdout); print ();           fflush (stdout);
     85    //printf (" [%x] ",        image_); fflush (stdout); image_ -> print (); fflush (stdout);
     86    //printf ("\n");
     87    delete image_;
     88  }
    8489  if (lb_)    delete lb_;
    8590  if (ub_)    delete ub_;
  • trunk/Couenne/src/expression/operators/exprGroup.cpp

    r34 r75  
    322322  }
    323323}
     324
     325
     326/// simplification
     327expression *exprGroup::simplify () {
     328  exprOp::simplify ();
     329  //if (lcoeff_. size () <= 0) // this is just a constant
     330  //return new exprConst (c0_);
     331  //else
     332  return NULL;
     333}
     334
  • trunk/Couenne/src/expression/operators/exprGroup.hpp

    r34 r75  
    7272
    7373  /// simplification
    74   virtual expression *simplify ()
    75     {exprOp::simplify (); return NULL;}
     74  virtual expression *simplify ();
    7675
    7776  /// get a measure of "how linear" the expression is:
  • trunk/Couenne/src/expression/operators/exprOpp.cpp

    r34 r75  
    99
    1010#include "exprOpp.hpp"
     11#include "exprConst.hpp"
    1112
    1213
     
    7576  }
    7677
     78  // check if this is a -(const)
     79  if (argument_ -> Type () == CONST) {
     80    expression *ret = new exprConst (- argument_ -> Value ());
     81    delete argument_;
     82    return ret;
     83  }
     84
    7785  return NULL;
    7886}
  • trunk/Couenne/src/expression/operators/exprQuad.cpp

    r61 r75  
    493493  return sqrt (grad);
    494494}
     495
     496/// Simplify expression
     497expression *exprQuad::simplify () {
     498  exprOp::simplify ();
     499  return NULL;
     500}
     501
  • trunk/Couenne/src/expression/operators/exprQuad.hpp

    r61 r75  
    113113
    114114  /// Simplify expression
    115   virtual expression *simplify ()
    116   {exprOp::simplify (); return NULL;}
     115  virtual expression *simplify ();
    117116
    118117  /// Get a measure of "how linear" the expression is
  • trunk/Couenne/src/problem/CouenneProblem.cpp

    r70 r75  
    324324void CouenneProblem::addObjective (expression *newobj, const std::string &sense = "min") {
    325325  objectives_ . push_back
    326     (new CouenneObjective ((sense == "min") ? newobj : new exprOpp (newobj)));//, MINIMIZE));
     326    (new CouenneObjective ((sense == "min") ? newobj : new exprOpp (new exprClone (newobj))));//, MINIMIZE));
    327327}
    328328
  • trunk/Couenne/src/standardize/linStandardize.cpp

    r1 r75  
    7575  if ((nq==0) && (nl==0))
    7676
    77     ret = addAuxiliary (new exprConst (c0)); // a constant auxiliary? FIX!
     77    ret = new exprClone (addAuxiliary (new exprConst (c0))); // a constant auxiliary? FIX!
    7878
    7979  else if ((nq==0) && (fabs (c0) < COUENNE_EPS) && (nl==1)) { // a linear monomial, cx
  • trunk/Couenne/src/standardize/standardize.cpp

    r69 r75  
    105105
    106106#ifdef DEBUG
    107     printf ("Objective "); (*i) -> print ();
     107    printf ("Objective [code: %d]", (*i) -> Body () -> code ()); (*i) -> print ();
    108108#endif
    109109
     
    111111
    112112#ifdef DEBUG
    113     printf ("      --> "); (*i) -> print ();
     113    printf ("      --> "); (*i) -> print ();
     114    if (aux) {printf (" -- aux is "); aux -> print (); printf ("\n");}
    114115#endif
    115116
Note: See TracChangeset for help on using the changeset viewer.