Free cookie consent management tool by TermsFeed Policy Generator

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

#2350

  • Changed PopulationSize parameter to IntValue.
  • Implemented TryMoveUp procedure in AlpsSsMover.
Location:
branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3
Files:
1 added
4 edited

Legend:

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

    r12138 r12142  
    4040  public class AlpsSsGeneticAlgorithm : Alps {
    4141    #region Parameter Properties
    42     private IValueParameter<IntArray> PopulationSizeParameter {
    43       get { return (IValueParameter<IntArray>)Parameters["PopulationSize"]; }
     42    private IValueParameter<IntValue> PopulationSizeParameter {
     43      get { return (IValueParameter<IntValue>)Parameters["PopulationSize"]; }
    4444    }
    4545    private IValueParameter<IntValue> MaximumIterationsParameter {
     
    6767
    6868    #region Properties
    69     public IntArray PopulationSize {
     69    public IntValue PopulationSize {
    7070      get { return PopulationSizeParameter.Value; }
    7171      set { PopulationSizeParameter.Value = value; }
     
    119119    public AlpsSsGeneticAlgorithm()
    120120      : base() {
    121       Parameters.Add(new ValueParameter<IntArray>("PopulationSize", "The size of the population of solutions each layer.", new IntArray(new[] { 100 })));
     121      Parameters.Add(new ValueParameter<IntValue>("PopulationSize", "The size of the population of solutions each layer.", new IntValue(100)));
    122122      Parameters.Add(new ValueParameter<IntValue>("MaximumIterations", "The maximum number of iterations that should be processed.", new IntValue(1000)));
    123123      Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction."));
     
    131131      var randomCreator = new RandomCreator();
    132132      var layer0Creator = new SubScopesCreator() { Name = "Create Layer Zero" };
    133       var layer0Processor = new LayerUniformSubScopesProcessor();
     133      var layer0Processor = new /*Layer*/UniformSubScopesProcessor();
    134134      var layer0VariableCreator = new VariableCreator();
    135135      var layer0SolutionsCreator = new SolutionsCreator();
  • branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/AlpsSsGeneticAlgorithmMainLoop.cs

    r12138 r12142  
    7171
    7272      var variableCreator = new VariableCreator() { Name = "Initialize" };
    73       var randomScopeProcessor = new RandomLayerProcessor() { Name = "Select a layer" }; // TODO LayerSubScopeProcessor for Array conversion
     73      var randomScopeProcessor = new RandomLayerProcessor() { Name = "Select a layer" };
    7474      var isLayerZeroComperator = new Comparator() { Name = "IsLayerZero = Layer == 0" };
    7575      var isLayerZeroBranch = new ConditionalBranch() { Name = "IsLayerZero?" };
     
    9595      var resetTargetIndex = new Assigner() { Name = "TargetIndex = 0" };
    9696      var clearMatingPool = new SubScopesRemover() { Name = "Clear WorkingScope" };
    97       var tryMoveUp = new EmptyOperator() { Name = "Try Move Up" }; // TODO
    98       var setNewIndividual = new EmptyOperator() { Name = "Set New Individual" }; // TODO
     97      var tryMoveUp = new AlpsSsMover() { Name = "Try Move Up" };
     98      var removeWorkingScope = new LeftReducer() { Name = "Remove Working Scope" };
    9999      var incrIterations = new IntCounter() { Name = "Incr. Iterations" };
     100      var layerAnalyzerProcessor = new UniformSubScopesProcessor();
     101      var layerAnalyzer = new Placeholder() { Name = "LayerAnalyzer (Placeholder)" };
    100102      var analyzer = new Placeholder() { Name = "Analyzer (Placeholder)" };
    101103      var iterationsComparator = new Comparator() { Name = "Iterations >= MaximumIterations" };
     
    109111      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("OpenLayers", new IntValue(1)));
    110112      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("TargetIndex", new IntValue(0)));
    111       variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations"));
     113      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0)));
     114      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("MatingPoolSize", new IntValue(0)));
     115      variableCreator.CollectedValues.Add(new ValueParameter<BoolValue>("ValidParents", new BoolValue(false)));
    112116      variableCreator.Successor = randomScopeProcessor;
    113117
     
    161165      selectRandomTargetIndex.MinimumParameter.Value = new IntValue(0);
    162166      selectRandomTargetIndex.MaximumParameter.ActualName = "PopulationSize";
     167      selectRandomTargetIndex.MaximumParameter.Value = null;
    163168      selectRandomTargetIndex.Successor = copyLayer;
    164169
     
    199204      clearMatingPool.Successor = createRandomIndividual;
    200205
    201       tryMoveUp.Successor = setNewIndividual;
    202 
    203       setNewIndividual.Successor = incrIterations;
     206      tryMoveUp.Successor = removeWorkingScope;
     207
     208      removeWorkingScope.Successor = incrIterations;
    204209
    205210      incrIterations.ValueParameter.ActualName = "Iterations";
    206211      incrIterations.Increment = new IntValue(1);
    207       incrIterations.Successor = analyzer;
     212      incrIterations.Successor = layerAnalyzerProcessor;
     213
     214      layerAnalyzerProcessor.Operator = layerAnalyzer;
     215      layerAnalyzerProcessor.Successor = analyzer;
     216
     217      layerAnalyzer.OperatorParameter.ActualName = "LayerAnalyzer";
    208218
    209219      analyzer.OperatorParameter.ActualName = "Analyzer";
  • branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/HeuristicLab.Algorithms.ALPS.SteadyState-3.3.csproj

    r12138 r12142  
    137137    <Compile Include="AlpsSsGeneticAlgorithmMainLoop.cs" />
    138138    <Compile Include="AlpsSsGeneticAlgorithmMainOperator.cs" />
     139    <Compile Include="AlpsSsMover.cs" />
    139140    <Compile Include="Properties\AssemblyInfo.cs" />
    140141    <Compile Include="Plugin.cs" />
  • branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/RandomLayerProcessor.cs

    r12136 r12142  
    4141    }
    4242
    43     private ILookupParameter<IntArray> PopulationSizeParameter {
    44       get { return (ILookupParameter<IntArray>)Parameters["PopulationSize"]; }
    45     }
    46 
    4743    public IOperator Operator {
    4844      get { return OperatorParameter.Value; }
     
    5955      Parameters.Add(new OperatorParameter("Operator", "The operator which should be applied on a random sub-scopes of the current scope."));
    6056      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use."));
    61 
    62       Parameters.Add(new LookupParameter<IntArray>("PopulationSize"));
    6357    }
    6458
     
    7468        var subScopes = ExecutionContext.Scope.SubScopes;
    7569        int index = random.Next(subScopes.Count);
    76         var selectedLayer = subScopes[index];
    77 
    78         var layerParameters = new LayerIntermediateParameter {
    79             new ValueParameter<IntValue>(PopulationSizeParameter.ActualName, new IntValue(PopulationSizeParameter.ActualValue[Math.Min(index, PopulationSizeParameter.ActualValue.Length - 1)]))
    80           };
    81         var immediateContext = new ExecutionContext(ExecutionContext.Parent, layerParameters, selectedLayer);
    82         next.Insert(0, immediateContext.CreateChildOperation(Operator, selectedLayer));
     70        next.Insert(0, ExecutionContext.CreateOperation(Operator, subScopes[index]));
    8371      }
    8472      return next;
Note: See TracChangeset for help on using the changeset viewer.