Changeset 12810 for trunk/sources/HeuristicLab.Problems.QuadraticAssignment.Algorithms/3.3/RobustTabooSeachOperator.cs
- Timestamp:
- 07/30/15 14:56:55 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.QuadraticAssignment.Algorithms/3.3/RobustTabooSeachOperator.cs
r12012 r12810 90 90 private ILookupParameter<BoolValue> AllMovesTabuParameter { 91 91 get { return (ILookupParameter<BoolValue>)Parameters["AllMovesTabu"]; } 92 } 93 94 public ILookupParameter<IntValue> EvaluatedMovesParameter { 95 get { return (ILookupParameter<IntValue>)Parameters["EvaluatedMoves"]; } 92 96 } 93 97 #endregion … … 117 121 Parameters.Add(new ValueLookupParameter<IntValue>("AlternativeAspirationTenure", "The time t that a move will be remembered for the alternative aspiration condition.")); 118 122 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.")); 119 124 } 120 125 … … 129 134 if (!Parameters.ContainsKey("AllMovesTabu")) { 130 135 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.")); 131 139 } 132 140 #endregion … … 163 171 bool already_aspired = false; 164 172 173 var evaluatedMoves = 0; 165 174 foreach (Swap2Move move in ExhaustiveSwap2MoveGenerator.Generate(solution)) { 166 175 double moveQuality; 167 if (lastMove == null) 176 if (lastMove == null) { 168 177 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 } 171 184 172 185 moveQualityMatrix[move.Index1, move.Index2] = moveQuality; … … 200 213 } 201 214 } 215 216 EvaluatedMovesParameter.ActualValue.Value += evaluatedMoves; 202 217 203 218 allMovesTabu = bestMove == null;
Note: See TracChangeset
for help on using the changeset viewer.