Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/30/15 14:56:55 (9 years ago)
Author:
abeham
Message:

#2444: Added evaluation output to RTS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.QuadraticAssignment.Algorithms/3.3/RobustTabooSeachOperator.cs

    r12012 r12810  
    9090    private ILookupParameter<BoolValue> AllMovesTabuParameter {
    9191      get { return (ILookupParameter<BoolValue>)Parameters["AllMovesTabu"]; }
     92    }
     93
     94    public ILookupParameter<IntValue> EvaluatedMovesParameter {
     95      get { return (ILookupParameter<IntValue>)Parameters["EvaluatedMoves"]; }
    9296    }
    9397    #endregion
     
    117121      Parameters.Add(new ValueLookupParameter<IntValue>("AlternativeAspirationTenure", "The time t that a move will be remembered for the alternative aspiration condition."));
    118122      Parameters.Add(new LookupParameter<BoolValue>("AllMovesTabu", "Indicates that all moves are tabu."));
     123      Parameters.Add(new LookupParameter<IntValue>("EvaluatedMoves", "The number of move evaluations made."));
    119124    }
    120125
     
    129134      if (!Parameters.ContainsKey("AllMovesTabu")) {
    130135        Parameters.Add(new LookupParameter<BoolValue>("AllMovesTabu", "Indicates that all moves are tabu."));
     136      }
     137      if (!Parameters.ContainsKey("EvaluatedMoves")) {
     138        Parameters.Add(new LookupParameter<IntValue>("EvaluatedMoves", "The number of move evaluations made."));
    131139      }
    132140      #endregion
     
    163171      bool already_aspired = false;
    164172
     173      var evaluatedMoves = 0;
    165174      foreach (Swap2Move move in ExhaustiveSwap2MoveGenerator.Generate(solution)) {
    166175        double moveQuality;
    167         if (lastMove == null)
     176        if (lastMove == null) {
    168177          moveQuality = QAPSwap2MoveEvaluator.Apply(solution, move, weights, distances);
    169         else if (allMovesTabu) moveQuality = moveQualityMatrix[move.Index1, move.Index2];
    170         else moveQuality = QAPSwap2MoveEvaluator.Apply(solution, move, moveQualityMatrix[move.Index1, move.Index2], weights, distances, lastMove);
     178          evaluatedMoves++;
     179        } else if (allMovesTabu) moveQuality = moveQualityMatrix[move.Index1, move.Index2];
     180        else {
     181          moveQuality = QAPSwap2MoveEvaluator.Apply(solution, move, moveQualityMatrix[move.Index1, move.Index2], weights, distances, lastMove);
     182          evaluatedMoves++;
     183        }
    171184
    172185        moveQualityMatrix[move.Index1, move.Index2] = moveQuality;
     
    200213        }
    201214      }
     215
     216      EvaluatedMovesParameter.ActualValue.Value += evaluatedMoves;
    202217
    203218      allMovesTabu = bestMove == null;
Note: See TracChangeset for help on using the changeset viewer.