Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12138 for branches


Ignore:
Timestamp:
03/05/15 13:35:38 (10 years ago)
Author:
pfleck
Message:

#2350

  • Added the AlpsSsGeneticAlgorithmMainOperator.
  • Changed some minor things.
Location:
branches/ALPS
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/AlpsSsGeneticAlgorithm.cs

    r12136 r12138  
    102102    #endregion
    103103
     104    private AlpsSsGeneticAlgorithmMainLoop MainLoop {
     105      get { return OperatorGraph.Iterate().OfType<AlpsSsGeneticAlgorithmMainLoop>().First(); }
     106    }
     107
    104108    [StorableConstructor]
    105109    private AlpsSsGeneticAlgorithm(bool deserializing)
     
    160164      initializeAgeProcessor.Successor = initializeLayerPopulationSize;
    161165
    162       initializeAge.CollectedValues.Add(new ValueParameter<IntValue>("Age", new IntValue(1)));
     166      initializeAge.CollectedValues.Add(new ValueParameter<IntValue>("EvalsCreated", new IntValue(1)));
    163167
    164168      initializeLayerPopulationSize.ValueParameter.ActualName = "LayerPopulationSize";
     
    237241    }
    238242    private void ParameterizeMainLoop() {
    239       //MainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
    240       //MainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
     243      MainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
     244      MainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
    241245      //MainLoop.MainOperator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
    242246      //MainLoop.MainOperator.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
     
    247251      foreach (var selector in SelectorParameter.ValidValues) {
    248252        selector.CopySelected = new BoolValue(true);
    249         // Explicit setting of NumberOfSelectedSubScopesParameter is not required anymore because the NumberOfSelectedSubScopesCalculator calculates it itself
    250         //selector.NumberOfSelectedSubScopesParameter.Value = new IntValue(2 * (PopulationSize - Elites.Value));
     253        selector.NumberOfSelectedSubScopesParameter.Value = new IntValue(2);
    251254        selector.NumberOfSelectedSubScopesParameter.Hidden = true;
    252255        ParameterizeStochasticOperatorForLayer(selector);
     
    272275    }
    273276
     277    protected override void ParameterizeStochasticOperator(IOperator @operator) {
     278      var stochasticOperator = @operator as IStochasticOperator;
     279      if (stochasticOperator != null) {
     280        stochasticOperator.RandomParameter.ActualName = "Random";
     281        stochasticOperator.RandomParameter.Hidden = true;
     282      }
     283    }
    274284    protected override void ParameterizeStochasticOperatorForLayer(IOperator @operator) {
    275285      var stochasticOperator = @operator as IStochasticOperator;
    276286      if (stochasticOperator != null) {
    277         stochasticOperator.RandomParameter.ActualName = GlobalRandomCreator.Name;
     287        stochasticOperator.RandomParameter.ActualName = "Random";
    278288        stochasticOperator.RandomParameter.Hidden = true;
    279289      }
    280290    }
    281 
    282291    #endregion
    283292
  • branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/AlpsSsGeneticAlgorithmMainLoop.cs

    r12136 r12138  
    2020#endregion
    2121
     22using System.Linq;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
    2526using HeuristicLab.Operators;
     27using HeuristicLab.Optimization;
    2628using HeuristicLab.Optimization.Operators;
    2729using HeuristicLab.Parameters;
     
    8890      var matingPoolSizeMin2 = new Comparator() { Name = "ValidParents = MatingPoolSize >= 2" };
    8991      var validParentsBranch = new ConditionalBranch() { Name = "ValidParents?" };
    90       var mainOperator = new EmptyOperator(); // TODO
     92      var mainOperator = new AlpsSsGeneticAlgorithmMainOperator();
    9193      var reactivateInit = new Assigner() { Name = "DoInit = true" };
    9294      var resetNextIndex = new Assigner() { Name = "NextInit = 1" };
     
    9496      var clearMatingPool = new SubScopesRemover() { Name = "Clear WorkingScope" };
    9597      var tryMoveUp = new EmptyOperator() { Name = "Try Move Up" }; // TODO
    96       var setNewIndividual = new EmptyOperator() { Name = "Set New Individual" };
     98      var setNewIndividual = new EmptyOperator() { Name = "Set New Individual" }; // TODO
     99      var incrIterations = new IntCounter() { Name = "Incr. Iterations" };
     100      var analyzer = new Placeholder() { Name = "Analyzer (Placeholder)" };
    97101      var iterationsComparator = new Comparator() { Name = "Iterations >= MaximumIterations" };
    98102      var terminateBranch = new ConditionalBranch() { Name = "Terminate?" };
     
    105109      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("OpenLayers", new IntValue(1)));
    106110      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("TargetIndex", new IntValue(0)));
     111      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations"));
    107112      variableCreator.Successor = randomScopeProcessor;
    108113
     
    176181      matingPoolSizeMin2.Successor = validParentsBranch;
    177182
     183      validParentsBranch.ConditionParameter.ActualName = "ValidParents";
    178184      validParentsBranch.TrueBranch = mainOperator;
    179185      validParentsBranch.FalseBranch = reactivateInit;
     
    195201      tryMoveUp.Successor = setNewIndividual;
    196202
    197       setNewIndividual.Successor = iterationsComparator;
     203      setNewIndividual.Successor = incrIterations;
     204
     205      incrIterations.ValueParameter.ActualName = "Iterations";
     206      incrIterations.Increment = new IntValue(1);
     207      incrIterations.Successor = analyzer;
     208
     209      analyzer.OperatorParameter.ActualName = "Analyzer";
     210      analyzer.Successor = iterationsComparator;
    198211
    199212      iterationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
     
    205218      terminateBranch.ConditionParameter.ActualName = "Terminate";
    206219      terminateBranch.FalseBranch = randomScopeProcessor;
    207 
    208 
    209     }
    210 
     220    }
    211221  }
    212222}
  • branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/HeuristicLab.Algorithms.ALPS.SteadyState-3.3.csproj

    r12136 r12138  
    136136    <Compile Include="AlpsSsGeneticAlgorithm.cs" />
    137137    <Compile Include="AlpsSsGeneticAlgorithmMainLoop.cs" />
     138    <Compile Include="AlpsSsGeneticAlgorithmMainOperator.cs" />
    138139    <Compile Include="Properties\AssemblyInfo.cs" />
    139140    <Compile Include="Plugin.cs" />
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Alps.cs

    r12120 r12138  
    309309      var stochasticOperator = @operator as IStochasticOperator;
    310310      if (stochasticOperator != null) {
    311         stochasticOperator.RandomParameter.ActualName = GlobalRandomCreator.RandomParameter.ActualName;
     311        stochasticOperator.RandomParameter.ActualName = "GlobalRandom";
    312312        stochasticOperator.RandomParameter.Hidden = true;
    313313      }
Note: See TracChangeset for help on using the changeset viewer.