Changeset 1080


Ignore:
Timestamp:
Oct 30, 2014 4:06:40 PM (5 years ago)
Author:
pbelotti
Message:

avoid accessing auxs that were written off (i.e. their Multiplicity()==0) and whose Image() is NULL

Location:
trunk/Couenne/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Couenne/src/expression/CouenneExprAux.hpp

    r968 r1080  
    146146    return ((integer_ == Integer) ||
    147147            ((integer_ == Unset) &&
    148             ((integer_ = (image_ -> isInteger ()) ?
    149               Integer : Continuous) == Integer)));
     148             ((integer_ = ((image_ != NULL) && (image_ -> isInteger ())) ?
     149               Integer : Continuous) == Integer)));
    150150  }
    151151
     
    210210struct compExpr {
    211211  inline bool operator () (exprAux* e0, exprAux* e1) const
    212   {return ((e0 -> sign () < e1 -> sign ()) || (e0 -> Image () -> compare (*(e1 -> Image ())) < 0));}
     212  {
     213    return ((e0 -> sign  () < e1 -> sign  ()) ||
     214            ((e0 -> Image () != NULL) && (e1 -> Image () != NULL) && (e0 -> Image () -> compare (*(e1 -> Image ())) < 0)));
     215  }
    213216};
    214217
  • trunk/Couenne/src/problem/fillDependence.cpp

    r490 r1080  
    3131
    3232    if (((*i) -> Type () == AUX)                           // consider auxs only
     33        && ((*i) -> Multiplicity () > 0)
    3334        && ((*i) -> Image () -> Linearity () > LINEAR)) {  // and nonlinear
    3435
  • trunk/Couenne/src/problem/problem.cpp

    r966 r1080  
    386386  for (std::vector <exprVar *>::iterator i = variables_.begin ();
    387387       i != variables_.end (); ++i) {
     388
     389    if ((*i) -> Multiplicity () <= 0)
     390      continue;
    388391
    389392    (*i) -> linkDomain (&domain_);
  • trunk/Couenne/src/standardize/standardize.cpp

    r937 r1080  
    389389           i != variables_.end (); ++i)
    390390
    391         if (((*i) -> Type () == AUX) && ((*i) -> sign () == expression::AUX_EQ)) {
     391        if (((*i) -> Multiplicity () > 0) && ((*i) -> Type () == AUX) && ((*i) -> sign () == expression::AUX_EQ)) {
    392392
    393393          int type = (*i) -> Image () -> Type ();
     
    521521    int ord = numbering_ [i];
    522522
     523    if (variables_ [ord] -> Multiplicity () <= 0)
     524      continue;
     525
    523526    if (variables_ [ord] -> Type () == AUX) {
    524527
Note: See TracChangeset for help on using the changeset viewer.