Changeset 7085 for branches/RegressionBenchmarks/HeuristicLab.Problems.QuadraticAssignment.Algorithms
- Timestamp:
- 11/28/11 13:47:28 (13 years ago)
- Location:
- branches/RegressionBenchmarks
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RegressionBenchmarks
- Property svn:ignore
-
old new 4 4 *.suo 5 5 *.vsp 6 Doxygen 6 7 Google.ProtocolBuffers-0.9.1.dll 7 8 HeuristicLab 3.3.5.1.ReSharper.user 8 9 HeuristicLab 3.3.6.0.ReSharper.user 9 10 HeuristicLab.4.5.resharper.user 11 HeuristicLab.ExtLibs.6.0.ReSharper.user 10 12 HeuristicLab.resharper.user 11 13 ProtoGen.exe … … 16 18 bin 17 19 protoc.exe 18 HeuristicLab.ExtLibs.6.0.ReSharper.user19 Doxygen
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/RegressionBenchmarks/HeuristicLab.Problems.QuadraticAssignment.Algorithms/3.3/RobustTabooSeachOperator.cs
r6628 r7085 31 31 namespace HeuristicLab.Problems.QuadraticAssignment.Algorithms { 32 32 [Item("RobustTabooSearchOperator", "Performs an iteration of the robust taboo search algorithm as descrbied in Taillard 1991.")] 33 [StorableClass] 33 34 public sealed class RobustTabooSeachOperator : SingleSuccessorOperator, IIterationBasedOperator, IStochasticOperator { 34 35 … … 85 86 public IValueLookupParameter<IntValue> AlternativeAspirationTenureParameter { 86 87 get { return (IValueLookupParameter<IntValue>)Parameters["AlternativeAspirationTenure"]; } 88 } 89 90 private ILookupParameter<BoolValue> AllMovesTabuParameter { 91 get { return (ILookupParameter<BoolValue>)Parameters["AllMovesTabu"]; } 87 92 } 88 93 #endregion … … 111 116 Parameters.Add(new ValueLookupParameter<BoolValue>("UseAlternativeAspiration", "True if the alternative aspiration condition should be used that takes moves that have not been made for some time above others.")); 112 117 Parameters.Add(new ValueLookupParameter<IntValue>("AlternativeAspirationTenure", "The time t that a move will be remembered for the alternative aspiration condition.")); 118 Parameters.Add(new LookupParameter<BoolValue>("AllMovesTabu", "Indicates that all moves are tabu.")); 113 119 } 114 120 115 121 public override IDeepCloneable Clone(Cloner cloner) { 116 122 return new RobustTabooSeachOperator(this, cloner); 123 } 124 125 [StorableHook(HookType.AfterDeserialization)] 126 private void AfterDeserialization() { 127 // BackwardsCompatibility3.3 128 #region Backwards compatible code, remove with 3.4 129 if (!Parameters.ContainsKey("AllMovesTabu")) { 130 Parameters.Add(new LookupParameter<BoolValue>("AllMovesTabu", "Indicates that all moves are tabu.")); 131 } 132 #endregion 117 133 } 118 134 … … 131 147 bestQuality = BestQualityParameter.ActualValue; 132 148 } 149 bool allMovesTabu = false; 150 if (AllMovesTabuParameter.ActualValue == null) 151 AllMovesTabuParameter.ActualValue = new BoolValue(false); 152 else allMovesTabu = AllMovesTabuParameter.ActualValue.Value; 133 153 134 154 int minTenure = MinimumTabuTenureParameter.ActualValue.Value; … … 147 167 if (lastMove == null) 148 168 moveQuality = QAPSwap2MoveEvaluator.Apply(solution, move, weights, distances); 169 else if (allMovesTabu) moveQuality = moveQualityMatrix[move.Index1, move.Index2]; 149 170 else moveQuality = QAPSwap2MoveEvaluator.Apply(solution, move, moveQualityMatrix[move.Index1, move.Index2], weights, distances, lastMove); 150 171 … … 180 201 } 181 202 182 LastMoveParameter.ActualValue = bestMove; 183 184 if (bestMove == null) return base.Apply(); 203 allMovesTabu = bestMove == null; 204 if (!allMovesTabu) 205 LastMoveParameter.ActualValue = bestMove; 206 AllMovesTabuParameter.ActualValue.Value = allMovesTabu; 207 208 if (allMovesTabu) return base.Apply(); 185 209 186 210 bool useNewAdaptionScheme = UseNewTabuTenureAdaptionSchemeParameter.ActualValue.Value; -
branches/RegressionBenchmarks/HeuristicLab.Problems.QuadraticAssignment.Algorithms/3.3/RobustTabooSearch.cs
r6953 r7085 51 51 52 52 #region Parameter Properties 53 public FixedValueParameter<MultiAnalyzer> AnalyzerParameter {54 get { return ( FixedValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }53 public IValueParameter<MultiAnalyzer> AnalyzerParameter { 54 get { return (IValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; } 55 55 } 56 56 public FixedValueParameter<IntValue> SeedParameter { … … 77 77 public FixedValueParameter<BoolValue> UseNewTabuTenureAdaptionSchemeParameter { 78 78 get { return (FixedValueParameter<BoolValue>)Parameters["UseNewTabuTenureAdaptionScheme"]; } 79 } 80 public FixedValueParameter<BoolValue> TerminateOnOptimalSolutionParameter { 81 get { return (FixedValueParameter<BoolValue>)Parameters["TerminateOnOptimalSolution"]; } 79 82 } 80 83 #endregion … … 112 115 get { return UseNewTabuTenureAdaptionSchemeParameter.Value.Value; } 113 116 set { UseNewTabuTenureAdaptionSchemeParameter.Value.Value = value; } 117 } 118 public bool TerminateOnOptimalSolution { 119 get { return TerminateOnOptimalSolutionParameter.Value.Value; } 120 set { TerminateOnOptimalSolutionParameter.Value.Value = value; } 114 121 } 115 122 #endregion … … 132 139 } 133 140 public RobustTabooSearch() { 134 Parameters.Add(new FixedValueParameter<MultiAnalyzer>("Analyzer", "The analyzers that are applied after each iteration.", new MultiAnalyzer()));141 Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The analyzers that are applied after each iteration.", new MultiAnalyzer())); 135 142 Parameters.Add(new FixedValueParameter<IntValue>("Seed", "The seed value of the random number generator.", new IntValue(0))); 136 143 Parameters.Add(new FixedValueParameter<BoolValue>("SetSeedRandomly", "True whether the seed should be set randomly for each run, false if it should be fixed.", new BoolValue(true))); … … 140 147 Parameters.Add(new FixedValueParameter<BoolValue>("UseAlternativeAspiration", "True if the alternative aspiration condition should be used that takes moves that have not been made for some time above others.", new BoolValue(false))); 141 148 Parameters.Add(new FixedValueParameter<IntValue>("AlternativeAspirationTenure", "The time t that a move will be remembered for the alternative aspiration condition.", new IntValue(int.MaxValue))); 142 Parameters.Add(new FixedValueParameter<BoolValue>("TerminateOnOptimalSolution", "True when the algorithm should stop if it reached a quality equal or smaller to the BestKnownQuality.", new BoolValue( true)));149 Parameters.Add(new FixedValueParameter<BoolValue>("TerminateOnOptimalSolution", "True when the algorithm should stop if it reached a quality equal or smaller to the BestKnownQuality.", new BoolValue(false))); 143 150 Parameters.Add(new FixedValueParameter<BoolValue>("UseNewTabuTenureAdaptionScheme", @"In an updated version of his implementation, Eric Taillard introduced a different way to change the tabu tenure. 144 151 Instead of setting it uniformly between min and max, it will be set between 0 and max according to a right-skewed distribution. 145 152 Set this option to false if you want to optimize using the earlier 1991 version, and set to true if you want to optimize using the newer version. 146 153 Please note that the MinimumTabuTenure parameter has no effect in the new version.", new BoolValue(true))); 154 155 TerminateOnOptimalSolutionParameter.Hidden = true; 147 156 148 157 qualityAnalyzer = new BestAverageWorstQualityAnalyzer(); … … 298 307 [StorableHook(HookType.AfterDeserialization)] 299 308 private void AfterDeserialization() { 309 // BackwardsCompatibility3.3 310 #region Backwards compatible code, remove with 3.4 311 if (Parameters["Analyzer"] is FixedValueParameter<MultiAnalyzer>) { 312 MultiAnalyzer analyzer = AnalyzerParameter.Value; 313 Parameters.Remove("Analyzer"); 314 Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The analyzers that are applied after each iteration.", analyzer)); 315 } 316 #endregion 300 317 RegisterEventHandlers(); 301 318 }
Note: See TracChangeset
for help on using the changeset viewer.