Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/22/11 16:45:46 (13 years ago)
Author:
mkommend
Message:

#1418: Merged trunk changes into branch.

File:
1 edited

Legend:

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

    r5445 r5796  
    4646      get { return (LookupParameter<DoubleValue>)Parameters["Quality"]; }
    4747    }
     48    public LookupParameter<DoubleValue> BestQualityParameter {
     49      get { return (LookupParameter<DoubleValue>)Parameters["BestLocalQuality"]; }
     50    }
    4851    public ValueLookupParameter<DoubleValue> BestKnownQualityParameter {
    4952      get { return (ValueLookupParameter<DoubleValue>)Parameters["BestKnownQuality"]; }
     
    5154    public LookupParameter<DoubleValue> MoveQualityParameter {
    5255      get { return (LookupParameter<DoubleValue>)Parameters["MoveQuality"]; }
     56    }
     57    public LookupParameter<IntValue> IterationsParameter {
     58      get { return (LookupParameter<IntValue>)Parameters["LocalIterations"]; }
    5359    }
    5460    public ValueLookupParameter<IntValue> MaximumIterationsParameter {
     
    7985    public LocalSearchMainLoop()
    8086      : base() {
    81       Initialize();
     87        Initialize();
    8288    }
    8389    private LocalSearchMainLoop(LocalSearchMainLoop original, Cloner cloner)
     
    9399      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
    94100      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The value which represents the quality of a solution."));
     101      Parameters.Add(new LookupParameter<DoubleValue>("BestLocalQuality", "The value which represents the best quality found so far."));
    95102      Parameters.Add(new ValueLookupParameter<DoubleValue>("BestKnownQuality", "The best known quality value found so far."));
    96103      Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The value which represents the quality of a move."));
     104      Parameters.Add(new LookupParameter<IntValue>("LocalIterations", "The number of generations."));
    97105      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations", "The maximum number of generations which should be processed."));
    98106      Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored."));
     
    107115
    108116      #region Create operators
    109       VariableCreator variableCreator = new VariableCreator();
    110117      SubScopesProcessor subScopesProcessor0 = new SubScopesProcessor();
    111118      Assigner bestQualityInitializer = new Assigner();
     
    124131      Placeholder moveMaker = new Placeholder();
    125132      Assigner bestQualityUpdater = new Assigner();
     133      ResultsCollector resultsCollector2 = new ResultsCollector();
    126134      MergingReducer mergingReducer = new MergingReducer();
    127135      Placeholder analyzer2 = new Placeholder();
     
    131139      ConditionalBranch iterationsTermination = new ConditionalBranch();
    132140
    133       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)));
    135 
    136141      bestQualityInitializer.Name = "Initialize BestQuality";
    137       bestQualityInitializer.LeftSideParameter.ActualName = "BestQuality";
     142      bestQualityInitializer.LeftSideParameter.ActualName = BestQualityParameter.Name;
    138143      bestQualityInitializer.RightSideParameter.ActualName = QualityParameter.Name;
    139144
     
    142147
    143148      resultsCollector1.CopyValue = new BoolValue(false);
    144       resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
    145       resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
     149      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>(IterationsParameter.Name));
     150      resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>(BestQualityParameter.Name, null, BestQualityParameter.Name));
    146151      resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;
    147152
     
    172177
    173178      bestQualityUpdater.Name = "Update BestQuality";
    174       bestQualityUpdater.LeftSideParameter.ActualName = "BestQuality";
     179      bestQualityUpdater.LeftSideParameter.ActualName = BestQualityParameter.Name;
    175180      bestQualityUpdater.RightSideParameter.ActualName = QualityParameter.Name;
     181
     182      resultsCollector2.CopyValue = new BoolValue(false);
     183      resultsCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>(BestQualityParameter.Name, null, BestQualityParameter.Name));
     184      resultsCollector2.ResultsParameter.ActualName = ResultsParameter.Name;
    176185
    177186      analyzer2.Name = "Analyzer (placeholder)";
     
    182191      iterationsCounter.Name = "Iterations Counter";
    183192      iterationsCounter.Increment = new IntValue(1);
    184       iterationsCounter.ValueParameter.ActualName = "Iterations";
     193      iterationsCounter.ValueParameter.ActualName = IterationsParameter.Name;
    185194
    186195      iterationsComparator.Name = "Iterations >= MaximumIterations";
    187196      iterationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
    188       iterationsComparator.LeftSideParameter.ActualName = "Iterations";
     197      iterationsComparator.LeftSideParameter.ActualName = IterationsParameter.Name;
    189198      iterationsComparator.RightSideParameter.ActualName = MaximumIterationsParameter.Name;
    190199      iterationsComparator.ResultParameter.ActualName = "Terminate";
     
    195204
    196205      #region Create operator graph
    197       OperatorGraph.InitialOperator = variableCreator;
    198       variableCreator.Successor = subScopesProcessor0;
     206      OperatorGraph.InitialOperator = subScopesProcessor0;
    199207      subScopesProcessor0.Operators.Add(bestQualityInitializer);
    200208      subScopesProcessor0.Successor = resultsCollector1;
Note: See TracChangeset for help on using the changeset viewer.