Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/07/11 17:23:04 (13 years ago)
Author:
svonolfe
Message:

Worked on VNS (#1425)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/VNS/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearchMainLoop.cs

    r5445 r5622  
    7979    public LocalSearchMainLoop()
    8080      : base() {
    81       Initialize();
     81      Initialize(false);
     82    }
     83    public LocalSearchMainLoop(BoolValue nested)
     84      : base() {
     85      Initialize(nested.Value);
    8286    }
    8387    private LocalSearchMainLoop(LocalSearchMainLoop original, Cloner cloner)
     
    8892    }
    8993
    90     private void Initialize() {
     94    private void Initialize(bool nested) {
    9195      #region Create parameters
    9296      Parameters.Add(new ValueLookupParameter<IRandom>("Random", "A pseudo random number generator."));
     
    132136
    133137      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0))); // Class LocalSearch expects this to be called Iterations
    134       variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("BestQuality", new DoubleValue(0)));
     138      if (!nested) {
     139        variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("BestQuality", new DoubleValue(0)));
     140      }
    135141
    136142      bestQualityInitializer.Name = "Initialize BestQuality";
     
    143149      resultsCollector1.CopyValue = new BoolValue(false);
    144150      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
    145       resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
     151      if (!nested) {
     152        resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
     153      }
    146154      resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;
    147155
     
    197205      OperatorGraph.InitialOperator = variableCreator;
    198206      variableCreator.Successor = subScopesProcessor0;
    199       subScopesProcessor0.Operators.Add(bestQualityInitializer);
     207      if (!nested) {
     208        subScopesProcessor0.Operators.Add(bestQualityInitializer);
     209      } else {
     210        subScopesProcessor0.Operators.Add(analyzer1);
     211      }
    200212      subScopesProcessor0.Successor = resultsCollector1;
    201213      bestQualityInitializer.Successor = analyzer1;
     
    218230      improvesQualityBranch.FalseBranch = null;
    219231      improvesQualityBranch.Successor = null;
    220       moveMaker.Successor = bestQualityUpdater;
     232      if (!nested) {
     233        moveMaker.Successor = bestQualityUpdater;
     234      } else {
     235        moveMaker.Successor = null;
     236      }
    221237      bestQualityUpdater.Successor = null;
    222238      mergingReducer.Successor = analyzer2;
Note: See TracChangeset for help on using the changeset viewer.