Changeset 5735
- Timestamp:
- 03/17/11 14:35:58 (14 years ago)
- Location:
- branches/VNS
- Files:
-
- 1 added
- 7 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/VNS/HeuristicLab.Algorithms.LocalSearch/3.3/HeuristicLab.Algorithms.LocalSearch-3.3.csproj
r5622 r5735 108 108 <ItemGroup> 109 109 <Compile Include="HeuristicLabAlgorithmsLocalSearchPlugin.cs" /> 110 <Compile Include="LocalSearchImprovement .cs" />110 <Compile Include="LocalSearchImprovementOperator.cs" /> 111 111 <Compile Include="LocalSearchMainLoop.cs" /> 112 112 <Compile Include="Properties\AssemblyInfo.cs" /> -
branches/VNS/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearchImprovementOperator.cs
r5725 r5735 33 33 using HeuristicLab.Optimization; 34 34 using HeuristicLab.Optimization.Operators; 35 using HeuristicLab.Analysis; 35 36 36 37 namespace HeuristicLab.Algorithms.LocalSearch { … … 38 39 /// A local search improvement operator. 39 40 /// </summary> 40 [Item("LocalSearchImprovement ", "A local search improvement operator.")]41 [Item("LocalSearchImprovementOperator", "A local search improvement operator.")] 41 42 [StorableClass] 42 public class LocalSearchImprovement : SingleSuccessorOperator, ILocalImprovement{43 public class LocalSearchImprovementOperator: SingleSuccessorOperator, ILocalImprovementOperator { 43 44 [Storable] 44 45 private LocalSearchMainLoop loop; 46 47 [Storable] 48 private BestAverageWorstQualityAnalyzer qualityAnalyzer; 45 49 46 50 private ConstrainedValueParameter<IMoveGenerator> MoveGeneratorParameter { … … 62 66 get { return (LookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; } 63 67 } 64 public LookupParameter<IOperator> AnalyzerParameter {65 get { return ( LookupParameter<IOperator>)Parameters["Analyzer"]; }68 public ValueParameter<MultiAnalyzer> AnalyzerParameter { 69 get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; } 66 70 } 67 71 … … 78 82 set { MoveEvaluatorParameter.Value = value; } 79 83 } 84 public MultiAnalyzer Analyzer { 85 get { return AnalyzerParameter.Value; } 86 set { AnalyzerParameter.Value = value; } 87 } 80 88 81 89 [StorableConstructor] 82 protected LocalSearchImprovement (bool deserializing) : base(deserializing) {}90 protected LocalSearchImprovementOperator(bool deserializing) : base(deserializing) {} 83 91 [StorableHook(HookType.AfterDeserialization)] 84 92 private void AfterDeserialization() { 85 93 Initialize(); 86 94 } 87 protected LocalSearchImprovement (LocalSearchImprovementoriginal, Cloner cloner)95 protected LocalSearchImprovementOperator(LocalSearchImprovementOperator original, Cloner cloner) 88 96 : base(original, cloner) { 89 97 this.loop = cloner.Clone(original.loop); 98 this.qualityAnalyzer = cloner.Clone(original.qualityAnalyzer); 90 99 Initialize(); 91 100 } 92 101 public override IDeepCloneable Clone(Cloner cloner) { 93 return new LocalSearchImprovement (this, cloner);94 } 95 public LocalSearchImprovement ()102 return new LocalSearchImprovementOperator(this, cloner); 103 } 104 public LocalSearchImprovementOperator() 96 105 : base() { 97 loop = new LocalSearchMainLoop(new BoolValue(true)); 106 loop = new LocalSearchMainLoop("LocalIterations", "BestLocalQuality"); 107 108 ResultsCollector rc = ((loop.OperatorGraph.InitialOperator as SingleSuccessorOperator).Successor 109 as SingleSuccessorOperator).Successor as ResultsCollector; 110 rc.CollectedValues.Remove("BestLocalQuality"); 111 112 qualityAnalyzer = new BestAverageWorstQualityAnalyzer(); 98 113 99 114 Parameters.Add(new ConstrainedValueParameter<IMoveGenerator>("MoveGenerator", "The operator used to generate moves to the neighborhood of the current solution.")); 100 115 Parameters.Add(new ConstrainedValueParameter<IMoveMaker>("MoveMaker", "The operator used to perform a move.")); 101 116 Parameters.Add(new ConstrainedValueParameter<ISingleObjectiveMoveEvaluator>("MoveEvaluator", "The operator used to evaluate a move.")); 102 Parameters.Add(new ValueParameter<IntValue>("MaximumIterations", "The maximum number of generations which should be processed.", new IntValue(1 000)));103 Parameters.Add(new ValueParameter<IntValue>("SampleSize", "Number of moves that MultiMoveGenerators should create. This is ignored for Exhaustive- and SingleMoveGenerators.", new IntValue(1 00)));117 Parameters.Add(new ValueParameter<IntValue>("MaximumIterations", "The maximum number of generations which should be processed.", new IntValue(150))); 118 Parameters.Add(new ValueParameter<IntValue>("SampleSize", "Number of moves that MultiMoveGenerators should create. This is ignored for Exhaustive- and SingleMoveGenerators.", new IntValue(1500))); 104 119 Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of evaluated moves.")); 105 Parameters.Add(new LookupParameter<IOperator>("Analyzer", "The operator used to analyze the solution."));120 Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the solution.", new MultiAnalyzer())); 106 121 107 122 Initialize(); … … 112 127 } 113 128 114 public void Parameterize(IProblem problem) {129 public void OnProblemChanged(IProblem problem) { 115 130 UpdateMoveOperators(problem); 116 131 ChooseMoveOperators(); … … 119 134 ParameterizeMoveEvaluators(problem as ISingleObjectiveProblem); 120 135 ParameterizeMoveMakers(problem as ISingleObjectiveProblem); 136 137 ParameterizeAnalyzers(problem as ISingleObjectiveProblem); 138 UpdateAnalyzers(problem as ISingleObjectiveProblem); 139 } 140 141 void ParameterizeAnalyzers(ISingleObjectiveProblem problem) { 142 qualityAnalyzer.ResultsParameter.ActualName = "Results"; 143 if (problem != null) { 144 qualityAnalyzer.MaximizationParameter.ActualName = problem.MaximizationParameter.Name; 145 if (MoveEvaluator != null) 146 qualityAnalyzer.QualityParameter.ActualName = MoveEvaluator.MoveQualityParameter.ActualName; 147 qualityAnalyzer.BestKnownQualityParameter.ActualName = problem.BestKnownQualityParameter.Name; 148 } 149 } 150 151 void UpdateAnalyzers(ISingleObjectiveProblem problem) { 152 Analyzer.Operators.Clear(); 153 if (problem != null) { 154 foreach (IAnalyzer analyzer in problem.Operators.OfType<IAnalyzer>()) { 155 IAnalyzer clone = analyzer.Clone() as IAnalyzer; 156 foreach (IScopeTreeLookupParameter param in clone.Parameters.OfType<IScopeTreeLookupParameter>()) 157 param.Depth = 0; 158 Analyzer.Operators.Add(clone); 159 } 160 } 161 Analyzer.Operators.Add(qualityAnalyzer); 121 162 } 122 163 … … 245 286 } 246 287 247 loop.MoveGeneratorParameter.Value = MoveGeneratorParameter.Value;248 if (loop.MoveGeneratorParameter.Value != null && loop.MoveGeneratorParameter.Value.Parameters.ContainsKey("SampleSize")) {249 IParameter parameter = loop.MoveGeneratorParameter.Value.Parameters["SampleSize"];250 if(parameter is IValueParameter)251 (parameter as IValueParameter).Value = SampleSizeParameter.Value;252 }253 loop.MoveEvaluatorParameter.Value = MoveEvaluatorParameter.Value;254 loop.MoveMakerParameter.Value = MoveMakerParameter.Value;255 loop.MaximumIterationsParameter.Value = MaximumIterationsParameter.Value;256 288 loop.EvaluatedMovesParameter.ActualName = EvaluatedSolutionsParameter.ActualName; 257 if (AnalyzerParameter.ActualValue != null) { 258 loop.AnalyzerParameter.Value = AnalyzerParameter.ActualValue.Clone() as IAnalyzer; 259 260 foreach (IScopeTreeLookupParameter param in loop.AnalyzerParameter.Value.Parameters.OfType<IScopeTreeLookupParameter>()) 261 param.Depth = 0; 262 263 if (loop.AnalyzerParameter.Value is IMultiAnalyzer) { 264 foreach (IAnalyzer analyzer in (loop.AnalyzerParameter.Value as IMultiAnalyzer).Operators) { 265 foreach (IScopeTreeLookupParameter param in analyzer.Parameters.OfType<IScopeTreeLookupParameter>()) 266 param.Depth = 0; 267 } 268 } 269 } else { 270 loop.AnalyzerParameter.Value = null; 271 } 272 289 273 290 processor.Operators.Add(loop); 274 291 processor.Successor = remover; … … 279 296 } 280 297 281 return ExecutionContext.Create Operation(processor);298 return ExecutionContext.CreateChildOperation(processor); 282 299 } 283 300 } -
branches/VNS/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearchMainLoop.cs
r5622 r5735 77 77 [StorableConstructor] 78 78 private LocalSearchMainLoop(bool deserializing) : base(deserializing) { } 79 public LocalSearchMainLoop(string iterationsName, string bestQualityName) 80 : base() { 81 Initialize(iterationsName, bestQualityName); 82 } 79 83 public LocalSearchMainLoop() 80 84 : base() { 81 Initialize(false); 82 } 83 public LocalSearchMainLoop(BoolValue nested) 84 : base() { 85 Initialize(nested.Value); 85 Initialize("Iterations", "BestQuality"); 86 86 } 87 87 private LocalSearchMainLoop(LocalSearchMainLoop original, Cloner cloner) … … 92 92 } 93 93 94 private void Initialize( bool nested) {94 private void Initialize(string iterationsName, string bestQualityName) { 95 95 #region Create parameters 96 96 Parameters.Add(new ValueLookupParameter<IRandom>("Random", "A pseudo random number generator.")); 97 97 Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false.")); 98 98 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The value which represents the quality of a solution.")); 99 Parameters.Add(new LookupParameter<DoubleValue>("BestQuality", "The value which represents the best quality fjo.")); 99 100 Parameters.Add(new ValueLookupParameter<DoubleValue>("BestKnownQuality", "The best known quality value found so far.")); 100 101 Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The value which represents the quality of a move.")); … … 128 129 Placeholder moveMaker = new Placeholder(); 129 130 Assigner bestQualityUpdater = new Assigner(); 131 ResultsCollector resultsCollector2 = new ResultsCollector(); 130 132 MergingReducer mergingReducer = new MergingReducer(); 131 133 Placeholder analyzer2 = new Placeholder(); … … 135 137 ConditionalBranch iterationsTermination = new ConditionalBranch(); 136 138 137 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0))); // Class LocalSearch expects this to be called Iterations 138 if (!nested) { 139 variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("BestQuality", new DoubleValue(0))); 140 } 139 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>(iterationsName, new IntValue(0))); // Class LocalSearch expects this to be called Iterations 140 variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>(bestQualityName, new DoubleValue(0))); 141 141 142 142 bestQualityInitializer.Name = "Initialize BestQuality"; 143 bestQualityInitializer.LeftSideParameter.ActualName = "BestQuality";143 bestQualityInitializer.LeftSideParameter.ActualName = bestQualityName; 144 144 bestQualityInitializer.RightSideParameter.ActualName = QualityParameter.Name; 145 145 … … 148 148 149 149 resultsCollector1.CopyValue = new BoolValue(false); 150 resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Iterations")); 151 if (!nested) { 152 resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality")); 153 } 150 resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>(iterationsName)); 151 resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>(bestQualityName, null, bestQualityName)); 154 152 resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name; 155 153 … … 180 178 181 179 bestQualityUpdater.Name = "Update BestQuality"; 182 bestQualityUpdater.LeftSideParameter.ActualName = "BestQuality";180 bestQualityUpdater.LeftSideParameter.ActualName = bestQualityName; 183 181 bestQualityUpdater.RightSideParameter.ActualName = QualityParameter.Name; 182 183 resultsCollector2.CopyValue = new BoolValue(false); 184 resultsCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>(bestQualityName, null, bestQualityName)); 185 resultsCollector2.ResultsParameter.ActualName = ResultsParameter.Name; 184 186 185 187 analyzer2.Name = "Analyzer (placeholder)"; … … 190 192 iterationsCounter.Name = "Iterations Counter"; 191 193 iterationsCounter.Increment = new IntValue(1); 192 iterationsCounter.ValueParameter.ActualName = "Iterations";194 iterationsCounter.ValueParameter.ActualName = iterationsName; 193 195 194 196 iterationsComparator.Name = "Iterations >= MaximumIterations"; 195 197 iterationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual); 196 iterationsComparator.LeftSideParameter.ActualName = "Iterations";198 iterationsComparator.LeftSideParameter.ActualName = iterationsName; 197 199 iterationsComparator.RightSideParameter.ActualName = MaximumIterationsParameter.Name; 198 200 iterationsComparator.ResultParameter.ActualName = "Terminate"; … … 205 207 OperatorGraph.InitialOperator = variableCreator; 206 208 variableCreator.Successor = subScopesProcessor0; 207 if (!nested) { 208 subScopesProcessor0.Operators.Add(bestQualityInitializer); 209 } else { 210 subScopesProcessor0.Operators.Add(analyzer1); 211 } 209 subScopesProcessor0.Operators.Add(bestQualityInitializer); 212 210 subScopesProcessor0.Successor = resultsCollector1; 213 211 bestQualityInitializer.Successor = analyzer1; … … 230 228 improvesQualityBranch.FalseBranch = null; 231 229 improvesQualityBranch.Successor = null; 232 if (!nested) { 233 moveMaker.Successor = bestQualityUpdater; 234 } else { 235 moveMaker.Successor = null; 236 } 230 moveMaker.Successor = bestQualityUpdater; 237 231 bestQualityUpdater.Successor = null; 238 232 mergingReducer.Successor = analyzer2; -
branches/VNS/HeuristicLab.Algorithms.VariableNeighborhoodSearch/3.3/VariableNeighborhoodSearch.cs
r5642 r5735 39 39 get { return (ValueParameter<BoolValue>)Parameters["SetSeedRandomly"]; } 40 40 } 41 private ValueParameter<ILocalImprovement > LocalImprovementParameter {42 get { return (ValueParameter<ILocalImprovement >)Parameters["LocalImprovement"]; }41 private ValueParameter<ILocalImprovementOperator> LocalImprovementParameter { 42 get { return (ValueParameter<ILocalImprovementOperator>)Parameters["LocalImprovement"]; } 43 43 } 44 44 private ValueParameter<IShakingOperator> ShakingParameter { … … 90 90 Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0))); 91 91 Parameters.Add(new ValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true))); 92 Parameters.Add(new ValueParameter<ILocalImprovement >("LocalImprovement", "The local improvement operation", new LocalSearchImprovement()));92 Parameters.Add(new ValueParameter<ILocalImprovementOperator>("LocalImprovement", "The local improvement operation", new LocalSearchImprovementOperator())); 93 93 Parameters.Add(new ValueParameter<IShakingOperator>("Shaking", "The shaking operation")); 94 94 Parameters.Add(new ValueParameter<IntValue>("MaximumIterations", "The maximum number of generations which should be processed.", new IntValue(1000))); … … 215 215 if (Problem != null) { 216 216 foreach (IIterationBasedOperator op in Problem.Operators.OfType<IIterationBasedOperator>()) { 217 op.IterationsParameter.ActualName = " OuterIterations";217 op.IterationsParameter.ActualName = "Iterations"; 218 218 op.MaximumIterationsParameter.ActualName = "MaximumIterations"; 219 219 } … … 267 267 } 268 268 private void UpdateLocalImprovementOperator() { 269 LocalImprovementParameter.Value. Parameterize(Problem);269 LocalImprovementParameter.Value.OnProblemChanged(Problem); 270 270 } 271 271 private void UpdateAnalyzers() { -
branches/VNS/HeuristicLab.Algorithms.VariableNeighborhoodSearch/3.3/VariableNeighborhoodSearchMainLoop.cs
r5642 r5735 69 69 get { return (LookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; } 70 70 } 71 public ValueLookupParameter<ILocalImprovement > LocalImprovementParameter {72 get { return (ValueLookupParameter<ILocalImprovement >)Parameters["LocalImprovement"]; }71 public ValueLookupParameter<ILocalImprovementOperator> LocalImprovementParameter { 72 get { return (ValueLookupParameter<ILocalImprovementOperator>)Parameters["LocalImprovement"]; } 73 73 } 74 74 public ValueLookupParameter<IShakingOperator> ShakingParameter { … … 102 102 Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to analyze the solution.")); 103 103 Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of evaluated solutions.")); 104 Parameters.Add(new ValueLookupParameter<ILocalImprovement >("LocalImprovement", "The local improvement operation."));104 Parameters.Add(new ValueLookupParameter<ILocalImprovementOperator>("LocalImprovement", "The local improvement operation.")); 105 105 Parameters.Add(new ValueLookupParameter<IShakingOperator>("Shaking", "The shaking operation.")); 106 106 #endregion … … 116 116 Assigner iterationInit = new Assigner(); 117 117 118 ChildrenCreator createChild = new ChildrenCreator();118 SubScopesCloner createChild = new SubScopesCloner(); 119 119 SubScopesProcessor childProcessor = new SubScopesProcessor(); 120 ParentCopyCrossover parentCloner = new ParentCopyCrossover();121 120 122 121 Assigner qualityAssigner = new Assigner(); … … 127 126 128 127 QualityComparator qualityComparator = new QualityComparator(); 129 ConditionalBranch improvesQualityBranch = new ConditionalBranch();128 ConditionalBranch improvesQualityBranch1 = new ConditionalBranch(); 130 129 ConditionalBranch improvesQualityBranch2 = new ConditionalBranch(); 131 130 132 131 Assigner bestQualityUpdater = new Assigner(); 133 ScopeCleaner cleaner = new ScopeCleaner(); 134 ParentCopyCrossover originalRestorer = new ParentCopyCrossover(); 132 133 BestSelector bestSelector = new BestSelector(); 134 RightReducer rightReducer = new RightReducer(); 135 135 136 136 IntCounter indexCounter = new IntCounter(); 137 137 Assigner indexResetter = new Assigner(); 138 138 139 SubScopesRemover remover1 = new SubScopesRemover();140 SubScopesRemover remover2 = new SubScopesRemover();141 139 Placeholder analyzer2 = new Placeholder(); 142 140 … … 147 145 ConditionalBranch iterationsTermination = new ConditionalBranch(); 148 146 149 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>(" OuterIterations", new IntValue(0)));147 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0))); 150 148 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Index", new IntValue(0))); 151 149 variableCreator.CollectedValues.Add(new ValueParameter<BoolValue>("Continue", new BoolValue(false))); … … 161 159 162 160 resultsCollector1.CopyValue = new BoolValue(false); 163 resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>(" OuterIterations"));161 resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Iterations")); 164 162 resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality")); 165 163 resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name; … … 172 170 173 171 createChild.Name = "Create child"; 174 createChild.ParentsPerChild.Value = 1;175 176 parentCloner.Name = "Copy parent";177 172 178 173 qualityAssigner.Name = "Assign quality"; … … 189 184 evaluator.OperatorParameter.ActualName = EvaluatorParameter.Name; 190 185 191 evalCounter.Name = "Count evaluat eions";186 evalCounter.Name = "Count evaluations"; 192 187 evalCounter.Increment.Value = 1; 193 188 evalCounter.ValueParameter.ActualName = EvaluatedSolutionsParameter.ActualName; … … 197 192 qualityComparator.ResultParameter.ActualName = "IsBetter"; 198 193 199 improvesQualityBranch .ConditionParameter.ActualName = "IsBetter";194 improvesQualityBranch1.ConditionParameter.ActualName = "IsBetter"; 200 195 improvesQualityBranch2.ConditionParameter.ActualName = "IsBetter"; 201 196 … … 204 199 bestQualityUpdater.RightSideParameter.ActualName = QualityParameter.Name; 205 200 206 cleaner.Name = "Clean scope"; 207 cleaner.ClearSubScopesParameter.Value = new BoolValue(false); 208 originalRestorer.Name = "Restore original solution"; 201 bestSelector.CopySelected = new BoolValue(false); 202 bestSelector.MaximizationParameter.ActualName = MaximizationParameter.Name; 203 bestSelector.NumberOfSelectedSubScopesParameter.Value = new IntValue(1); 204 bestSelector.QualityParameter.ActualName = QualityParameter.Name; 209 205 210 206 indexCounter.Name = "Count index"; … … 216 212 indexResetter.RightSideParameter.Value = new IntValue(0); 217 213 218 remover1.Name = remover2.Name = "Remove subscope";219 220 214 analyzer2.Name = "Analyzer (placeholder)"; 221 215 analyzer2.OperatorParameter.ActualName = AnalyzerParameter.Name; 222 216 223 originalRestorer.Name = "Restore parent";224 225 217 iterationsCounter.Name = "Iterations Counter"; 226 218 iterationsCounter.Increment = new IntValue(1); 227 iterationsCounter.ValueParameter.ActualName = " OuterIterations";219 iterationsCounter.ValueParameter.ActualName = "Iterations"; 228 220 229 221 iterationsComparator.Name = "Iterations >= MaximumIterations"; 230 222 iterationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual); 231 iterationsComparator.LeftSideParameter.ActualName = " OuterIterations";223 iterationsComparator.LeftSideParameter.ActualName = "Iterations"; 232 224 iterationsComparator.RightSideParameter.ActualName = MaximumIterationsParameter.Name; 233 225 iterationsComparator.ResultParameter.ActualName = "Terminate"; … … 254 246 255 247 createChild.Successor = childProcessor; 256 childProcessor.Operators.Add(parentCloner); 257 childProcessor.Successor = analyzer2; 248 childProcessor.Operators.Add(new EmptyOperator()); 249 childProcessor.Operators.Add(qualityAssigner); 250 childProcessor.Successor = bestSelector; 258 251 ///////// 259 parentCloner.Successor = qualityAssigner;260 252 qualityAssigner.Successor = shaking; 261 253 shaking.Successor = evaluator; … … 263 255 evalCounter.Successor = localImprovement; 264 256 localImprovement.Successor = qualityComparator; 265 qualityComparator.Successor = improvesQualityBranch ;266 improvesQualityBranch .TrueBranch = bestQualityUpdater;267 improvesQualityBranch .FalseBranch = cleaner;257 qualityComparator.Successor = improvesQualityBranch1; 258 improvesQualityBranch1.TrueBranch = bestQualityUpdater; 259 improvesQualityBranch1.FalseBranch = indexCounter; 268 260 269 261 bestQualityUpdater.Successor = indexResetter; 270 indexResetter.Successor = remover1; 271 272 cleaner.Successor = originalRestorer; 273 originalRestorer.Successor = remover2; 274 remover2.Successor = indexCounter; 262 indexResetter.Successor = null; 263 264 indexCounter.Successor = null; 275 265 ///////// 266 bestSelector.Successor = rightReducer; 267 rightReducer.Successor = analyzer2; 276 268 analyzer2.Successor = indexTermination; 277 269 indexTermination.TrueBranch = improvesQualityBranch2; -
branches/VNS/HeuristicLab.Operators/3.3/HeuristicLab.Operators-3.3.csproj
r5351 r5735 124 124 <SubType>Code</SubType> 125 125 </Compile> 126 <Compile Include="SubScopesCloner.cs" /> 126 127 <Compile Include="SubScopesCounter.cs" /> 127 128 <Compile Include="SubScopesCreator.cs" /> -
branches/VNS/HeuristicLab.Operators/3.3/ScopeCleaner.cs
r5609 r5735 39 39 get { return CurrentScopeParameter.ActualValue; } 40 40 } 41 public ValueParameter<BoolValue> ClearSubScopesParameter {42 get { return (ValueParameter<BoolValue>)Parameters["ClearSubScopes"]; }43 }44 45 [StorableHook(HookType.AfterDeserialization)]46 private void AfterDeserializationHook() {47 #region Backwards Compatibility48 if (!Parameters.ContainsKey("ClearSubScopes")) {49 Parameters.Add(new ValueParameter<BoolValue>("ClearSubScopes", "Indicates, if the subscopes should be cleared.", new BoolValue(false)));50 }51 #endregion52 }53 41 54 42 [StorableConstructor] … … 58 46 } 59 47 public ScopeCleaner() 60 : base() { 48 : base() { 61 49 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope whose variables and sub-scopes should be removed.")); 62 Parameters.Add(new ValueParameter<BoolValue>("ClearSubScopes", "Indicates, if the subscopes should be cleared.", new BoolValue(false)));63 50 } 64 51 … … 69 56 public override IOperation Apply() { 70 57 CurrentScope.Variables.Clear(); 71 if(ClearSubScopesParameter.Value.Value) 72 CurrentScope.SubScopes.Clear(); 58 CurrentScope.SubScopes.Clear(); 73 59 return base.Apply(); 74 60 } -
branches/VNS/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
r5622 r5735 116 116 <Compile Include="Interfaces\IDiscreteDoubleMatrixModifier.cs" /> 117 117 <Compile Include="Interfaces\IGlobalParticleUpdater.cs" /> 118 <Compile Include="Interfaces\ILocalImprovement .cs" />118 <Compile Include="Interfaces\ILocalImprovementOperator.cs" /> 119 119 <Compile Include="Interfaces\ILocalParticleUpdater.cs" /> 120 120 <Compile Include="Interfaces\IMultiAnalyzer.cs" /> -
branches/VNS/HeuristicLab.Optimization/3.3/Interfaces/ILocalImprovementOperator.cs
r5725 r5735 28 28 29 29 namespace HeuristicLab.Optimization { 30 public interface ILocalImprovement : IOperator {31 void Parameterize(IProblem problem);30 public interface ILocalImprovementOperator: IOperator { 31 void OnProblemChanged(IProblem problem); 32 32 } 33 33 }
Note: See TracChangeset
for help on using the changeset viewer.