Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13096


Ignore:
Timestamp:
11/02/15 15:59:48 (9 years ago)
Author:
pfleck
Message:

#2269

  • Simplified operator graph in MainOperator.
  • Added item descriptions.
  • Removed unnecessary code.
Location:
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3
Files:
7 edited

Legend:

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

    r13095 r13096  
    215215
    216216    #region Helper Properties
    217     private RandomCreator GlobalRandomCreator {
    218       get { return (RandomCreator)OperatorGraph.InitialOperator; }
    219     }
    220217    private SolutionsCreator SolutionsCreator {
    221218      get { return OperatorGraph.Iterate().OfType<SolutionsCreator>().First(); }
     
    619616      int numberOfLayers = NumberOfLayers.Value;
    620617      AgeLimits = scheme.CalculateAgeLimits(ageGap, numberOfLayers);
    621       AgeLimits[AgeLimits.Length - 1] = int.MaxValue; // last layer infinite age limit
    622618    }
    623619
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainLoop.cs

    r13095 r13096  
    4343      get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
    4444    }
    45     public ILookupParameter<IntValue> MaximumGenerationsParameter {
    46       get { return (ILookupParameter<IntValue>)Parameters["MaximumGenerations"]; }
    47     }
    4845    public ILookupParameter<IOperator> AnalyzerParameter {
    4946      get { return (ILookupParameter<IOperator>)Parameters["Analyzer"]; }
     
    5653    public GeneticAlgorithmMainLoop MainOperator {
    5754      get { return OperatorGraph.Iterate().OfType<GeneticAlgorithmMainLoop>().First(); }
    58     }
    59     public EldersEmigrator EldersEmigrator {
    60       get { return OperatorGraph.Iterate().OfType<EldersEmigrator>().First(); }
    6155    }
    6256
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainOperator.cs

    r13095 r13096  
    4040
    4141      // Operator starts with calculating number of selected scopes base on plus/comma-selection replacement scheme
    42       var numberOfSubScopesBranch = new ConditionalBranch() { Name = "PlusSelection?" };
    43       var numberOfSelectedSubScopesPlusCalculator = new ExpressionCalculator() { Name = "NumberOfSelectedSubScopes = PopulationSize * 2" };
    44       var numberOfSelectedSubScopesCalculator = new ExpressionCalculator() { Name = "NumberOfSelectedSubScopes = (PopulationSize - Elites) * 2" };
     42      var numberOfSelectedSubScopesCalculator = new ExpressionCalculator() { Name = "NumberOfSelectedSubScopes = 2 * (PopulationSize - if PlusSelection then 0 else Elites)" };
    4543      var replacementBranch = new ConditionalBranch() { Name = "PlusSelection?" };
    4644
    4745      // Set new initial operator
    48       mainLoop.OperatorGraph.InitialOperator = numberOfSubScopesBranch;
    49 
    50       numberOfSubScopesBranch.ConditionParameter.ActualName = "PlusSelection";
    51       numberOfSubScopesBranch.TrueBranch = numberOfSelectedSubScopesPlusCalculator;
    52       numberOfSubScopesBranch.FalseBranch = numberOfSelectedSubScopesCalculator;
    53       numberOfSubScopesBranch.Successor = selector;
    54 
    55       numberOfSelectedSubScopesPlusCalculator.CollectedValues.Add(new LookupParameter<IntValue>("PopulationSize"));
    56       numberOfSelectedSubScopesPlusCalculator.ExpressionResultParameter.ActualName = "NumberOfSelectedSubScopes";
    57       numberOfSelectedSubScopesPlusCalculator.ExpressionParameter.Value = new StringValue("PopulationSize 2 * toint");
     46      mainLoop.OperatorGraph.InitialOperator = numberOfSelectedSubScopesCalculator;
    5847
    5948      numberOfSelectedSubScopesCalculator.CollectedValues.Add(new LookupParameter<IntValue>("PopulationSize"));
    6049      numberOfSelectedSubScopesCalculator.CollectedValues.Add(new LookupParameter<IntValue>("Elites"));
     50      numberOfSelectedSubScopesCalculator.CollectedValues.Add(new LookupParameter<BoolValue>("PlusSelection"));
    6151      numberOfSelectedSubScopesCalculator.ExpressionResultParameter.ActualName = "NumberOfSelectedSubScopes";
    62       numberOfSelectedSubScopesCalculator.ExpressionParameter.Value = new StringValue("PopulationSize Elites - 2 * toint");
     52      numberOfSelectedSubScopesCalculator.ExpressionParameter.Value = new StringValue("PopulationSize 0 Elites PlusSelection if - 2 * toint");
     53      numberOfSelectedSubScopesCalculator.Successor = selector;
    6354
    6455      // Use Elitism or Plus-Selection as replacement strategy
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerCreator.cs

    r13095 r13096  
    3232
    3333namespace HeuristicLab.Algorithms.ALPS {
    34   [Item("LayerCreator", "An operator which creates a new layer by cloning the oldest one and setting the variables accordingly.")]
     34  [Item("LayerCreator", "An operator which creates a new layer by cloning the current oldest one.")]
    3535  [StorableClass]
    3636  public sealed class LayerCreator : SingleSuccessorOperator {
     
    106106      }
    107107    }
    108 
    109108  }
    110109}
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerOpener.cs

    r13095 r13096  
    3030
    3131namespace HeuristicLab.Algorithms.ALPS {
    32   [Item("LayerOpener", "")]
     32  [Item("LayerOpener", "An operator that encapsules opening new layer for ALPS when required.")]
    3333  [StorableClass]
    3434  public sealed class LayerOpener : AlgorithmOperator {
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerReseeder.cs

    r13095 r13096  
    3131
    3232namespace HeuristicLab.Algorithms.ALPS {
    33   [Item("LayerReseeder", "")]
     33  [Item("LayerReseeder", "An operator that encapsulates the reseeding of the lowest layer in ALPS.")]
    3434  [StorableClass]
    3535  public sealed class LayerReseeder : SingleSuccessorOperator, IOperatorGraphOperator {
     
    8181
    8282      var subScopesCounter = new SubScopesCounter();
    83       //var continuousReseedingBranch = new ConditionalBranch() { Name = "ContinuousReseeding?" };
    84       //var reseedingIntervalCalculator = new ExpressionCalculator() { Name = "DoReseeding = Generation % AgeGap == 0" };
    85       //var doReseedingBranch = new ConditionalBranch() { Name = "DoReseeding?" };
    8683      var numberOfReplacedCalculator = new ExpressionCalculator() { Name = "NumberOfReplaced = if ContinuousReseeding then max(LayerPopulationSize - (PopulationSize - PopulationSize / AgeGap), 0) else PopulationSize" };
    8784      var numberOfNewIndividualsCalculator = new ExpressionCalculator() { Name = "NumberOfNewIndividuals = PopulationSize - (LayerPopulatioSize - NumberOfReplaced)" };
     
    9693      var subScopesCounter2 = new SubScopesCounter();
    9794
    98       //OperatorGraph.InitialOperator = continuousReseedingBranch;
    9995      OperatorGraph.InitialOperator = subScopesCounter;
    10096
     
    10298      subScopesCounter.AccumulateParameter.Value = new BoolValue(false);
    10399      subScopesCounter.Successor = numberOfReplacedCalculator;
    104 
    105       //continuousReseedingBranch.ConditionParameter.ActualName = "ContinuousReseeding";
    106       //continuousReseedingBranch.TrueBranch = numberOfChildrenCalculator;
    107       //continuousReseedingBranch.FalseBranch = reseedingIntervalCalculator;
    108 
    109       //reseedingIntervalCalculator.CollectedValues.Add(new LookupParameter<IntValue>("Generation"));
    110       //reseedingIntervalCalculator.CollectedValues.Add(new LookupParameter<IntValue>("AgeGap"));
    111       //reseedingIntervalCalculator.ExpressionResultParameter.ActualName = "DoReseeding";
    112       //reseedingIntervalCalculator.ExpressionParameter.Value = new StringValue("Generation AgeGap % 0 ==");
    113       //reseedingIntervalCalculator.Successor = doReseedingBranch;
    114 
    115       //doReseedingBranch.ConditionParameter.ActualName = "DoReseeding";
    116       //doReseedingBranch.TrueBranch = numberOfChildrenCalculator;
    117100
    118101      numberOfReplacedCalculator.CollectedValues.Add(new LookupParameter<BoolValue>("ContinuousReseeding"));
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/WeightingReducer.cs

    r13046 r13096  
    7777      return base.Apply();
    7878    }
    79 
    8079  }
    8180}
Note: See TracChangeset for help on using the changeset viewer.