Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/25/11 18:28:10 (13 years ago)
Author:
abeham
Message:

#1541

  • Changed aspiration criterion after contacting Taillard, added option to choose between old or new adaption scheme
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/QAPAlgorithms/HeuristicLab.Problems.QuadraticAssignment.Algorithms/3.3/RobustTabooSeachOperator.cs

    r6586 r6593  
    3737      get { return (ILookupParameter<IntValue>)Parameters["Iterations"]; }
    3838    }
     39    public ILookupParameter<IRandom> RandomParameter {
     40      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
     41    }
    3942    public ILookupParameter<Permutation> PermutationParameter {
    4043      get { return (ILookupParameter<Permutation>)Parameters["Permutation"]; }
     
    6164      get { return (ILookupParameter<Swap2Move>)Parameters["LastMove"]; }
    6265    }
     66    public ILookupParameter<BoolValue> UseNewTabuTenureAdaptionSchemeParameter {
     67      get { return (ILookupParameter<BoolValue>)Parameters["UseNewTabuTenureAdaptionScheme"]; }
     68    }
    6369    public ILookupParameter<ResultCollection> ResultsParameter {
    6470      get { return (ILookupParameter<ResultCollection>)Parameters["Results"]; }
    6571    }
    6672
    67     public ILookupParameter<IRandom> RandomParameter {
    68       get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
    69     }
    7073    public IValueLookupParameter<IntValue> MaximumIterationsParameter {
    7174      get { return (IValueLookupParameter<IntValue>)Parameters["MaximumIterations"]; }
     
    101104      Parameters.Add(new LookupParameter<DoubleValue>("BestQuality", "The best quality value."));
    102105      Parameters.Add(new LookupParameter<Swap2Move>("LastMove", "The last move that was applied."));
     106      Parameters.Add(new LookupParameter<BoolValue>("UseNewTabuTenureAdaptionScheme", "True if the new tabu tenure adaption should be used or false otherwise."));
    103107      Parameters.Add(new LookupParameter<ResultCollection>("Results", "Collection that houses the results of the algorithm."));
    104108      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations", "The number of iterations that the algorithm should run."));
     
    151155                      || shortTermMemory[move.Index2, solution[move.Index1]] < iteration;
    152156
    153         bool aspired = shortTermMemory[move.Index1, solution[move.Index2]] < iteration - alternativeAspirationTenure
    154                     || shortTermMemory[move.Index2, solution[move.Index1]] < iteration - alternativeAspirationTenure
    155                     || quality.Value + moveQuality < bestQuality.Value;
     157        bool aspired = (shortTermMemory[move.Index1, solution[move.Index2]] < iteration - alternativeAspirationTenure
     158                     && shortTermMemory[move.Index2, solution[move.Index1]] < iteration - alternativeAspirationTenure)
     159                  || quality.Value + moveQuality < bestQuality.Value;
    156160
    157161        if ((aspired && !already_aspired) // the first alternative move is aspired
     
    169173        if (!results.ContainsKey("AspiredMoves")) {
    170174          aspiredMoves = new IntValue(already_aspired ? 1 : 0);
    171           results.Add(new Result("AspiredMoves", aspiredMoves));
     175          results.Add(new Result("AspiredMoves", "Counts the number of moves that were selected because of the aspiration criteria.", aspiredMoves));
    172176        } else if (already_aspired) {
    173177          aspiredMoves = (IntValue)results["AspiredMoves"].Value;
     
    180184      if (bestMove == null) return base.Apply();
    181185
    182       shortTermMemory[bestMove.Index1, solution[bestMove.Index1]] = iteration + random.Next(minTenure, maxTenure);
    183       shortTermMemory[bestMove.Index2, solution[bestMove.Index2]] = iteration + random.Next(minTenure, maxTenure);
     186      bool useNewAdaptionScheme = UseNewTabuTenureAdaptionSchemeParameter.ActualValue.Value;
     187      if (useNewAdaptionScheme) {
     188        double r = random.NextDouble();
     189        shortTermMemory[bestMove.Index1, solution[bestMove.Index1]] = (int)(iteration + r * r * r * maxTenure);
     190        r = random.NextDouble();
     191        shortTermMemory[bestMove.Index2, solution[bestMove.Index2]] = (int)(iteration + r * r * r * maxTenure);
     192      } else {
     193        shortTermMemory[bestMove.Index1, solution[bestMove.Index1]] = iteration + random.Next(minTenure, maxTenure);
     194        shortTermMemory[bestMove.Index2, solution[bestMove.Index2]] = iteration + random.Next(minTenure, maxTenure);
     195      }
    184196      Swap2Manipulator.Apply(solution, bestMove.Index1, bestMove.Index2);
    185197      quality.Value += bestMoveQuality;
Note: See TracChangeset for help on using the changeset viewer.