Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5735


Ignore:
Timestamp:
03/17/11 14:35:58 (14 years ago)
Author:
svonolfe
Message:

Implemented review comments of swagner (#1425)

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  
    108108  <ItemGroup>
    109109    <Compile Include="HeuristicLabAlgorithmsLocalSearchPlugin.cs" />
    110     <Compile Include="LocalSearchImprovement.cs" />
     110    <Compile Include="LocalSearchImprovementOperator.cs" />
    111111    <Compile Include="LocalSearchMainLoop.cs" />
    112112    <Compile Include="Properties\AssemblyInfo.cs" />
  • branches/VNS/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearchImprovementOperator.cs

    r5725 r5735  
    3333using HeuristicLab.Optimization;
    3434using HeuristicLab.Optimization.Operators;
     35using HeuristicLab.Analysis;
    3536
    3637namespace HeuristicLab.Algorithms.LocalSearch {
     
    3839  /// A local search improvement operator.
    3940  /// </summary>
    40   [Item("LocalSearchImprovement", "A local search improvement operator.")]
     41  [Item("LocalSearchImprovementOperator", "A local search improvement operator.")]
    4142  [StorableClass]
    42   public class LocalSearchImprovement: SingleSuccessorOperator, ILocalImprovement {
     43  public class LocalSearchImprovementOperator: SingleSuccessorOperator, ILocalImprovementOperator {
    4344    [Storable]
    4445    private LocalSearchMainLoop loop;
     46
     47    [Storable]
     48    private BestAverageWorstQualityAnalyzer qualityAnalyzer;
    4549   
    4650    private ConstrainedValueParameter<IMoveGenerator> MoveGeneratorParameter {
     
    6266      get { return (LookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; }
    6367    }
    64     public LookupParameter<IOperator> AnalyzerParameter {
    65       get { return (LookupParameter<IOperator>)Parameters["Analyzer"]; }
     68    public ValueParameter<MultiAnalyzer> AnalyzerParameter {
     69      get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
    6670    }
    6771
     
    7882      set { MoveEvaluatorParameter.Value = value; }
    7983    }
     84    public MultiAnalyzer Analyzer {
     85      get { return AnalyzerParameter.Value; }
     86      set { AnalyzerParameter.Value = value; }
     87    }
    8088
    8189    [StorableConstructor]
    82     protected LocalSearchImprovement(bool deserializing) : base(deserializing) {}
     90    protected LocalSearchImprovementOperator(bool deserializing) : base(deserializing) {}
    8391    [StorableHook(HookType.AfterDeserialization)]
    8492    private void AfterDeserialization() {
    8593      Initialize();
    8694    }
    87     protected LocalSearchImprovement(LocalSearchImprovement original, Cloner cloner)
     95    protected LocalSearchImprovementOperator(LocalSearchImprovementOperator original, Cloner cloner)
    8896      : base(original, cloner) {
    8997        this.loop = cloner.Clone(original.loop);
     98        this.qualityAnalyzer = cloner.Clone(original.qualityAnalyzer);
    9099        Initialize();
    91100    }
    92101    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()
    96105      : 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();
    98113
    99114        Parameters.Add(new ConstrainedValueParameter<IMoveGenerator>("MoveGenerator", "The operator used to generate moves to the neighborhood of the current solution."));
    100115        Parameters.Add(new ConstrainedValueParameter<IMoveMaker>("MoveMaker", "The operator used to perform a move."));
    101116        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(1000)));
    103         Parameters.Add(new ValueParameter<IntValue>("SampleSize", "Number of moves that MultiMoveGenerators should create. This is ignored for Exhaustive- and SingleMoveGenerators.", new IntValue(100)));
     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)));
    104119        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()));
    106121
    107122        Initialize();
     
    112127    }
    113128
    114     public void Parameterize(IProblem problem) {
     129    public void OnProblemChanged(IProblem problem) {
    115130      UpdateMoveOperators(problem);
    116131      ChooseMoveOperators();
     
    119134      ParameterizeMoveEvaluators(problem as ISingleObjectiveProblem);
    120135      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);
    121162    }
    122163
     
    245286      }
    246287
    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;
    256288      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
    273290      processor.Operators.Add(loop);
    274291      processor.Successor = remover;
     
    279296      }
    280297
    281       return ExecutionContext.CreateOperation(processor);
     298      return ExecutionContext.CreateChildOperation(processor);
    282299    }
    283300  }
  • branches/VNS/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearchMainLoop.cs

    r5622 r5735  
    7777    [StorableConstructor]
    7878    private LocalSearchMainLoop(bool deserializing) : base(deserializing) { }
     79    public LocalSearchMainLoop(string iterationsName, string bestQualityName)
     80      : base() {
     81        Initialize(iterationsName, bestQualityName);
     82    }
    7983    public LocalSearchMainLoop()
    8084      : base() {
    81       Initialize(false);
    82     }
    83     public LocalSearchMainLoop(BoolValue nested)
    84       : base() {
    85       Initialize(nested.Value);
     85      Initialize("Iterations", "BestQuality");
    8686    }
    8787    private LocalSearchMainLoop(LocalSearchMainLoop original, Cloner cloner)
     
    9292    }
    9393
    94     private void Initialize(bool nested) {
     94    private void Initialize(string iterationsName, string bestQualityName) {
    9595      #region Create parameters
    9696      Parameters.Add(new ValueLookupParameter<IRandom>("Random", "A pseudo random number generator."));
    9797      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
    9898      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."));
    99100      Parameters.Add(new ValueLookupParameter<DoubleValue>("BestKnownQuality", "The best known quality value found so far."));
    100101      Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The value which represents the quality of a move."));
     
    128129      Placeholder moveMaker = new Placeholder();
    129130      Assigner bestQualityUpdater = new Assigner();
     131      ResultsCollector resultsCollector2 = new ResultsCollector();
    130132      MergingReducer mergingReducer = new MergingReducer();
    131133      Placeholder analyzer2 = new Placeholder();
     
    135137      ConditionalBranch iterationsTermination = new ConditionalBranch();
    136138
    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)));
    141141
    142142      bestQualityInitializer.Name = "Initialize BestQuality";
    143       bestQualityInitializer.LeftSideParameter.ActualName = "BestQuality";
     143      bestQualityInitializer.LeftSideParameter.ActualName = bestQualityName;
    144144      bestQualityInitializer.RightSideParameter.ActualName = QualityParameter.Name;
    145145
     
    148148
    149149      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));
    154152      resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;
    155153
     
    180178
    181179      bestQualityUpdater.Name = "Update BestQuality";
    182       bestQualityUpdater.LeftSideParameter.ActualName = "BestQuality";
     180      bestQualityUpdater.LeftSideParameter.ActualName = bestQualityName;
    183181      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;
    184186
    185187      analyzer2.Name = "Analyzer (placeholder)";
     
    190192      iterationsCounter.Name = "Iterations Counter";
    191193      iterationsCounter.Increment = new IntValue(1);
    192       iterationsCounter.ValueParameter.ActualName = "Iterations";
     194      iterationsCounter.ValueParameter.ActualName = iterationsName;
    193195
    194196      iterationsComparator.Name = "Iterations >= MaximumIterations";
    195197      iterationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
    196       iterationsComparator.LeftSideParameter.ActualName = "Iterations";
     198      iterationsComparator.LeftSideParameter.ActualName = iterationsName;
    197199      iterationsComparator.RightSideParameter.ActualName = MaximumIterationsParameter.Name;
    198200      iterationsComparator.ResultParameter.ActualName = "Terminate";
     
    205207      OperatorGraph.InitialOperator = variableCreator;
    206208      variableCreator.Successor = subScopesProcessor0;
    207       if (!nested) {
    208         subScopesProcessor0.Operators.Add(bestQualityInitializer);
    209       } else {
    210         subScopesProcessor0.Operators.Add(analyzer1);
    211       }
     209      subScopesProcessor0.Operators.Add(bestQualityInitializer);
    212210      subScopesProcessor0.Successor = resultsCollector1;
    213211      bestQualityInitializer.Successor = analyzer1;
     
    230228      improvesQualityBranch.FalseBranch = null;
    231229      improvesQualityBranch.Successor = null;
    232       if (!nested) {
    233         moveMaker.Successor = bestQualityUpdater;
    234       } else {
    235         moveMaker.Successor = null;
    236       }
     230      moveMaker.Successor = bestQualityUpdater;
    237231      bestQualityUpdater.Successor = null;
    238232      mergingReducer.Successor = analyzer2;
  • branches/VNS/HeuristicLab.Algorithms.VariableNeighborhoodSearch/3.3/VariableNeighborhoodSearch.cs

    r5642 r5735  
    3939      get { return (ValueParameter<BoolValue>)Parameters["SetSeedRandomly"]; }
    4040    }
    41     private ValueParameter<ILocalImprovement> LocalImprovementParameter {
    42       get { return (ValueParameter<ILocalImprovement>)Parameters["LocalImprovement"]; }
     41    private ValueParameter<ILocalImprovementOperator> LocalImprovementParameter {
     42      get { return (ValueParameter<ILocalImprovementOperator>)Parameters["LocalImprovement"]; }
    4343    }
    4444    private ValueParameter<IShakingOperator> ShakingParameter {
     
    9090      Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
    9191      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()));
    9393      Parameters.Add(new ValueParameter<IShakingOperator>("Shaking", "The shaking operation"));
    9494      Parameters.Add(new ValueParameter<IntValue>("MaximumIterations", "The maximum number of generations which should be processed.", new IntValue(1000)));
     
    215215      if (Problem != null) {
    216216        foreach (IIterationBasedOperator op in Problem.Operators.OfType<IIterationBasedOperator>()) {
    217           op.IterationsParameter.ActualName = "OuterIterations";
     217          op.IterationsParameter.ActualName = "Iterations";
    218218          op.MaximumIterationsParameter.ActualName = "MaximumIterations";
    219219        }
     
    267267    }
    268268    private void UpdateLocalImprovementOperator() {
    269       LocalImprovementParameter.Value.Parameterize(Problem);
     269      LocalImprovementParameter.Value.OnProblemChanged(Problem);
    270270    }
    271271    private void UpdateAnalyzers() {
  • branches/VNS/HeuristicLab.Algorithms.VariableNeighborhoodSearch/3.3/VariableNeighborhoodSearchMainLoop.cs

    r5642 r5735  
    6969      get { return (LookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; }
    7070    }
    71     public ValueLookupParameter<ILocalImprovement> LocalImprovementParameter {
    72       get { return (ValueLookupParameter<ILocalImprovement>)Parameters["LocalImprovement"]; }
     71    public ValueLookupParameter<ILocalImprovementOperator> LocalImprovementParameter {
     72      get { return (ValueLookupParameter<ILocalImprovementOperator>)Parameters["LocalImprovement"]; }
    7373    }
    7474    public ValueLookupParameter<IShakingOperator> ShakingParameter {
     
    102102      Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to analyze the solution."));
    103103      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."));
    105105      Parameters.Add(new ValueLookupParameter<IShakingOperator>("Shaking", "The shaking operation."));
    106106      #endregion
     
    116116      Assigner iterationInit = new Assigner();
    117117
    118       ChildrenCreator createChild = new ChildrenCreator();
     118      SubScopesCloner createChild = new SubScopesCloner();
    119119      SubScopesProcessor childProcessor = new SubScopesProcessor();
    120       ParentCopyCrossover parentCloner = new ParentCopyCrossover();
    121120
    122121      Assigner qualityAssigner = new Assigner();
     
    127126
    128127      QualityComparator qualityComparator = new QualityComparator();
    129       ConditionalBranch improvesQualityBranch = new ConditionalBranch();
     128      ConditionalBranch improvesQualityBranch1 = new ConditionalBranch();
    130129      ConditionalBranch improvesQualityBranch2 = new ConditionalBranch();
    131130
    132131      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();
    135135
    136136      IntCounter indexCounter = new IntCounter();
    137137      Assigner indexResetter = new Assigner();
    138138
    139       SubScopesRemover remover1 = new SubScopesRemover();
    140       SubScopesRemover remover2 = new SubScopesRemover();
    141139      Placeholder analyzer2 = new Placeholder();
    142140
     
    147145      ConditionalBranch iterationsTermination = new ConditionalBranch();
    148146
    149       variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("OuterIterations", new IntValue(0)));
     147      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0)));
    150148      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Index", new IntValue(0)));
    151149      variableCreator.CollectedValues.Add(new ValueParameter<BoolValue>("Continue", new BoolValue(false)));
     
    161159
    162160      resultsCollector1.CopyValue = new BoolValue(false);
    163       resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("OuterIterations"));
     161      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
    164162      resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
    165163      resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;
     
    172170
    173171      createChild.Name = "Create child";
    174       createChild.ParentsPerChild.Value = 1;
    175 
    176       parentCloner.Name = "Copy parent";
    177172
    178173      qualityAssigner.Name = "Assign quality";
     
    189184      evaluator.OperatorParameter.ActualName = EvaluatorParameter.Name;
    190185
    191       evalCounter.Name = "Count evaluateions";
     186      evalCounter.Name = "Count evaluations";
    192187      evalCounter.Increment.Value = 1;
    193188      evalCounter.ValueParameter.ActualName = EvaluatedSolutionsParameter.ActualName;
     
    197192      qualityComparator.ResultParameter.ActualName = "IsBetter";
    198193
    199       improvesQualityBranch.ConditionParameter.ActualName = "IsBetter";
     194      improvesQualityBranch1.ConditionParameter.ActualName = "IsBetter";
    200195      improvesQualityBranch2.ConditionParameter.ActualName = "IsBetter";
    201196
     
    204199      bestQualityUpdater.RightSideParameter.ActualName = QualityParameter.Name;
    205200
    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;
    209205
    210206      indexCounter.Name = "Count index";
     
    216212      indexResetter.RightSideParameter.Value = new IntValue(0);
    217213
    218       remover1.Name = remover2.Name = "Remove subscope";
    219 
    220214      analyzer2.Name = "Analyzer (placeholder)";
    221215      analyzer2.OperatorParameter.ActualName = AnalyzerParameter.Name;
    222216
    223       originalRestorer.Name = "Restore parent";
    224 
    225217      iterationsCounter.Name = "Iterations Counter";
    226218      iterationsCounter.Increment = new IntValue(1);
    227       iterationsCounter.ValueParameter.ActualName = "OuterIterations";
     219      iterationsCounter.ValueParameter.ActualName = "Iterations";
    228220
    229221      iterationsComparator.Name = "Iterations >= MaximumIterations";
    230222      iterationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
    231       iterationsComparator.LeftSideParameter.ActualName = "OuterIterations";
     223      iterationsComparator.LeftSideParameter.ActualName = "Iterations";
    232224      iterationsComparator.RightSideParameter.ActualName = MaximumIterationsParameter.Name;
    233225      iterationsComparator.ResultParameter.ActualName = "Terminate";
     
    254246
    255247      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;
    258251      /////////
    259       parentCloner.Successor = qualityAssigner;
    260252      qualityAssigner.Successor = shaking;
    261253      shaking.Successor = evaluator;
     
    263255      evalCounter.Successor = localImprovement;
    264256      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;
    268260
    269261      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;
    275265      /////////
     266      bestSelector.Successor = rightReducer;
     267      rightReducer.Successor = analyzer2;
    276268      analyzer2.Successor = indexTermination;
    277269      indexTermination.TrueBranch = improvesQualityBranch2;
  • branches/VNS/HeuristicLab.Operators/3.3/HeuristicLab.Operators-3.3.csproj

    r5351 r5735  
    124124      <SubType>Code</SubType>
    125125    </Compile>
     126    <Compile Include="SubScopesCloner.cs" />
    126127    <Compile Include="SubScopesCounter.cs" />
    127128    <Compile Include="SubScopesCreator.cs" />
  • branches/VNS/HeuristicLab.Operators/3.3/ScopeCleaner.cs

    r5609 r5735  
    3939      get { return CurrentScopeParameter.ActualValue; }
    4040    }
    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 Compatibility
    48       if (!Parameters.ContainsKey("ClearSubScopes")) {
    49         Parameters.Add(new ValueParameter<BoolValue>("ClearSubScopes", "Indicates, if the subscopes should be cleared.", new BoolValue(false)));
    50       }
    51       #endregion
    52     }
    5341
    5442    [StorableConstructor]
     
    5846    }
    5947    public ScopeCleaner()
    60       : base() {
     48      : base() { 
    6149      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)));
    6350    }
    6451
     
    6956    public override IOperation Apply() {
    7057      CurrentScope.Variables.Clear();
    71       if(ClearSubScopesParameter.Value.Value)
    72         CurrentScope.SubScopes.Clear();
     58      CurrentScope.SubScopes.Clear();
    7359      return base.Apply();
    7460    }
  • branches/VNS/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj

    r5622 r5735  
    116116    <Compile Include="Interfaces\IDiscreteDoubleMatrixModifier.cs" />
    117117    <Compile Include="Interfaces\IGlobalParticleUpdater.cs" />
    118     <Compile Include="Interfaces\ILocalImprovement.cs" />
     118    <Compile Include="Interfaces\ILocalImprovementOperator.cs" />
    119119    <Compile Include="Interfaces\ILocalParticleUpdater.cs" />
    120120    <Compile Include="Interfaces\IMultiAnalyzer.cs" />
  • branches/VNS/HeuristicLab.Optimization/3.3/Interfaces/ILocalImprovementOperator.cs

    r5725 r5735  
    2828
    2929namespace HeuristicLab.Optimization {
    30   public interface ILocalImprovement: IOperator {
    31     void Parameterize(IProblem problem);
     30  public interface ILocalImprovementOperator: IOperator {
     31    void OnProblemChanged(IProblem problem);
    3232  }
    3333}
Note: See TracChangeset for help on using the changeset viewer.