Changeset 12835 for trunk/sources/HeuristicLab.Problems.QuadraticAssignment.Algorithms/3.3/RobustTabooSeachOperator.cs
- Timestamp:
- 08/03/15 23:42:33 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.QuadraticAssignment.Algorithms/3.3/RobustTabooSeachOperator.cs
r12810 r12835 20 20 #endregion 21 21 22 using System; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; … … 92 93 } 93 94 94 public ILookupParameter<IntValue> EvaluatedMovesParameter { 95 get { return (ILookupParameter<IntValue>)Parameters["EvaluatedMoves"]; } 95 public ILookupParameter<IntValue> EvaluatedSolutionsParameter { 96 get { return (ILookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; } 97 } 98 99 public ILookupParameter<DoubleValue> EvaluatedSolutionEquivalentsParameter { 100 get { return (ILookupParameter<DoubleValue>)Parameters["EvaluatedSolutionEquivalents"]; } 96 101 } 97 102 #endregion … … 121 126 Parameters.Add(new ValueLookupParameter<IntValue>("AlternativeAspirationTenure", "The time t that a move will be remembered for the alternative aspiration condition.")); 122 127 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.")); 128 Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of evaluated solutions.")); 129 Parameters.Add(new LookupParameter<DoubleValue>("EvaluatedSolutionEquivalents", "The number of evaluated solution equivalents.")); 124 130 } 125 131 … … 135 141 Parameters.Add(new LookupParameter<BoolValue>("AllMovesTabu", "Indicates that all moves are tabu.")); 136 142 } 137 if (!Parameters.ContainsKey("EvaluatedMoves")) { 138 Parameters.Add(new LookupParameter<IntValue>("EvaluatedMoves", "The number of move evaluations made.")); 143 if (!Parameters.ContainsKey("EvaluatedSolutions")) { 144 Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of evaluated solutions.")); 145 } 146 if (!Parameters.ContainsKey("EvaluatedSolutionEquivalents")) { 147 Parameters.Add(new LookupParameter<DoubleValue>("EvaluatedSolutionEquivalents", "The number of evaluated solution equivalents.")); 139 148 } 140 149 #endregion … … 171 180 bool already_aspired = false; 172 181 173 var evaluatedMoves = 0;182 double evaluations = EvaluatedSolutionsParameter.ActualValue.Value; 174 183 foreach (Swap2Move move in ExhaustiveSwap2MoveGenerator.Generate(solution)) { 175 184 double moveQuality; 176 185 if (lastMove == null) { 177 186 moveQuality = QAPSwap2MoveEvaluator.Apply(solution, move, weights, distances); 178 evaluat edMoves++;187 evaluations += 4.0 / solution.Length; 179 188 } else if (allMovesTabu) moveQuality = moveQualityMatrix[move.Index1, move.Index2]; 180 189 else { 181 190 moveQuality = QAPSwap2MoveEvaluator.Apply(solution, move, moveQualityMatrix[move.Index1, move.Index2], weights, distances, lastMove); 182 evaluatedMoves++; 191 if (move.Index1 == lastMove.Index1 || move.Index2 == lastMove.Index1 || move.Index1 == lastMove.Index2 || move.Index2 == lastMove.Index2) 192 evaluations += 4.0 / solution.Length; 193 else evaluations += 2.0 / (solution.Length * solution.Length); 183 194 } 184 195 … … 214 225 } 215 226 216 EvaluatedMovesParameter.ActualValue.Value += evaluatedMoves; 227 EvaluatedSolutionEquivalentsParameter.ActualValue.Value = evaluations; 228 EvaluatedSolutionsParameter.ActualValue.Value = (int)Math.Ceiling(evaluations); 217 229 218 230 allMovesTabu = bestMove == null;
Note: See TracChangeset
for help on using the changeset viewer.