Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8016


Ignore:
Timestamp:
06/17/12 00:58:19 (12 years ago)
Author:
abeham
Message:

#1828:

  • Added a SingleValueAnalyzer to HeuristicLab.Analysis
    • The ValueAnalyzer was not usable without changing the operator graph, it has a ScopeTreeLookupParameter and is only suitable to analyze values of children
    • I think we need an analyzer like this anyway so I implemented it and named it SingleValueAnalyzer
  • Added that to SA and parameterized accordingly
Location:
trunk/sources
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealing.cs

    r7999 r8016  
    144144    [Storable]
    145145    private QualityAnalyzer qualityAnalyzer;
     146    [Storable]
     147    private SingleValueAnalyzer temperatureAnalyzer;
    146148    #endregion
    147149
     
    150152    [StorableHook(HookType.AfterDeserialization)]
    151153    private void AfterDeserialization() {
     154      if (temperatureAnalyzer == null) {
     155        temperatureAnalyzer = new SingleValueAnalyzer();
     156        temperatureAnalyzer.Name = "TemperatureAnalyzer";
     157        temperatureAnalyzer.ResultsParameter.ActualName = "Results";
     158        temperatureAnalyzer.ValueParameter.ActualName = "Temperature";
     159        temperatureAnalyzer.ValuesParameter.ActualName = "Temperature Chart";
     160        Analyzer.Operators.Add(temperatureAnalyzer);
     161      }
    152162      Initialize();
    153163    }
     
    155165      : base(original, cloner) {
    156166      qualityAnalyzer = cloner.Clone(original.qualityAnalyzer);
     167      temperatureAnalyzer = cloner.Clone(original.temperatureAnalyzer);
    157168      Initialize();
    158169    }
     
    205216      mainLoop.AnnealingOperatorParameter.ActualName = AnnealingOperatorParameter.Name;
    206217      mainLoop.MaximumIterationsParameter.ActualName = MaximumIterationsParameter.Name;
     218      mainLoop.TemperatureParameter.ActualName = "Temperature";
    207219      mainLoop.StartTemperatureParameter.ActualName = StartTemperatureParameter.Name;
    208220      mainLoop.EndTemperatureParameter.ActualName = EndTemperatureParameter.Name;
     
    218230
    219231      qualityAnalyzer = new QualityAnalyzer();
     232      temperatureAnalyzer = new SingleValueAnalyzer();
     233      temperatureAnalyzer.Name = "TemperatureAnalyzer";
    220234      ParameterizeAnalyzers();
    221235      UpdateAnalyzers();
     
    348362        qualityAnalyzer.QualityParameter.Hidden = false;
    349363        qualityAnalyzer.BestKnownQualityParameter.Hidden = false;
     364        temperatureAnalyzer.ResultsParameter.ActualName = "Results";
     365        temperatureAnalyzer.ValueParameter.ActualName = "Temperature";
     366        temperatureAnalyzer.ValuesParameter.ActualName = "Temperature Chart";
    350367      }
    351368    }
     
    470487      }
    471488      Analyzer.Operators.Add(qualityAnalyzer, qualityAnalyzer.EnabledByDefault);
     489      Analyzer.Operators.Add(temperatureAnalyzer, temperatureAnalyzer.EnabledByDefault);
    472490    }
    473491    private SimulatedAnnealingMainLoop FindMainLoop(IOperator start) {
  • trunk/sources/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealingMainLoop.cs

    r7259 r8016  
    5151      get { return (LookupParameter<DoubleValue>)Parameters["MoveQuality"]; }
    5252    }
     53    public ILookupParameter<DoubleValue> TemperatureParameter {
     54      get { return (ILookupParameter<DoubleValue>)Parameters["Temperature"]; }
     55    }
    5356    public ValueLookupParameter<DoubleValue> StartTemperatureParameter {
    5457      get { return (ValueLookupParameter<DoubleValue>)Parameters["StartTemperature"]; }
     
    109112      Parameters.Add(new ValueLookupParameter<DoubleValue>("BestKnownQuality", "The best known quality value found so far."));
    110113      Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The value which represents the quality of a move."));
     114      Parameters.Add(new LookupParameter<DoubleValue>("Temperature", "The current temperature."));
    111115      Parameters.Add(new ValueLookupParameter<DoubleValue>("StartTemperature", "The initial temperature."));
    112116      Parameters.Add(new ValueLookupParameter<DoubleValue>("EndTemperature", "The end temperature."));
     
    126130
    127131      #region Create operators
    128       VariableCreator variableCreator = new VariableCreator();
     132      Assigner temperatureInitializer = new Assigner();
    129133      ResultsCollector resultsCollector1 = new ResultsCollector();
    130134      SubScopesProcessor subScopesProcessor0 = new SubScopesProcessor();
     
    148152      ConditionalBranch iterationsTermination = new ConditionalBranch();
    149153
    150       variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("Temperature", new DoubleValue(double.MaxValue)));
     154      temperatureInitializer.LeftSideParameter.ActualName = TemperatureParameter.ActualName;
     155      temperatureInitializer.RightSideParameter.ActualName = StartTemperatureParameter.Name;
    151156
    152157      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>(IterationsParameter.Name));
    153       resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Temperature"));
    154158      resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;
    155159
     
    199203
    200204      #region Create operator graph
    201       OperatorGraph.InitialOperator = variableCreator;
    202       variableCreator.Successor = resultsCollector1;
     205      OperatorGraph.InitialOperator = temperatureInitializer;
     206      temperatureInitializer.Successor = resultsCollector1;
    203207      resultsCollector1.Successor = subScopesProcessor0;
    204208      subScopesProcessor0.Operators.Add(analyzer1);
     
    237241      if (!Parameters.ContainsKey("Iterations"))
    238242        Parameters.Add(new LookupParameter<IntValue>("Iterations", "The number of iterations."));
     243      if (!Parameters.ContainsKey("Temperature"))
     244        Parameters.Add(new LookupParameter<DoubleValue>("Temperature", "The current temperature."));
    239245      #endregion
    240246    }
  • trunk/sources/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj

    r7829 r8016  
    148148    <Compile Include="QualityAnalysis\QualityDistributionAnalyzer.cs" />
    149149    <Compile Include="QualityAnalysis\ScaledQualityDifferenceAnalyzer.cs" />
     150    <Compile Include="ValueAnalysis\SingleValueAnalyzer.cs" />
    150151    <Compile Include="ValueAnalysis\MinAverageMaxValueAnalyzer.cs" />
    151152    <Compile Include="ValueAnalysis\MinAverageMaxValueCalculator.cs" />
  • trunk/sources/HeuristicLab.Analysis/3.3/ValueAnalysis/ValueAnalyzer.cs

    r7259 r8016  
    3434  /// An operator which analyzes a value in the scope tree.
    3535  /// </summary>
    36   [Item("ValueAnalyzer", "An operator which analyzes a value in the scope tree.")]
     36  [Item("ValueAnalyzer", "An operator which analyzes a value in the scope tree (current scope and children).")]
    3737  [StorableClass]
    3838  public sealed class ValueAnalyzer : AlgorithmOperator, IAnalyzer {
Note: See TracChangeset for help on using the changeset viewer.