Changeset 1061 for trunk


Ignore:
Timestamp:
Feb 1, 2014 2:22:28 PM (6 years ago)
Author:
pbelotti
Message:

revert to lexicographic order for set inclusion test; correct comparison procedure for tabu list and solution pool

Location:
trunk/Couenne/src/heuristics
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Couenne/src/heuristics/CouenneFPpool.cpp

    r1060 r1061  
    151151
    152152        int indVar = (*i) -> Index ();
    153        
    154         if (x_ [indVar] > other.x_ [indVar] + COUENNE_EPS)
    155           return false;
    156       }
    157 
    158     return true;
     153
     154        // LEXICOGRAPHICAL ORDERING: return true upon finding the
     155        // first element with lower element
     156
     157#if 0
     158        if (0) {
     159          printf (" (%d,%g,%g,%g)", indVar, x_ [indVar], other.x_ [indVar], x_ [indVar] - other.x_ [indVar]);
     160
     161          if (x_ [indVar] < other.x_ [indVar] - COUENNE_EPS)
     162            printf ("\n-----\n");
     163        }
     164#endif
     165        if (x_ [indVar] < other.x_ [indVar] - COUENNE_EPS)
     166          return true;
     167      }
     168
     169    //printf ("\n####\n");
     170    return false;
    159171  }
    160172
     
    171183        int indVar = (*i) -> Index ();
    172184
    173         if (x_ [indVar] > other.x_ [indVar] + COUENNE_EPS)
    174           return false;
    175       }
    176 
    177     return true;
     185        if (x_ [indVar] < other.x_ [indVar] + COUENNE_EPS)
     186          return true;
     187      }
     188
     189    return false;
    178190  }
    179191  }
     
    223235
    224236   double bestdist = COIN_DBL_MAX;
    225    std::set <CouenneFPsolution>::iterator bestsol = set_. end ();
     237   std::set <CouenneFPsolution, compareSol>::iterator bestsol = set_. end ();
    226238
    227239   if( nSol )
    228240   {
    229       for (std::set <CouenneFPsolution>::iterator i = set_. begin ();
     241     for (std::set <CouenneFPsolution, compareSol>::iterator i = set_. begin ();
    230242           i != set_. end (); ++i)
    231243      {
  • trunk/Couenne/src/heuristics/CouenneFPpool.hpp

    r893 r1061  
    9494
    9595    /// Pool
    96     std::set <CouenneFPsolution> set_;
     96    std::set <CouenneFPsolution, compareSol> set_;
    9797
    9898    /// Problem pointer
     
    112112
    113113    /// return the main object in this class
    114     std::set <CouenneFPsolution> &Set ()
     114    std::set <CouenneFPsolution, compareSol> &Set ()
    115115    {return set_;}
    116116
  • trunk/Couenne/src/heuristics/CouenneFPscipSolve.cpp

    r1060 r1061  
    210210     
    211211      SCIP_CALL( SCIPaddCons(scip, tabucons) );
    212 
     212      //SCIP_CALL (SCIPprintCons (scip, tabucons, NULL));
    213213      SCIP_CALL (SCIPreleaseCons (scip, &tabucons));
    214214    }
     
    462462        int nstoredsols;
    463463
     464        double objval = 0;
     465
    464466        /* get incumbent solution */
    465467        bestsol = SCIPgetBestSol(scip);
     
    485487        // do not store too many or too poor solutions
    486488        for(int i=1; i<nscipsols && nstoredsols < 10 &&
    487               SCIPgetSolOrigObj(scip,scipsols[i]) <= cutoffbound; i++){
     489              (objval = SCIPgetSolOrigObj(scip,scipsols[i])) <= cutoffbound; i++){
    488490
    489491          double* tmpsol = new CouNumber [nvars];
     
    499501              && pool_ -> Set (). find (couennesol) == pool_ -> Set() . end ()
    500502              ){
     503
    501504            pool_ -> Set (). insert (couennesol);
    502505
  • trunk/Couenne/src/heuristics/CouenneFeasPump.cpp

    r1060 r1061  
    184184    nSep     = 0,   // If separation short circuit, max # of consecutive separations
    185185    objInd   = problem_ -> Obj (0) -> Body () -> Index ();
     186
     187  if (nlp_ -> getSolution ())
     188    nSol = CoinCopyOfArray (nlp_ -> getSolution (), problem_ -> nVars ());
    186189
    187190  /////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.