Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4017 for trunk


Ignore:
Timestamp:
07/08/10 12:28:06 (14 years ago)
Author:
abeham
Message:

#1040

  • Ported CrowdingDistanceAssignment operator
  • Added parameters to the alg and the main loop
    • main loop behavior is copied from the GA
Location:
trunk/sources/HeuristicLab.Algorithms.NSGA2/3.3
Files:
1 added
4 edited

Legend:

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

    r4012 r4017  
    7070      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    7171    </Reference>
    72     <Reference Include="System.Xml.Linq">
    73       <RequiredTargetFramework>3.5</RequiredTargetFramework>
    74     </Reference>
    75     <Reference Include="System.Data.DataSetExtensions">
    76       <RequiredTargetFramework>3.5</RequiredTargetFramework>
    77     </Reference>
    7872    <Reference Include="System.Data" />
    7973    <Reference Include="System.Xml" />
     
    8276    <None Include="HeuristicLab.snk" />
    8377    <None Include="HeuristicLabAlgorithmsNSGA2Plugin.cs.frame" />
     78    <Compile Include="CrowdingDistanceAssignment.cs" />
    8479    <Compile Include="HeuristicLabAlgorithmsNSGA2Plugin.cs" />
    8580    <Compile Include="NSGA2.cs" />
     
    8984  </ItemGroup>
    9085  <ItemGroup>
     86    <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
     87      <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project>
     88      <Name>HeuristicLab.Analysis-3.3</Name>
     89    </ProjectReference>
    9190    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
    9291      <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
     
    109108      <Name>HeuristicLab.Operators-3.3</Name>
    110109    </ProjectReference>
     110    <ProjectReference Include="..\..\HeuristicLab.Optimization.Operators\3.3\HeuristicLab.Optimization.Operators-3.3.csproj">
     111      <Project>{25087811-F74C-4128-BC86-8324271DA13E}</Project>
     112      <Name>HeuristicLab.Optimization.Operators-3.3</Name>
     113    </ProjectReference>
    111114    <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
    112115      <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
     
    124127      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
    125128      <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
     129    </ProjectReference>
     130    <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj">
     131      <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project>
     132      <Name>HeuristicLab.Random-3.3</Name>
     133    </ProjectReference>
     134    <ProjectReference Include="..\..\HeuristicLab.Selection\3.3\HeuristicLab.Selection-3.3.csproj">
     135      <Project>{2C36CD4F-E5F5-43A4-801A-201EA895FE17}</Project>
     136      <Name>HeuristicLab.Selection-3.3</Name>
    126137    </ProjectReference>
    127138  </ItemGroup>
  • trunk/sources/HeuristicLab.Algorithms.NSGA2/3.3/HeuristicLabAlgorithmsNSGA2Plugin.cs.frame

    r4012 r4017  
    2525  [Plugin("HeuristicLab.Algorithms.NSGA2", "3.3.0.$WCREV$")]
    2626  [PluginFile("HeuristicLab.Algorithms.NSGA2-3.3.dll", PluginFileType.Assembly)]
     27  [PluginDependency("HeuristicLab.Analysis", "3.3")]
    2728  [PluginDependency("HeuristicLab.Collections", "3.3")]
    2829  [PluginDependency("HeuristicLab.Common", "3.3")]
     
    3132  [PluginDependency("HeuristicLab.Operators", "3.3")]
    3233  [PluginDependency("HeuristicLab.Optimization", "3.3")]
     34  [PluginDependency("HeuristicLab.Optimization.Operators", "3.3")]
    3335  [PluginDependency("HeuristicLab.Parameters", "3.3")]
    3436  [PluginDependency("HeuristicLab.Persistence", "3.3")]
     37  [PluginDependency("HeuristicLab.Random", "3.3")]
     38  [PluginDependency("HeuristicLab.Selection", "3.3")]
    3539  public class HeuristicLabAlgorithmsNSGA2Plugin : PluginBase {
    3640  }
  • trunk/sources/HeuristicLab.Algorithms.NSGA2/3.3/NSGA2.cs

    r4012 r4017  
    2121
    2222using System;
     23using System.Linq;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
     
    2728using HeuristicLab.Parameters;
    2829using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     30using HeuristicLab.Analysis;
     31using HeuristicLab.Random;
     32using HeuristicLab.Optimization.Operators;
     33using HeuristicLab.PluginInfrastructure;
    2934
    3035namespace HeuristicLab.Algorithms.NSGA2 {
     
    3237  /// The Nondominated Sorting Genetic Algorithm II was introduced in Deb et al. 2002. A Fast and Elitist Multiobjective Genetic Algorithm: NSGA-II. IEEE Transactions on Evolutionary Computation, 6(2), pp. 182-197.
    3338  /// </summary>
    34   [Item("NSGA2", "The Nondominated Sorting Genetic Algorithm II was introduced in Deb et al. 2002. A Fast and Elitist Multiobjective Genetic Algorithm: NSGA-II. IEEE Transactions on Evolutionary Computation, 6(2), pp. 182-197.")]
     39  [Item("NSGA-II", "The Nondominated Sorting Genetic Algorithm II was introduced in Deb et al. 2002. A Fast and Elitist Multiobjective Genetic Algorithm: NSGA-II. IEEE Transactions on Evolutionary Computation, 6(2), pp. 182-197.")]
    3540  [Creatable("Algorithms")]
    3641  [StorableClass]
     
    4752
    4853    #region Parameter Properties
    49     private ValueLookupParameter<IntValue> PopulationSizeParameter {
    50       get { return (ValueLookupParameter<IntValue>)Parameters["PopulationSize"]; }
     54    private ValueParameter<IntValue> SeedParameter {
     55      get { return (ValueParameter<IntValue>)Parameters["Seed"]; }
     56    }
     57    private ValueParameter<BoolValue> SetSeedRandomlyParameter {
     58      get { return (ValueParameter<BoolValue>)Parameters["SetSeedRandomly"]; }
     59    }
     60    private ValueParameter<IntValue> PopulationSizeParameter {
     61      get { return (ValueParameter<IntValue>)Parameters["PopulationSize"]; }
     62    }
     63    private ConstrainedValueParameter<ISelector> SelectorParameter {
     64      get { return (ConstrainedValueParameter<ISelector>)Parameters["Selector"]; }
     65    }
     66    private ValueParameter<PercentValue> CrossoverProbabilityParameter {
     67      get { return (ValueParameter<PercentValue>)Parameters["CrossoverProbability"]; }
     68    }
     69    private ConstrainedValueParameter<ICrossover> CrossoverParameter {
     70      get { return (ConstrainedValueParameter<ICrossover>)Parameters["Crossover"]; }
     71    }
     72    private ValueParameter<PercentValue> MutationProbabilityParameter {
     73      get { return (ValueParameter<PercentValue>)Parameters["MutationProbability"]; }
     74    }
     75    private OptionalConstrainedValueParameter<IManipulator> MutatorParameter {
     76      get { return (OptionalConstrainedValueParameter<IManipulator>)Parameters["Mutator"]; }
     77    }
     78    private ValueParameter<MultiAnalyzer> AnalyzerParameter {
     79      get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
     80    }
     81    private ValueParameter<IntValue> MaximumGenerationsParameter {
     82      get { return (ValueParameter<IntValue>)Parameters["MaximumGenerations"]; }
    5183    }
    5284    #endregion
    5385
    5486    #region Properties
     87    public IntValue Seed {
     88      get { return SeedParameter.Value; }
     89      set { SeedParameter.Value = value; }
     90    }
     91    public BoolValue SetSeedRandomly {
     92      get { return SetSeedRandomlyParameter.Value; }
     93      set { SetSeedRandomlyParameter.Value = value; }
     94    }
     95    public IntValue PopulationSize {
     96      get { return PopulationSizeParameter.Value; }
     97      set { PopulationSizeParameter.Value = value; }
     98    }
     99    public ISelector Selector {
     100      get { return SelectorParameter.Value; }
     101      set { SelectorParameter.Value = value; }
     102    }
     103    public PercentValue CrossoverProbability {
     104      get { return CrossoverProbabilityParameter.Value; }
     105      set { CrossoverProbabilityParameter.Value = value; }
     106    }
     107    public ICrossover Crossover {
     108      get { return CrossoverParameter.Value; }
     109      set { CrossoverParameter.Value = value; }
     110    }
     111    public PercentValue MutationProbability {
     112      get { return MutationProbabilityParameter.Value; }
     113      set { MutationProbabilityParameter.Value = value; }
     114    }
     115    public IManipulator Mutator {
     116      get { return MutatorParameter.Value; }
     117      set { MutatorParameter.Value = value; }
     118    }
     119    public MultiAnalyzer Analyzer {
     120      get { return AnalyzerParameter.Value; }
     121      set { AnalyzerParameter.Value = value; }
     122    }
     123    public IntValue MaximumGenerations {
     124      get { return MaximumGenerationsParameter.Value; }
     125      set { MaximumGenerationsParameter.Value = value; }
     126    }
     127    private RandomCreator RandomCreator {
     128      get { return (RandomCreator)OperatorGraph.InitialOperator; }
     129    }
     130    private SolutionsCreator SolutionsCreator {
     131      get { return (SolutionsCreator)RandomCreator.Successor; }
     132    }
     133    private NSGA2MainLoop MainLoop {
     134      get { return (NSGA2MainLoop)SolutionsCreator.Successor; }
     135    }
    55136    #endregion
    56137
     
    58139    public NSGA2(bool deserializing) : base(deserializing) { }
    59140    public NSGA2() {
    60       // TODO: Add your parameters here
    61       Parameters.Add(new ValueParameter<IntValue>("PopulationSize", "The population size of the algorithm.", new IntValue(100)));
     141      Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
     142      Parameters.Add(new ValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
     143      Parameters.Add(new ValueParameter<IntValue>("PopulationSize", "The size of the population of solutions.", new IntValue(100)));
     144      Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction."));
     145      Parameters.Add(new ValueParameter<PercentValue>("CrossoverProbability", "The probability that the crossover operator is applied on two parents.", new PercentValue(0.05)));
     146      Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions."));
     147      Parameters.Add(new ValueParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new PercentValue(0.05)));
     148      Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
     149      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer()));
     150      Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntValue(1000)));
     151
     152      RandomCreator randomCreator = new RandomCreator();
     153      SolutionsCreator solutionsCreator = new SolutionsCreator();
     154      NSGA2MainLoop mainLoop = new NSGA2MainLoop();
     155      OperatorGraph.InitialOperator = randomCreator;
     156
     157      randomCreator.RandomParameter.ActualName = "Random";
     158      randomCreator.SeedParameter.ActualName = SeedParameter.Name;
     159      randomCreator.SeedParameter.Value = null;
     160      randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name;
     161      randomCreator.SetSeedRandomlyParameter.Value = null;
     162      randomCreator.Successor = solutionsCreator;
     163
     164      solutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name;
     165      solutionsCreator.Successor = mainLoop;
     166
     167      mainLoop.SelectorParameter.ActualName = SelectorParameter.Name;
     168      mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;
     169      mainLoop.CrossoverProbabilityParameter.ActualName = CrossoverProbabilityParameter.Name;
     170      mainLoop.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name;
     171      mainLoop.MutatorParameter.ActualName = MutatorParameter.Name;
     172      mainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
     173      mainLoop.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
     174      mainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name;
     175      mainLoop.ResultsParameter.ActualName = "Results";
     176
     177      foreach (ISelector selector in ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name))
     178        SelectorParameter.ValidValues.Add(selector);
     179      ISelector proportionalSelector = SelectorParameter.ValidValues.FirstOrDefault(x => x.GetType().Name.Equals("ProportionalSelector"));
     180      if (proportionalSelector != null) SelectorParameter.Value = proportionalSelector;
     181     
     182      // TODO: parameterize selectors
     183
     184      AttachEventHandlers();
    62185    }
    63186
     
    67190      return clone;
    68191    }
     192
     193    #region Events
     194    protected override void OnProblemChanged() {
     195      // parameterize pretty much everything
     196      base.OnProblemChanged();
     197    }
     198    protected override void Problem_SolutionCreatorChanged(object sender, EventArgs e) {
     199      // parameterize SolutionCreator
     200      base.Problem_SolutionCreatorChanged(sender, e);
     201    }
     202    protected override void Problem_EvaluatorChanged(object sender, EventArgs e) {
     203      // parameterize StochasticOperators
     204      // parameterize SolutionsCreator
     205      // parameterize MainLoop
     206      // parameterize Selectors
     207      // parameterize Analyzers
     208      Problem.Evaluator.QualitiesParameter.ActualNameChanged += new EventHandler(Evaluator_QualitiesParameter_ActualNameChanged);
     209      base.Problem_EvaluatorChanged(sender, e);
     210    }
     211    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
     212      base.Problem_OperatorsChanged(sender, e);
     213    }
     214    protected override void Problem_Reset(object sender, EventArgs e) {
     215      base.Problem_Reset(sender, e);
     216    }
     217
     218    private void PopulationSizeParameter_ValueChanged(object sender, EventArgs e) {
     219      PopulationSize.ValueChanged += new EventHandler(PopulationSize_ValueChanged);
     220      // parameterize Selectors
     221    }
     222    private void PopulationSize_ValueChanged(object sender, EventArgs e) {
     223      // parameterize Selectors
     224    }
     225
     226    private void Evaluator_QualitiesParameter_ActualNameChanged(object sender, EventArgs e) {
     227      // parameterize Analyzers
     228      // parameterize MainLoop
     229      // parameterize Selectors
     230    }
     231    #endregion
     232
     233    #region Helpers
     234    [StorableHook(HookType.AfterDeserialization)]
     235    private void AttachEventHandlers() {
     236      PopulationSizeParameter.ValueChanged += new EventHandler(PopulationSizeParameter_ValueChanged);
     237      PopulationSize.ValueChanged += new EventHandler(PopulationSize_ValueChanged);
     238      if (Problem != null) {
     239        Problem.Evaluator.QualitiesParameter.ActualNameChanged += new EventHandler(Evaluator_QualitiesParameter_ActualNameChanged);
     240      }
     241    }
     242    #endregion
    69243  }
    70244}
  • trunk/sources/HeuristicLab.Algorithms.NSGA2/3.3/NSGA2MainLoop.cs

    r4012 r4017  
    2323using HeuristicLab.Operators;
    2424using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     25using HeuristicLab.Parameters;
     26using HeuristicLab.Data;
     27using HeuristicLab.Optimization.Operators;
     28using HeuristicLab.Selection;
    2529
    2630namespace HeuristicLab.Algorithms.NSGA2 {
     
    3135  [StorableClass]
    3236  public class NSGA2MainLoop : AlgorithmOperator {
     37    #region Parameter properties
     38    public ValueLookupParameter<IRandom> RandomParameter {
     39      get { return (ValueLookupParameter<IRandom>)Parameters["Random"]; }
     40    }
     41    public ValueLookupParameter<BoolValue> MaximizationParameter {
     42      get { return (ValueLookupParameter<BoolValue>)Parameters["Maximization"]; }
     43    }
     44    public ScopeTreeLookupParameter<DoubleValue> QualityParameter {
     45      get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
     46    }
     47    public ValueLookupParameter<IOperator> SelectorParameter {
     48      get { return (ValueLookupParameter<IOperator>)Parameters["Selector"]; }
     49    }
     50    public ValueLookupParameter<PercentValue> CrossoverProbabilityParameter {
     51      get { return (ValueLookupParameter<PercentValue>)Parameters["CrossoverProbability"]; }
     52    }
     53    public ValueLookupParameter<IOperator> CrossoverParameter {
     54      get { return (ValueLookupParameter<IOperator>)Parameters["Crossover"]; }
     55    }
     56    public ValueLookupParameter<PercentValue> MutationProbabilityParameter {
     57      get { return (ValueLookupParameter<PercentValue>)Parameters["MutationProbability"]; }
     58    }
     59    public ValueLookupParameter<IOperator> MutatorParameter {
     60      get { return (ValueLookupParameter<IOperator>)Parameters["Mutator"]; }
     61    }
     62    public ValueLookupParameter<IOperator> EvaluatorParameter {
     63      get { return (ValueLookupParameter<IOperator>)Parameters["Evaluator"]; }
     64    }
     65    public ValueLookupParameter<IntValue> MaximumGenerationsParameter {
     66      get { return (ValueLookupParameter<IntValue>)Parameters["MaximumGenerations"]; }
     67    }
     68    public ValueLookupParameter<VariableCollection> ResultsParameter {
     69      get { return (ValueLookupParameter<VariableCollection>)Parameters["Results"]; }
     70    }
     71    public ValueLookupParameter<IOperator> AnalyzerParameter {
     72      get { return (ValueLookupParameter<IOperator>)Parameters["Analyzer"]; }
     73    }
     74    #endregion
     75
    3376    [StorableConstructor]
    3477    private NSGA2MainLoop(bool deserializing) : base() { }
     
    3982
    4083    private void Initialize() {
    41       #region Create Parameters
     84      #region Create parameters
     85      Parameters.Add(new ValueLookupParameter<IRandom>("Random", "A pseudo random number generator."));
     86      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
     87      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The value which represents the quality of a solution."));
     88      Parameters.Add(new ValueLookupParameter<IOperator>("Selector", "The operator used to select solutions for reproduction."));
     89      Parameters.Add(new ValueLookupParameter<PercentValue>("CrossoverProbability", "The probability that the crossover operator is applied on a solution."));
     90      Parameters.Add(new ValueLookupParameter<IOperator>("Crossover", "The operator used to cross solutions."));
     91      Parameters.Add(new ValueLookupParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution."));
     92      Parameters.Add(new ValueLookupParameter<IOperator>("Mutator", "The operator used to mutate solutions."));
     93      Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions."));
     94      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed."));
     95      Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored."));
     96      Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to analyze each generation."));
    4297      #endregion
    4398
    44       #region Create Operators
     99      #region Create operators
     100      VariableCreator variableCreator = new VariableCreator();
     101      ResultsCollector resultsCollector1 = new ResultsCollector();
     102      Placeholder analyzer1 = new Placeholder();
     103      Placeholder selector = new Placeholder();
     104      SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor();
     105      ChildrenCreator childrenCreator = new ChildrenCreator();
     106      UniformSubScopesProcessor uniformSubScopesProcessor = new UniformSubScopesProcessor();
     107      Placeholder crossover = new Placeholder();
     108      StochasticBranch stochasticBranch = new StochasticBranch();
     109      Placeholder mutator = new Placeholder();
     110      Placeholder evaluator = new Placeholder();
     111      SubScopesRemover subScopesRemover = new SubScopesRemover();
     112      SubScopesProcessor subScopesProcessor2 = new SubScopesProcessor();
     113      BestSelector bestSelector = new BestSelector();
     114      RightReducer rightReducer = new RightReducer();
     115      MergingReducer mergingReducer = new MergingReducer();
     116      IntCounter intCounter = new IntCounter();
     117      Comparator comparator = new Comparator();
     118      ResultsCollector resultsCollector2 = new ResultsCollector();
     119      Placeholder analyzer2 = new Placeholder();
     120      ConditionalBranch conditionalBranch = new ConditionalBranch();
     121
     122      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0)));
     123
     124      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
     125      resultsCollector1.ResultsParameter.ActualName = "Results";
     126
     127      analyzer1.Name = "Analyzer";
     128      analyzer1.OperatorParameter.ActualName = "Analyzer";
     129
     130      selector.Name = "Selector";
     131      selector.OperatorParameter.ActualName = "Selector";
     132
     133      childrenCreator.ParentsPerChild = new IntValue(2);
     134
     135      crossover.Name = "Crossover";
     136      crossover.OperatorParameter.ActualName = "Crossover";
     137
     138      stochasticBranch.ProbabilityParameter.ActualName = "MutationProbability";
     139      stochasticBranch.RandomParameter.ActualName = "Random";
     140
     141      mutator.Name = "Mutator";
     142      mutator.OperatorParameter.ActualName = "Mutator";
     143
     144      evaluator.Name = "Evaluator";
     145      evaluator.OperatorParameter.ActualName = "Evaluator";
     146
     147      subScopesRemover.RemoveAllSubScopes = true;
     148
     149      bestSelector.CopySelected = new BoolValue(false);
     150      bestSelector.MaximizationParameter.ActualName = "Maximization";
     151      bestSelector.NumberOfSelectedSubScopesParameter.ActualName = "Elites";
     152      bestSelector.QualityParameter.ActualName = "Quality";
     153
     154      intCounter.Increment = new IntValue(1);
     155      intCounter.ValueParameter.ActualName = "Generations";
     156
     157      comparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
     158      comparator.LeftSideParameter.ActualName = "Generations";
     159      comparator.ResultParameter.ActualName = "Terminate";
     160      comparator.RightSideParameter.ActualName = "MaximumGenerations";
     161
     162      resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
     163      resultsCollector2.ResultsParameter.ActualName = "Results";
     164
     165      analyzer2.Name = "Analyzer";
     166      analyzer2.OperatorParameter.ActualName = "Analyzer";
     167
     168      conditionalBranch.ConditionParameter.ActualName = "Terminate";
    45169      #endregion
    46170
    47       #region Create Operator Graph
     171      #region Create operator graph
     172      OperatorGraph.InitialOperator = variableCreator;
     173      variableCreator.Successor = resultsCollector1;
     174      resultsCollector1.Successor = analyzer1;
     175      analyzer1.Successor = selector;
     176      selector.Successor = subScopesProcessor1;
     177      subScopesProcessor1.Operators.Add(new EmptyOperator());
     178      subScopesProcessor1.Operators.Add(childrenCreator);
     179      subScopesProcessor1.Successor = subScopesProcessor2;
     180      childrenCreator.Successor = uniformSubScopesProcessor;
     181      uniformSubScopesProcessor.Operator = crossover;
     182      uniformSubScopesProcessor.Successor = null;
     183      crossover.Successor = stochasticBranch;
     184      stochasticBranch.FirstBranch = mutator;
     185      stochasticBranch.SecondBranch = null;
     186      stochasticBranch.Successor = evaluator;
     187      mutator.Successor = null;
     188      evaluator.Successor = subScopesRemover;
     189      subScopesRemover.Successor = null;
     190      subScopesProcessor2.Operators.Add(bestSelector);
     191      subScopesProcessor2.Operators.Add(new EmptyOperator());
     192      subScopesProcessor2.Successor = mergingReducer;
     193      bestSelector.Successor = rightReducer;
     194      rightReducer.Successor = null;
     195      mergingReducer.Successor = intCounter;
     196      intCounter.Successor = comparator;
     197      comparator.Successor = resultsCollector2;
     198      resultsCollector2.Successor = analyzer2;
     199      analyzer2.Successor = conditionalBranch;
     200      conditionalBranch.FalseBranch = selector;
     201      conditionalBranch.TrueBranch = null;
     202      conditionalBranch.Successor = null;
    48203      #endregion
     204    }
     205
     206    public override IOperation Apply() {
     207      if (CrossoverParameter.ActualValue == null)
     208        return null;
     209      return base.Apply();
    49210    }
    50211  }
Note: See TracChangeset for help on using the changeset viewer.