Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13686


Ignore:
Timestamp:
03/11/16 12:15:15 (9 years ago)
Author:
pkuelzer
Message:

#2558
Refactoring
Added an Offspring Selection version of island alps

Location:
branches/IslandALPS
Files:
4 added
2 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • branches/IslandALPS

    • Property svn:global-ignores set to
      .vs
  • branches/IslandALPS/IslandALPS/3.3

    • Property svn:global-ignores
      •  

        old new  
        11.vs
        22obj
         3*.user
  • branches/IslandALPS/IslandALPS/3.3/GroupedLayerOperator.cs

    r13595 r13686  
    115115    }
    116116
    117     //TODO: Copied from ResultsHistoryWiper, When integrate create static apply method and delete this
     117    //TODO: HL-INTEGRATION :Copied from ResultsHistoryWiper, When integrate create static apply method and delete this
    118118    private static void ClearHistoryRecursively(ResultCollection results) {
    119119      var values = results.Select(r => r.Value);
  • branches/IslandALPS/IslandALPS/3.3/HeuristicLab.Algorithms.IslandALPS-3.3.csproj

    r13604 r13686  
    105105  </ItemGroup>
    106106  <ItemGroup>
     107    <Compile Include="IslandAlpsAlgorithmMainLoop.cs" />
    107108    <Compile Include="LayerMigrator.cs" />
     109    <Compile Include="Offspring Selection\IslandAlpsOffspringSelectionAlgorithm.cs" />
     110    <Compile Include="Offspring Selection\IslandAlpsOffspringSelectionAlgorithmMainLoop.cs" />
    108111    <Compile Include="ResultsExtractor.cs" />
    109112    <Compile Include="IslandALPSAlgorithm.cs" />
    110     <Compile Include="IslandALPSAlgorthmsMainLoop.cs" />
    111113    <Compile Include="Plugin.cs" />
    112114    <Compile Include="Properties\AssemblyInfo.cs" />
     
    116118    <None Include="HeuristicLab.snk" />
    117119  </ItemGroup>
     120  <ItemGroup />
    118121  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    119122  <PropertyGroup>
  • branches/IslandALPS/IslandALPS/3.3/IslandALPSAlgorithm.cs

    r13604 r13686  
    22using System.Collections.Generic;
    33using System.Linq;
    4 using System.Security.Policy;
    54using HeuristicLab.Algorithms.ALPS;
    65using HeuristicLab.Analysis;
     
    4140
    4241    #region ALPSParameter
    43     private IValueParameter<IntValue> AgeGapParameter {
    44       get { return (IValueParameter<IntValue>) Parameters["AgeGap"]; }
    45     }
    46     private IValueParameter<EnumValue<AgingScheme>> AgingSchemeParameter {
    47       get { return (IValueParameter<EnumValue<AgingScheme>>)Parameters["AgingScheme"]; }
    48     }
    49     private IValueParameter<DoubleValue> AgeInheritanceParameter {
    50       get { return (IValueParameter<DoubleValue>) Parameters["AgeInheritance"]; }
    51     }
    52     private IValueParameter<IntArray> AgeLimitsParameter {
    53       get { return (IValueParameter<IntArray>) Parameters["AgeLimits"]; }
    54     }
    55     private IValueParameter<BoolValue> ReduceToPopulationSizeParameter {
    56       get { return (IValueParameter<BoolValue>) Parameters["ReduceToPopulationSize"]; }
    57     }
    58     private IValueParameter<IntValue> NumberOfLayersParameter {
    59       get { return (IValueParameter<IntValue>) Parameters["NumberOfLayers"]; }
    60     }
    61     private IValueParameter<MultiAnalyzer> LayerAnalyzerParameter {
    62       get { return (IValueParameter<MultiAnalyzer>)Parameters["LayerAnalyzer"]; }
    63     }
    64     private IValueParameter<MultiAnalyzer> GroupAnalyzerParameter {
    65       get { return (IValueParameter<MultiAnalyzer>)Parameters["GroupAnalyzer"]; }
    66     }
    67     private IValueParameter<BoolValue> PlusSelectionParameter {
    68       get { return (IValueParameter<BoolValue>)Parameters["PlusSelection"]; }
    69     }
     42
     43    public IValueParameter<IntValue> AgeGapParameter { get { return (IValueParameter<IntValue>) Parameters["AgeGap"]; } }
     44
     45    public IValueParameter<EnumValue<AgingScheme>> AgingSchemeParameter { get { return (IValueParameter<EnumValue<AgingScheme>>) Parameters["AgingScheme"]; } }
     46    public IValueParameter<DoubleValue> AgeInheritanceParameter {   get { return (IValueParameter<DoubleValue>) Parameters["AgeInheritance"]; } }
     47    public IValueParameter<IntArray> AgeLimitsParameter {   get { return (IValueParameter<IntArray>) Parameters["AgeLimits"]; }   }
     48    public IValueParameter<BoolValue> ReduceToPopulationSizeParameter {   get { return (IValueParameter<BoolValue>) Parameters["ReduceToPopulationSize"]; }   }
     49    public IValueParameter<IntValue> NumberOfLayersParameter {   get { return (IValueParameter<IntValue>) Parameters["NumberOfLayers"]; } }
     50    public IValueParameter<MultiAnalyzer> LayerAnalyzerParameter {   get { return (IValueParameter<MultiAnalyzer>) Parameters["LayerAnalyzer"]; } }
     51    public IValueParameter<MultiAnalyzer> GroupAnalyzerParameter {   get { return (IValueParameter<MultiAnalyzer>) Parameters["GroupAnalyzer"]; } }
     52    public IValueParameter<BoolValue> PlusSelectionParameter {   get { return (IValueParameter<BoolValue>) Parameters["PlusSelection"]; } }
    7053    #endregion
    7154
    7255    #region IslandParameter
    73     private IValueParameter<MultiAnalyzer> IslandAnalyzerParameter {
    74       get { return (IValueParameter<MultiAnalyzer>) Parameters["IslandAnalyzer"]; }
    75     }
    76     private IValueParameter<IntValue> NumberOfIslandsParameter {
    77       get { return (IValueParameter<IntValue>) Parameters["NumberOfIslands"]; }
    78     }
    79     private IValueParameter<PercentValue> MigrationRateParameter {
    80       get { return (IValueParameter<PercentValue>)Parameters["MigrationRate"]; }
    81     }
    82     private IValueParameter<IntValue> MigrationIntervalParameter {
    83       get { return (IValueParameter<IntValue>)Parameters["MigrationInterval"]; }
    84     }
    85     public IConstrainedValueParameter<IMigrator> MigratorParameter {
    86       get { return (IConstrainedValueParameter<IMigrator>)Parameters["Migrator"]; }
    87     }
    88     public IConstrainedValueParameter<ISelector> EmigrantsSelectorParameter {
    89       get { return (IConstrainedValueParameter<ISelector>)Parameters["EmigrantsSelector"]; }
    90     }
    91     public IConstrainedValueParameter<IReplacer> ImmigrationReplacerParameter {
    92       get { return (IConstrainedValueParameter<IReplacer>)Parameters["ImmigrationReplacer"]; }
    93     }
     56
     57    public IValueParameter<MultiAnalyzer> IslandAnalyzerParameter {   get { return (IValueParameter<MultiAnalyzer>) Parameters["IslandAnalyzer"]; } }
     58    public IValueParameter<IntValue> NumberOfIslandsParameter {   get { return (IValueParameter<IntValue>) Parameters["NumberOfIslands"]; } }
     59    public IValueParameter<PercentValue> MigrationRateParameter {   get { return (IValueParameter<PercentValue>) Parameters["MigrationRate"]; } }
     60    public IValueParameter<IntValue> MigrationIntervalParameter {   get { return (IValueParameter<IntValue>) Parameters["MigrationInterval"]; } }
     61    public IConstrainedValueParameter<IMigrator> MigratorParameter {   get { return (IConstrainedValueParameter<IMigrator>) Parameters["Migrator"]; } }
     62    public IConstrainedValueParameter<ISelector> EmigrantsSelectorParameter {   get { return (IConstrainedValueParameter<ISelector>) Parameters["EmigrantsSelector"]; } }
     63    public IConstrainedValueParameter<IReplacer> ImmigrationReplacerParameter {   get { return (IConstrainedValueParameter<IReplacer>) Parameters["ImmigrationReplacer"]; } }
    9464    #endregion
    9565
    9666    #region GeneralParameter
    97     private IValueParameter<IntValue> SeedParameter {
    98       get { return (IValueParameter<IntValue>) Parameters["Seed"]; }
    99     }
    100     private IValueParameter<BoolValue> SetSeedRandomlyParameter {
    101       get { return (IValueParameter<BoolValue>) Parameters["SetSeedRandomly"]; }
    102     }
    103     private IValueParameter<IntValue> PopulationSizeParameter {
    104       get { return (IValueParameter<IntValue>) Parameters["PopulationSize"]; }
    105     }
    106     private IValueParameter<MultiAnalyzer> AnalyzerParameter {
    107       get { return (IValueParameter<MultiAnalyzer>) Parameters["Analyzer"]; }
    108     }
    109     public IConstrainedValueParameter<ISelector> SelectorParameter {
    110       get { return (IConstrainedValueParameter<ISelector>) Parameters["Selector"]; }
    111     }
    112     public IConstrainedValueParameter<ICrossover> CrossoverParameter {
    113       get { return (IConstrainedValueParameter<ICrossover>) Parameters["Crossover"]; }
    114     }
    115     private IValueParameter<PercentValue> MutationProbabilityParameter {
    116       get { return (IValueParameter<PercentValue>) Parameters["MutationProbability"]; }
    117     }
    118     public IConstrainedValueParameter<IManipulator> MutatorParameter {
    119       get { return (IConstrainedValueParameter<IManipulator>) Parameters["Mutator"]; }
    120     }
    121     private IValueParameter<IntValue> ElitesParameter {
    122       get { return (IValueParameter<IntValue>) Parameters["Elites"]; }
    123     }
    124     private IFixedValueParameter<BoolValue> ReevaluateElitesParameter {
    125       get { return (IFixedValueParameter<BoolValue>) Parameters["ReevaluateElites"]; }
    126     }
    127     private IValueParameter<MultiTerminator> TerminatorParameter {
    128       get { return (IValueParameter<MultiTerminator>) Parameters["Terminator"]; }
    129     }
    130     #endregion
     67
     68    public IValueParameter<IntValue> SeedParameter {   get { return (IValueParameter<IntValue>) Parameters["Seed"]; } }
     69    public IValueParameter<BoolValue> SetSeedRandomlyParameter {   get { return (IValueParameter<BoolValue>) Parameters["SetSeedRandomly"]; } }
     70    public IValueParameter<IntValue> PopulationSizeParameter {   get { return (IValueParameter<IntValue>) Parameters["PopulationSize"]; } }
     71    public IValueParameter<MultiAnalyzer> AnalyzerParameter {   get { return (IValueParameter<MultiAnalyzer>) Parameters["Analyzer"]; } }
     72    public IConstrainedValueParameter<ISelector> SelectorParameter {   get { return (IConstrainedValueParameter<ISelector>) Parameters["Selector"]; } }
     73    public IConstrainedValueParameter<ICrossover> CrossoverParameter {   get { return (IConstrainedValueParameter<ICrossover>) Parameters["Crossover"]; } }
     74    public IValueParameter<PercentValue> MutationProbabilityParameter {   get { return (IValueParameter<PercentValue>) Parameters["MutationProbability"]; } }
     75    public IConstrainedValueParameter<IManipulator> MutatorParameter {   get { return (IConstrainedValueParameter<IManipulator>) Parameters["Mutator"]; } }
     76    public IValueParameter<IntValue> ElitesParameter {   get { return (IValueParameter<IntValue>) Parameters["Elites"]; } }
     77    public IFixedValueParameter<BoolValue> ReevaluateElitesParameter {   get { return (IFixedValueParameter<BoolValue>) Parameters["ReevaluateElites"]; } }
     78    public IValueParameter<MultiTerminator> TerminatorParameter {   get { return (IValueParameter<MultiTerminator>) Parameters["Terminator"]; } }
     79    #endregion
     80
    13181    #endregion
    13282
    13383    #region Properties
     84
    13485    public IntValue Seed {
    13586      get { return SeedParameter.Value; }
    13687      set { SeedParameter.Value = value; }
    13788    }
     89
    13890    public BoolValue SetSeedRandomly {
    13991      get { return SetSeedRandomlyParameter.Value; }
    14092      set { SetSeedRandomlyParameter.Value = value; }
    14193    }
     94
    14295    public IntValue PopulationSize {
    14396      get { return PopulationSizeParameter.Value; }
    14497      set { PopulationSizeParameter.Value = value; }
    14598    }
     99
    146100    public IntValue NumberOfIslands {
    147101      get { return NumberOfIslandsParameter.Value; }
    148102      set { NumberOfIslandsParameter.Value = value; }
    149103    }
     104
    150105    public MultiAnalyzer Analyzer {
    151106      get { return AnalyzerParameter.Value; }
    152107      set { AnalyzerParameter.Value = value; }
    153108    }
     109
    154110    public MultiAnalyzer IslandAnalyzer {
    155111      get { return IslandAnalyzerParameter.Value; }
    156112      set { IslandAnalyzerParameter.Value = value; }
    157113    }
     114
    158115    public MultiAnalyzer LayerAnalyzer {
    159116      get { return LayerAnalyzerParameter.Value; }
    160117      set { LayerAnalyzerParameter.Value = value; }
    161118    }
     119
    162120    public MultiAnalyzer GroupAnalyzer {
    163121      get { return GroupAnalyzerParameter.Value; }
    164122      set { GroupAnalyzerParameter.Value = value; }
    165123    }
     124
    166125    public ISelector Selector {
    167126      get { return SelectorParameter.Value; }
    168127      set { SelectorParameter.Value = value; }
    169128    }
     129
    170130    public ICrossover Crossover {
    171131      get { return CrossoverParameter.Value; }
    172132      set { CrossoverParameter.Value = value; }
    173133    }
     134
    174135    public PercentValue MutationProbability {
    175136      get { return MutationProbabilityParameter.Value; }
    176137      set { MutationProbabilityParameter.Value = value; }
    177138    }
     139
    178140    public IManipulator Mutator {
    179141      get { return MutatorParameter.Value; }
    180142      set { MutatorParameter.Value = value; }
    181143    }
     144
    182145    public IntValue Elites {
    183146      get { return ElitesParameter.Value; }
    184147      set { ElitesParameter.Value = value; }
    185148    }
     149
    186150    public bool ReevaluteElites {
    187151      get { return ReevaluateElitesParameter.Value.Value; }
    188152      set { ReevaluateElitesParameter.Value.Value = value; }
    189153    }
     154
    190155    public MultiTerminator Terminators {
    191156      get { return TerminatorParameter.Value; }
    192157    }
     158
    193159    public EnumValue<AgingScheme> AgingScheme {
    194160      get { return AgingSchemeParameter.Value; }
    195161      set { AgingSchemeParameter.Value = value; }
    196162    }
     163
    197164    public IntValue AgeGap {
    198165      get { return AgeGapParameter.Value; }
    199166      set { AgeGapParameter.Value = value; }
    200167    }
     168
    201169    public DoubleValue AgeInheritance {
    202170      get { return AgeInheritanceParameter.Value; }
    203171      set { AgeInheritanceParameter.Value = value; }
    204172    }
     173
    205174    public IntArray AgeLimits {
    206175      get { return AgeLimitsParameter.Value; }
    207176      set { AgeLimitsParameter.Value = value; }
    208177    }
     178
    209179    public IntValue NumberOfLayers {
    210180      get { return NumberOfLayersParameter.Value; }
    211181      set { NumberOfLayersParameter.Value = value; }
    212182    }
     183
    213184    #endregion
    214185
    215186    #region Helper Properties
    216187
    217     private IslandAlpsAlgorthmsMainLoop MainLoop {
    218       get { return OperatorGraph.Iterate().OfType<IslandAlpsAlgorthmsMainLoop>().First(); }
     188    private IslandAlpsAlgorithmMainLoop MainLoop {
     189      get { return OperatorGraph.Iterate().OfType<IslandAlpsAlgorithmMainLoop>().First(); }
    219190    }
    220191
     
    246217
    247218    [StorableConstructor]
    248     private IslandAlpsAlgorithm(bool deserializing) : base(deserializing) {
    249     }
     219    private IslandAlpsAlgorithm(bool deserializing) : base(deserializing) {}
    250220
    251221    [StorableHook(HookType.AfterDeserialization)]
     
    273243
    274244    public IslandAlpsAlgorithm() {
    275       #region add Parameter
    276       #region ALPSParameter
    277       Parameters.Add(new ValueParameter<IntValue>("AgeGap", "The frequency of reseeding the lowest layer and scaling factor for the age-limits for the layers.", new IntValue(5)));
    278       Parameters.Add(new ValueParameter<DoubleValue>("AgeInheritance", "A weight that determines the age of a child after crossover based on the older (1.0) and younger (0.0) parent.", new DoubleValue(0.5)));
    279       Parameters.Add(new ValueParameter<IntArray>("AgeLimits", "The maximum age an individual is allowed to reach in a certain layer.", new IntArray(new int[0])) { Hidden = true });
    280       Parameters.Add(new ValueParameter<EnumValue<AgingScheme>>("AgingScheme", "The aging scheme for setting the age-limits for the layers.", new EnumValue<AgingScheme>(ALPS.AgingScheme.Polynomial)));
    281       Parameters.Add(new ValueParameter<BoolValue>("ReduceToPopulationSize", ".", new BoolValue(true)));
    282 
    283       Parameters.Add(new ValueParameter<IntValue>("NumberOfLayers", "", new IntValue(10)));
    284       Parameters.Add(new ValueParameter<MultiAnalyzer>("LayerAnalyzer", "The operator used to analyze each layer.", new MultiAnalyzer()));
    285       Parameters.Add(new ValueParameter<MultiAnalyzer>("GroupAnalyzer", "The operator used to analyze each layergroup.", new MultiAnalyzer()));
    286       Parameters.Add(new ValueParameter<BoolValue>("PlusSelection", "Include the parents in the selection of the invividuals for the next generation.", new BoolValue(false)));
    287 
    288       #endregion
    289       #region IslandParameter
    290       Parameters.Add(new ValueParameter<IntValue>("NumberOfIslands", "The number of islands.", new IntValue(5)));
    291       Parameters.Add(new ValueParameter<PercentValue>("MigrationRate", "How many individuals should migrate.", new PercentValue(0.15)));
    292       Parameters.Add(new ValueParameter<IntValue>("MigrationInterval", "The number Generations before a migration occurs.", new IntValue(20)));
    293       Parameters.Add(new ValueParameter<MultiAnalyzer>("IslandAnalyzer", "The operator used to analyze each island.", new MultiAnalyzer()));
    294       Parameters.Add(new ConstrainedValueParameter<IMigrator>("Migrator", "The migration strategy."));
    295       Parameters.Add(new ConstrainedValueParameter<ISelector>("EmigrantsSelector", "Selects the individuals that will be migrated."));
    296       Parameters.Add(new ConstrainedValueParameter<IReplacer>("ImmigrationReplacer", "Selects the population from the unification of the original population and the immigrants."));
    297 
    298       #endregion
    299       #region GeneralParameter   
    300       Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
    301       Parameters.Add(new ValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
    302       Parameters.Add(new ValueParameter<IntValue>("PopulationSize", "The size of the population of solutions.", new IntValue(100)));
    303       Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the islands.", new MultiAnalyzer()));
    304       Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction."));
    305       Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions."));
    306       Parameters.Add(new ValueParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new PercentValue(0.05)));
    307       Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
    308       Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1)));
    309       Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", new BoolValue(false)) { Hidden = true });
    310       Parameters.Add(new ValueParameter<MultiTerminator>("Terminator", "The termination criteria that defines if the algorithm should continue or stop.", new MultiTerminator()));
    311       #endregion
    312 
    313       #endregion
     245   
     246      AddParameters();
    314247
    315248      #region create Operators
     
    330263      var globalEvaluatedSolutionsCounter = new DataReducer {Name = "Count GlobalSolutions"};
    331264      var resultsCollector = new ResultsCollector();
    332       var mainLoop = new IslandAlpsAlgorthmsMainLoop();
     265      var mainLoop = new IslandAlpsAlgorithmMainLoop();
    333266
    334267      #endregion
     
    351284
    352285      #region Create Analyzers
    353 
    354286      qualityAnalyzer = new BestAverageWorstQualityAnalyzer();
    355287      islandQualityAnalyzer = new BestAverageWorstQualityAnalyzer();
     
    360292      #region Create terminators
    361293
    362       generationsTerminator = new ComparisonTerminator<IntValue>("Generations", ComparisonType.Less, new IntValue(1000)) {
    363         Name = "Generations"
    364       };
    365       evaluationsTerminator = new ComparisonTerminator<IntValue>("EvaluatedSolutions", ComparisonType.Less,
    366         new IntValue(int.MaxValue)) {Name = "Evaluations"};
     294      generationsTerminator = new ComparisonTerminator<IntValue>("Generations", ComparisonType.Less, new IntValue(1000)) { Name = "Generations" };
     295      evaluationsTerminator = new ComparisonTerminator<IntValue>("EvaluatedSolutions", ComparisonType.Less, new IntValue(int.MaxValue)) {Name = "Evaluations"};
    367296      qualityTerminator = new SingleObjectiveQualityTerminator {Name = "Quality"};
    368297      executionTimeTerminator = new ExecutionTimeTerminator(this, new TimeSpanValue(TimeSpan.FromMinutes(5)));
     
    432361      globalEvaluatedSolutionsCounter.Successor = resultsCollector;
    433362      resultsCollector.Successor = mainLoop;
    434      
     363
    435364      #endregion
     365
    436366      #region parametrize
     367
    437368      ParameterizeAnalyzers();
    438369      UpdateAnalyzers();
     
    441372      ParameterizeAgeLimits();
    442373      ParametrizeMigration();
     374
    443375      #endregion
    444376
    445377      InitializeEventHandler();
     378    }
     379
     380    private void AddParameters() {
     381      #region ALPSParameter
     382
     383      Parameters.Add(new ValueParameter<IntValue>("AgeGap", "The frequency of reseeding the lowest layer and scaling factor for the age-limits for the layers.", new IntValue(5)));
     384      Parameters.Add(new ValueParameter<DoubleValue>("AgeInheritance", "A weight that determines the age of a child after crossover based on the older (1.0) and younger (0.0) parent.", new DoubleValue(1)));
     385      Parameters.Add(new ValueParameter<IntArray>("AgeLimits", "The maximum age an individual is allowed to reach in a certain layer.", new IntArray(new int[0])) {Hidden = true});
     386      Parameters.Add(new ValueParameter<EnumValue<AgingScheme>>("AgingScheme", "The aging scheme for setting the age-limits for the layers.", new EnumValue<AgingScheme>(ALPS.AgingScheme.Polynomial)));
     387      Parameters.Add(new ValueParameter<BoolValue>("ReduceToPopulationSize", ".", new BoolValue(true)));
     388
     389      Parameters.Add(new ValueParameter<IntValue>("NumberOfLayers", "", new IntValue(100000)));
     390      Parameters.Add(new ValueParameter<MultiAnalyzer>("LayerAnalyzer", "The operator used to analyze each layer.", new MultiAnalyzer()));
     391      Parameters.Add(new ValueParameter<MultiAnalyzer>("GroupAnalyzer", "The operator used to analyze each layergroup.", new MultiAnalyzer()));
     392      Parameters.Add(new ValueParameter<BoolValue>("PlusSelection", "Include the parents in the selection of the invividuals for the next generation.", new BoolValue(false)));
     393
     394      #endregion
     395
     396      #region IslandParameter
     397
     398      Parameters.Add(new ValueParameter<IntValue>("NumberOfIslands", "The number of islands.", new IntValue(5)));
     399      Parameters.Add(new ValueParameter<PercentValue>("MigrationRate", "How many individuals should migrate.", new PercentValue(0.15)));
     400      Parameters.Add(new ValueParameter<IntValue>("MigrationInterval", "The number Generations before a migration occurs.", new IntValue(20)));
     401      Parameters.Add(new ValueParameter<MultiAnalyzer>("IslandAnalyzer", "The operator used to analyze each island.", new MultiAnalyzer()));
     402      Parameters.Add(new ConstrainedValueParameter<IMigrator>("Migrator", "The migration strategy."));
     403      Parameters.Add(new ConstrainedValueParameter<ISelector>("EmigrantsSelector", "Selects the individuals that will be migrated."));
     404      Parameters.Add(new ConstrainedValueParameter<IReplacer>("ImmigrationReplacer", "Selects the population from the unification of the original population and the immigrants."));
     405
     406      #endregion
     407
     408      #region GeneralParameter   
     409
     410      Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
     411      Parameters.Add(new ValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
     412      Parameters.Add(new ValueParameter<IntValue>("PopulationSize", "The size of the population of solutions.", new IntValue(100)));
     413      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the islands.", new MultiAnalyzer()));
     414      Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction."));
     415      Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions."));
     416      Parameters.Add(new ValueParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new PercentValue(0.05)));
     417      Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
     418      Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1)));
     419      Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", new BoolValue(false)) {Hidden = true});
     420      Parameters.Add(new ValueParameter<MultiTerminator>("Terminator", "The termination criteria that defines if the algorithm should continue or stop.", new MultiTerminator()));
     421
     422      #endregion
    446423    }
    447424
     
    546523
    547524      //add analyzer
    548       GroupAnalyzer.Operators.Add(groupQualityAnalyzer, groupQualityAnalyzer.EnabledByDefault);
    549       LayerAnalyzer.Operators.Add(layerQualityAnalyzer, layerQualityAnalyzer.EnabledByDefault);
    550       IslandAnalyzer.Operators.Add(islandQualityAnalyzer, islandQualityAnalyzer.EnabledByDefault);
     525      GroupAnalyzer.Operators.Add(groupQualityAnalyzer, false);
     526      LayerAnalyzer.Operators.Add(layerQualityAnalyzer, false);
     527      IslandAnalyzer.Operators.Add(islandQualityAnalyzer, false);
    551528      Analyzer.Operators.Add(qualityAnalyzer, qualityAnalyzer.EnabledByDefault);
    552529      //depth for each analyzer gets set when added
     
    554531        foreach (var analyzer in Problem.Operators.OfType<IAnalyzer>()) {
    555532          Analyzer.Operators.Add(analyzer, analyzer.EnabledByDefault);
    556           IslandAnalyzer.Operators.Add((IAnalyzer)analyzer.Clone(),false);
    557           LayerAnalyzer.Operators.Add((IAnalyzer)analyzer.Clone(), false);
    558           GroupAnalyzer.Operators.Add((IAnalyzer) analyzer.Clone(),false);
     533          IslandAnalyzer.Operators.Add((IAnalyzer) analyzer.Clone(), false);
     534          LayerAnalyzer.Operators.Add((IAnalyzer) analyzer.Clone(), false);
     535          GroupAnalyzer.Operators.Add((IAnalyzer) analyzer.Clone(), false);
    559536        }
    560537      }
     
    583560        foreach (var terminator in Problem.Operators.OfType<ITerminator>())
    584561          newTerminators.Add(terminator,
    585             !Terminators.Operators.Contains(terminator) || Terminators.Operators.ItemChecked(terminator));
     562                             !Terminators.Operators.Contains(terminator) || Terminators.Operators.ItemChecked(terminator));
    586563      }
    587564
     
    600577      MigrationRateParameter.ValueChanged += MigrationRate_ValueChanged;
    601578
    602       Analyzer.Operators.ItemsAdded += AnalyzerOperators_ItemsAdded; 
     579      Analyzer.Operators.ItemsAdded += AnalyzerOperators_ItemsAdded;
    603580      IslandAnalyzer.Operators.ItemsAdded += IslandAnalyzerOperators_ItemsAdded;
    604581      LayerAnalyzer.Operators.ItemsAdded += LayerAnalyzerOperators_ItemsAdded;
     
    616593      NumberOfLayersParameter.ValueChanged += NumberOfLayersParameter_ValueChanged;
    617594      NumberOfLayers.ValueChanged += NumberOfLayers_ValueChanged;
    618 
    619595    }
    620596
    621597    private void MigrationRate_ValueChanged(object sender, EventArgs e) {
    622       var migrationSize = (int)Math.Ceiling(MigrationRateParameter.Value.Value * PopulationSize.Value);
     598      var migrationSize = (int) Math.Ceiling(MigrationRateParameter.Value.Value*PopulationSize.Value);
    623599      foreach (var selector in EmigrantsSelectorParameter.ValidValues) {
    624600        selector.NumberOfSelectedSubScopesParameter.Value = new IntValue(migrationSize);
     
    653629      }
    654630    }
     631
    655632    private void LayerAnalyzerOperators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IAnalyzer>> e) {
    656633      foreach (var analyzer in e.Items) {
     
    684661      ParameterizeSelectors();
    685662    }
     663
    686664    private void Elites_ValueChanged(object sender, EventArgs e) {
    687665      ParameterizeSelectors();
    688666    }
     667
    689668    private void PopulationSizeParameter_ValueChanged(object sender, EventArgs e) {
    690669      ParameterizeSelectors();
    691670    }
     671
    692672    private void PopulationSize_ValueChanged(object sender, EventArgs e) {
    693673      ParameterizeSelectors();
    694674    }
     675
    695676    private void NumberOfLayersParameter_ValueChanged(object sender, EventArgs e) {
    696677      NumberOfLayers.ValueChanged += NumberOfLayers_ValueChanged;
    697678      ParameterizeAgeLimits();
    698679    }
     680
    699681    private void NumberOfLayers_ValueChanged(object sender, EventArgs e) {
    700682      ParameterizeAgeLimits();
    701683    }
     684
    702685    private void AgeGapParameter_ValueChanged(object sender, EventArgs e) {
    703686      AgeGap.ValueChanged += AgeGap_ValueChanged;
    704687      ParameterizeAgeLimits();
    705688    }
     689
    706690    private void AgeGap_ValueChanged(object sender, EventArgs e) {
    707691      ParameterizeAgeLimits();
    708692    }
     693
    709694    private void AgingSchemeParameter_ValueChanged(object sender, EventArgs e) {
    710695      AgingScheme.ValueChanged += AgingScheme_ValueChanged;
    711696      ParameterizeAgeLimits();
    712697    }
     698
    713699    private void AgingScheme_ValueChanged(object sender, EventArgs e) {
    714700      ParameterizeAgeLimits();
     
    717703    private void ParameterizeAgeLimits() {
    718704      var scheme = AgingScheme.Value;
    719       int ageGap = AgeGap.Value;
    720       int numberOfLayers = NumberOfLayers.Value;
     705      var ageGap = AgeGap.Value;
     706      var numberOfLayers = NumberOfLayers.Value;
    721707      AgeLimits = scheme.CalculateAgeLimits(ageGap, numberOfLayers);
    722708    }
    723709
    724710    private void ParameterizeMainLoop() {
    725       //TODO
    726711      MainLoop.AgeGapParameter.ActualName = AgeGapParameter.Name;
    727712      MainLoop.AgeInheritanceParameter.ActualName = AgeInheritanceParameter.Name;
     
    744729      MainLoop.ImmigrationReplacerParameter.ActualName = ImmigrationReplacerParameter.Name;
    745730
    746 
    747 
    748731      MainLoop.PopulationSizeParameter.ActualName = PopulationSizeParameter.Name;
    749732      MainLoop.CurrentPopulationSizeParameter.ActualName = "CurrentPopulationSize";
     
    766749
    767750    private void ParametrizeMigration() {
    768       var migrationSize = (int) Math.Ceiling(MigrationRateParameter.Value.Value *PopulationSize.Value);
    769       foreach (ISelector selector in ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name)) {
     751      var migrationSize = (int) Math.Ceiling(MigrationRateParameter.Value.Value*PopulationSize.Value);
     752      foreach (var selector in ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name)) {
    770753        selector.NumberOfSelectedSubScopesParameter.Value = new IntValue(migrationSize);
    771754        selector.NumberOfSelectedSubScopesParameter.Hidden = true;
     
    776759      }
    777760
    778       foreach (IReplacer replacer in ApplicationManager.Manager.GetInstances<IReplacer>().OrderBy(x => x.Name)) {
     761      foreach (var replacer in ApplicationManager.Manager.GetInstances<IReplacer>().OrderBy(x => x.Name)) {
    779762        ParameterizeStochasticOperatorForLayer(replacer);
    780763        ImmigrationReplacerParameter.ValidValues.Add(replacer);
     
    807790          ParametrizeSingleObjectiveSelector(selector);
    808791        }
    809 
    810792      }
    811793    }
Note: See TracChangeset for help on using the changeset viewer.