Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10346


Ignore:
Timestamp:
01/16/14 14:30:40 (11 years ago)
Author:
svonolfe
Message:

improved usability of successful offspring analysis (#2138)

Location:
trunk/sources
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SuccessfulOffspringAnalysis/SuccessfulOffspringAnalyzer.cs

    r9456 r10346  
    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      }
  • trunk/sources/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Crossovers/MultiBinaryVectorCrossover.cs

    r10295 r10346  
    6464          Operators.Add((IBinaryVectorCrossover)Activator.CreateInstance(type), true);
    6565      }
     66
     67      SelectedOperatorParameter.ActualName = "SelectedCrossoverOperator";
    6668    }
    6769
  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Crossovers/MultiIntegerVectorCrossover.cs

    r10295 r10346  
    7070          Operators.Add((IIntegerVectorCrossover)Activator.CreateInstance(type), true);
    7171      }
     72
     73      SelectedOperatorParameter.ActualName = "SelectedCrossoverOperator";
    7274    }
    7375
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Crossovers/MultiPermutationCrossover.cs

    r10295 r10346  
    6464          Operators.Add((IPermutationCrossover)Activator.CreateInstance(type), true);
    6565      }
     66
     67      SelectedOperatorParameter.ActualName = "SelectedCrossoverOperator";
    6668    }
    6769
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Manipulators/MultiPermutationManipulator.cs

    r10295 r10346  
    5757          Operators.Add((IPermutationManipulator)Activator.CreateInstance(type), true);
    5858      }
     59
     60      SelectedOperatorParameter.ActualName = "SelectedManipulationOperator";
    5961    }
    6062
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Crossovers/MultiRealVectorCrossover.cs

    r10295 r10346  
    7070          Operators.Add((IRealVectorCrossover)Activator.CreateInstance(type), true);
    7171      }
     72
     73      SelectedOperatorParameter.ActualName = "SelectedCrossoverOperator";
    7274    }
    7375
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Manipulators/MultiRealVectorManipulator.cs

    r10295 r10346  
    6262      Operators.Add(new PolynomialOnePositionManipulator());
    6363      Operators.Add(new UniformOnePositionManipulator());
     64
     65      SelectedOperatorParameter.ActualName = "SelectedManipulationOperator";
    6466    }
    6567
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/ArchitectureManipulators/MultiSymbolicExpressionTreeArchitectureManipulator.cs

    r9456 r10346  
    106106      Operators = checkedItemList.AsReadOnly();
    107107      Operators_ItemsAdded(this, new CollectionItemsChangedEventArgs<IndexedItem<ISymbolicExpressionTreeManipulator>>(Operators.CheckedItems));
     108
     109      SelectedOperatorParameter.ActualName = "SelectedManipulationOperator";
    108110    }
    109111
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/MultiSymbolicExpressionTreeManipulator.cs

    r9456 r10346  
    8383      Operators = checkedItemList.AsReadOnly();
    8484      Operators_ItemsAdded(this, new CollectionItemsChangedEventArgs<IndexedItem<ISymbolicExpressionTreeManipulator>>(Operators.CheckedItems));
     85
     86      SelectedOperatorParameter.ActualName = "SelectedManipulationOperator";
    8587    }
    8688
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/MultiSymbolicDataAnalysisExpressionCrossover.cs

    r9456 r10346  
    109109      InitializeOperators();
    110110      name = "MultiSymbolicDataAnalysisExpressionCrossover";
     111
     112      SelectedOperatorParameter.ActualName = "SelectedCrossoverOperator";
    111113    }
    112114
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Crossovers/MultiVRPSolutionCrossover.cs

    r10295 r10346  
    6767      Parameters.Add(new LookupParameter<IVRPEncoding>("Child", "The child permutation resulting from the crossover."));
    6868      ChildParameter.ActualName = "VRPTours";
     69
     70      SelectedOperatorParameter.ActualName = "SelectedCrossoverOperator";
    6971    }
    7072
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Manipulators/MultiVRPSolutionManipulator.cs

    r10295 r10346  
    5959      Parameters.Add(new LookupParameter<IVRPProblemInstance>("ProblemInstance", "The VRP problem instance"));
    6060      Parameters.Add(new LookupParameter<IVRPEncoding>("VRPTours", "The VRP tours to be manipulated."));
     61
     62      SelectedOperatorParameter.ActualName = "SelectedManipulationOperator";
    6163    }
    6264
Note: See TracChangeset for help on using the changeset viewer.