Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/01/10 04:46:06 (14 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • worked on algorithms and parameters
Location:
trunk/sources/HeuristicLab.Algorithms.SGA/3.3
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.SGA/3.3/HeuristicLab.Algorithms.SGA-3.3.csproj

    r2884 r2891  
    8888  </ItemGroup>
    8989  <ItemGroup>
     90    <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
     91      <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project>
     92      <Name>HeuristicLab.Analysis-3.3</Name>
     93    </ProjectReference>
    9094    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
    9195      <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
  • trunk/sources/HeuristicLab.Algorithms.SGA/3.3/HeuristicLabAlgorithmsSGAPlugin.cs.frame

    r2884 r2891  
    2828  [Plugin("HeuristicLab.Algorithms.SGA", "3.3.0.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Algorithms.SGA-3.3.dll", PluginFileType.Assembly)]
     30  [PluginDependency("HeuristicLab.Analysis", "3.3")]
    3031  [PluginDependency("HeuristicLab.Collections", "3.3")]
    3132  [PluginDependency("HeuristicLab.Core", "3.3")]
  • trunk/sources/HeuristicLab.Algorithms.SGA/3.3/SGA.cs

    r2890 r2891  
    4343    private SGAOperator sgaOperator;
    4444
    45     private OptionalValueParameter<IntData> PopulationSizeParameter {
    46       get { return (OptionalValueParameter<IntData>)Parameters["PopulationSize"]; }
     45    private ValueParameter<IntData> PopulationSizeParameter {
     46      get { return (ValueParameter<IntData>)Parameters["PopulationSize"]; }
    4747    }
    4848    private ConstrainedValueParameter<ISelector> SelectorParameter {
     
    5555      get { return (ConstrainedValueParameter<IManipulator>)Parameters["Mutator"]; }
    5656    }
    57     private OptionalValueParameter<IntData> ElitesParameter {
    58       get { return (OptionalValueParameter<IntData>)Parameters["Elites"]; }
     57    private ValueParameter<IntData> ElitesParameter {
     58      get { return (ValueParameter<IntData>)Parameters["Elites"]; }
    5959    }
    6060
     
    6969    public SGA()
    7070      : base() {
    71       Parameters.Add(new OptionalValueParameter<IntData>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntData(0)));
    72       Parameters.Add(new OptionalValueParameter<BoolData>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolData(true)));
    73       Parameters.Add(new OptionalValueParameter<IntData>("PopulationSize", "The size of the population of solutions.", new IntData(100)));
     71      Parameters.Add(new ValueParameter<IntData>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntData(0)));
     72      Parameters.Add(new ValueParameter<BoolData>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolData(true)));
     73      Parameters.Add(new ValueParameter<IntData>("PopulationSize", "The size of the population of solutions.", new IntData(100)));
    7474      Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction."));
    7575      Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions."));
    76       Parameters.Add(new OptionalValueParameter<DoubleData>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new DoubleData(0.05)));
     76      Parameters.Add(new ValueParameter<DoubleData>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new DoubleData(0.05)));
    7777      Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
    78       Parameters.Add(new OptionalValueParameter<IntData>("Elites", "The numer of elite solutions which are kept in each generation.", new IntData(1)));
    79       Parameters.Add(new OptionalValueParameter<IntData>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntData(1000)));
     78      Parameters.Add(new ValueParameter<IntData>("Elites", "The numer of elite solutions which are kept in each generation.", new IntData(1)));
     79      Parameters.Add(new ValueParameter<IntData>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntData(1000)));
    8080
    8181      PopulationSizeParameter.ValueChanged += new EventHandler(PopulationSizeParameter_ValueChanged);
  • trunk/sources/HeuristicLab.Algorithms.SGA/3.3/SGAOperator.cs

    r2890 r2891  
    2020#endregion
    2121
     22using HeuristicLab.Analysis;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    112113      IntCounter intCounter = new IntCounter();
    113114      Comparator comparator = new Comparator();
     115      BestAverageWorstQualityCalculator bestAverageWorstQualityCalculator = new BestAverageWorstQualityCalculator();
    114116      ResultsCollector resultsCollector = new ResultsCollector();
    115117      ConditionalBranch conditionalBranch = new ConditionalBranch();
     
    179181      comparator.ResultParameter.ActualName = "Terminate";
    180182      comparator.RightSideParameter.ActualName = "MaximumGenerations";
    181       comparator.Successor = resultsCollector;
    182 
    183       SubScopesLookupParameter<DoubleData> quality = new SubScopesLookupParameter<DoubleData>("Qualities");
    184       quality.ActualName = "Quality";
    185       resultsCollector.CollectedValues.Add(quality);
     183      comparator.Successor = bestAverageWorstQualityCalculator;
     184
     185      bestAverageWorstQualityCalculator.AverageQualityParameter.ActualName = "AverageQuality";
     186      bestAverageWorstQualityCalculator.BestQualityParameter.ActualName = "BestQuality";
     187      bestAverageWorstQualityCalculator.MaximizationParameter.ActualName = "Maximization";
     188      bestAverageWorstQualityCalculator.QualityParameter.ActualName = "Quality";
     189      bestAverageWorstQualityCalculator.WorstQualityParameter.ActualName = "WorstQuality";
     190      bestAverageWorstQualityCalculator.Successor = resultsCollector;
     191
     192      LookupParameter<DoubleData> bestQuality = new LookupParameter<DoubleData>("BestQuality");
     193      bestQuality.ActualName = "BestQuality";
     194      resultsCollector.CollectedValues.Add(bestQuality);
     195      LookupParameter<DoubleData> averageQuality = new LookupParameter<DoubleData>("AverageQuality");
     196      averageQuality.ActualName = "AverageQuality";
     197      resultsCollector.CollectedValues.Add(averageQuality);
     198      LookupParameter<DoubleData> worstQuality = new LookupParameter<DoubleData>("WorstQuality");
     199      worstQuality.ActualName = "WorstQuality";
     200      resultsCollector.CollectedValues.Add(worstQuality);
    186201      resultsCollector.ResultsParameter.ActualName = "Results";
    187202      resultsCollector.Successor = conditionalBranch;
  • trunk/sources/HeuristicLab.Algorithms.SGA/3.3/Tests/HeuristicLab.Algorithms.SGA-3.3.Tests.csproj

    r2884 r2891  
    4646  </ItemGroup>
    4747  <ItemGroup>
     48    <ProjectReference Include="..\..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
     49      <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project>
     50      <Name>HeuristicLab.Analysis-3.3</Name>
     51    </ProjectReference>
    4852    <ProjectReference Include="..\..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
    4953      <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
Note: See TracChangeset for help on using the changeset viewer.