Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/17/14 13:09:55 (11 years ago)
Author:
mkommend
Message:

#1997: Merged trunk changes into symbolic islands branch.

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

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm

  • branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SuccessfulOffspringAnalysis/SuccessfulOffspringAnalyzer.cs

    r9756 r10354  
    8181      Parameters.Add(new LookupParameter<ResultCollection>("SuccessfulOffspringAnalysis", "The successful offspring analysis which is created."));
    8282      Parameters.Add(new ValueParameter<IntValue>("Depth", "The depth of the individuals in the scope tree.", new IntValue(1)));
     83
     84      CollectedValuesParameter.Value.Add(new StringValue("SelectedCrossoverOperator"));
     85      CollectedValuesParameter.Value.Add(new StringValue("SelectedManipulationOperator"));
    8386    }
    8487
     
    110113        }
    111114
    112         //create a data table containing the collected values
    113         ResultCollection successfulOffspringAnalysis;
     115        if (counts.Count > 0) {
     116          //create a data table containing the collected values
     117          ResultCollection successfulOffspringAnalysis;
    114118
    115         if (SuccessfulOffspringAnalysisParameter.ActualValue == null) {
    116           successfulOffspringAnalysis = new ResultCollection();
    117           SuccessfulOffspringAnalysisParameter.ActualValue = successfulOffspringAnalysis;
    118         } else {
    119           successfulOffspringAnalysis = SuccessfulOffspringAnalysisParameter.ActualValue;
    120         }
    121 
    122         string resultKey = "SuccessfulOffspringAnalyzer Results";
    123         if (!results.ContainsKey(resultKey)) {
    124           results.Add(new Result(resultKey, successfulOffspringAnalysis));
    125         } else {
    126           results[resultKey].Value = successfulOffspringAnalysis;
    127         }
    128 
    129         DataTable successProgressAnalysis;
    130         if (!successfulOffspringAnalysis.ContainsKey(collected.Value)) {
    131           successProgressAnalysis = new DataTable();
    132           successProgressAnalysis.Name = collected.Value;
    133           successfulOffspringAnalysis.Add(new Result(collected.Value, successProgressAnalysis));
    134         } else {
    135           successProgressAnalysis = successfulOffspringAnalysis[collected.Value].Value as DataTable;
    136         }
    137 
    138         int successfulCount = 0;
    139         foreach (string key in counts.Keys) {
    140           successfulCount += counts[key];
    141         }
    142 
    143         foreach (String value in counts.Keys) {
    144           DataRow row;
    145           if (!successProgressAnalysis.Rows.ContainsKey(value)) {
    146             row = new DataRow(value);
    147             int iterations = GenerationsParameter.ActualValue.Value;
    148 
    149             //fill up all values seen the first time
    150             for (int i = 1; i < iterations; i++)
    151               row.Values.Add(0);
    152 
    153             successProgressAnalysis.Rows.Add(row);
     119          if (SuccessfulOffspringAnalysisParameter.ActualValue == null) {
     120            successfulOffspringAnalysis = new ResultCollection();
     121            SuccessfulOffspringAnalysisParameter.ActualValue = successfulOffspringAnalysis;
    154122          } else {
    155             row = successProgressAnalysis.Rows[value];
     123            successfulOffspringAnalysis = SuccessfulOffspringAnalysisParameter.ActualValue;
    156124          }
    157125
    158           row.Values.Add(counts[value] / (double)successfulCount);
    159         }
     126          string resultKey = "SuccessfulOffspringAnalyzer Results";
     127          if (!results.ContainsKey(resultKey)) {
     128            results.Add(new Result(resultKey, successfulOffspringAnalysis));
     129          } else {
     130            results[resultKey].Value = successfulOffspringAnalysis;
     131          }
    160132
    161         //fill up all values that are not present in the current generation
    162         foreach (DataRow row in successProgressAnalysis.Rows) {
    163           if (!counts.ContainsKey(row.Name))
    164             row.Values.Add(0);
     133          DataTable successProgressAnalysis;
     134          if (!successfulOffspringAnalysis.ContainsKey(collected.Value)) {
     135            successProgressAnalysis = new DataTable();
     136            successProgressAnalysis.Name = collected.Value;
     137            successfulOffspringAnalysis.Add(new Result(collected.Value, successProgressAnalysis));
     138          } else {
     139            successProgressAnalysis = successfulOffspringAnalysis[collected.Value].Value as DataTable;
     140          }
     141
     142          int successfulCount = 0;
     143          foreach (string key in counts.Keys) {
     144            successfulCount += counts[key];
     145          }
     146
     147          foreach (String value in counts.Keys) {
     148            DataRow row;
     149            if (!successProgressAnalysis.Rows.ContainsKey(value)) {
     150              row = new DataRow(value);
     151              int iterations = GenerationsParameter.ActualValue.Value;
     152
     153              //fill up all values seen the first time
     154              for (int i = 1; i < iterations; i++)
     155                row.Values.Add(0);
     156
     157              successProgressAnalysis.Rows.Add(row);
     158            } else {
     159              row = successProgressAnalysis.Rows[value];
     160            }
     161
     162            row.Values.Add(counts[value] / (double)successfulCount);
     163          }
     164
     165          //fill up all values that are not present in the current generation
     166          foreach (DataRow row in successProgressAnalysis.Rows) {
     167            if (!counts.ContainsKey(row.Name))
     168              row.Values.Add(0);
     169          }
    165170        }
    166171      }
Note: See TracChangeset for help on using the changeset viewer.