Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10357


Ignore:
Timestamp:
01/20/14 14:52:57 (11 years ago)
Author:
mkommend
Message:

#1997: Corrected insertion of island indexes in symbolic island algorithms.

Location:
branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Algorithms.DataAnalysis.Symbolic/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Algorithms.DataAnalysis.Symbolic/3.3/SymbolicDataAnalysisIslandGeneticAlgorithm.cs

    r10356 r10357  
    7979      set { FixedSamplesPartitionsParameter.Value = value; }
    8080    }
     81
     82    private readonly ScopeTreeAssigner<IntValue> islandIndexAssigner;
    8183    #endregion
    8284
     
    102104      Parameters.Add(new LookupParameter<ISingleObjectiveEvaluator>(ProblemEvaluatorParameterName, "Internal parameter for name translation", "Evaluator"));
    103105
    104       ScopeTreeAssigner<IntValue> islandIndexAssigner = new ScopeTreeAssigner<IntValue>();
     106      islandIndexAssigner = new ScopeTreeAssigner<IntValue>();
    105107      islandIndexAssigner.Name = "Insert island index";
    106108      islandIndexAssigner.LeftSideParameter.ActualName = IslandIndexParameterName;
     
    129131      if (Problem != null) Problem.FitnessCalculationPartition.ValueChanged += Problem_Reset;
    130132      NumberOfIslandsParameter.ValueChanged += NumberOfIslandsParameter_ValueChanged;
    131       NumberOfIslandsParameter.Value.ValueChanged += (o, ev) => RecalculateFixedSamplesPartitions();
     133      NumberOfIslandsParameter.Value.ValueChanged += (o, ev) => NumberOfIslandsParameterValue_Changed();
    132134      FixedSamplesParameter.Value.ValueChanged += (o, e) => {
    133135        RecalculateFixedSamplesPartitions();
     
    170172
    171173    private void NumberOfIslandsParameter_ValueChanged(object sender, EventArgs e) {
    172       NumberOfIslands.ValueChanged += (o, ev) => RecalculateFixedSamplesPartitions();
     174      NumberOfIslands.ValueChanged += (o, ev) => NumberOfIslandsParameterValue_Changed();
     175      NumberOfIslandsParameterValue_Changed();
     176    }
     177    private void NumberOfIslandsParameterValue_Changed() {
     178      var readonlyIslandIndexes = Enumerable.Range(0, NumberOfIslands.Value).Select(x => (IntValue)new IntValue(x).AsReadOnly());
     179      islandIndexAssigner.RightSideParameter.Value = new ItemArray<IntValue>(readonlyIslandIndexes);
    173180      RecalculateFixedSamplesPartitions();
    174181    }
  • branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Algorithms.DataAnalysis.Symbolic/3.3/SymbolicDataAnalysisIslandOffspringSelectionGeneticAlgorithm.cs

    r10356 r10357  
    7979      set { FixedSamplesPartitionsParameter.Value = value; }
    8080    }
     81
     82    private readonly ScopeTreeAssigner<IntValue> islandIndexAssigner;
    8183    #endregion
    8284
     
    102104      Parameters.Add(new LookupParameter<ISingleObjectiveEvaluator>(ProblemEvaluatorParameterName, "Internal parameter for name translation", "Evaluator"));
    103105
    104       ScopeTreeAssigner<IntValue> islandIndexAssigner = new ScopeTreeAssigner<IntValue>();
     106      islandIndexAssigner = new ScopeTreeAssigner<IntValue>();
    105107      islandIndexAssigner.Name = "Insert island index";
    106108      islandIndexAssigner.LeftSideParameter.ActualName = IslandIndexParameterName;
     
    125127      if (Problem != null) Problem.FitnessCalculationPartition.ValueChanged += Problem_Reset;
    126128      NumberOfIslandsParameter.ValueChanged += NumberOfIslandsParameter_ValueChanged;
    127       NumberOfIslandsParameter.Value.ValueChanged += (o, ev) => RecalculateFixedSamplesPartitions();
     129      NumberOfIslandsParameter.Value.ValueChanged += (o, ev) => NumberOfIslandsParameterValue_Changed();
    128130      FixedSamplesParameter.Value.ValueChanged += (o, e) => {
    129131        RecalculateFixedSamplesPartitions();
     
    166168
    167169    private void NumberOfIslandsParameter_ValueChanged(object sender, EventArgs e) {
    168       NumberOfIslands.ValueChanged += (o, ev) => RecalculateFixedSamplesPartitions();
     170      NumberOfIslands.ValueChanged += (o, ev) => NumberOfIslandsParameterValue_Changed();
     171      NumberOfIslandsParameterValue_Changed();
     172    }
     173    private void NumberOfIslandsParameterValue_Changed() {
     174      var readonlyIslandIndexes = Enumerable.Range(0, NumberOfIslands.Value).Select(x => (IntValue)new IntValue(x).AsReadOnly());
     175      islandIndexAssigner.RightSideParameter.Value = new ItemArray<IntValue>(readonlyIslandIndexes);
    169176      RecalculateFixedSamplesPartitions();
    170177    }
Note: See TracChangeset for help on using the changeset viewer.