Changeset 5725


Ignore:
Timestamp:
03/17/11 09:12:25 (11 years ago)
Author:
svonolfe
Message:

Implemented review comments from swagner (#1392)

Location:
trunk/sources
Files:
5 edited

Legend:

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

    r5683 r5725  
    565565      successfulOffspringAnalyzer.ResultsParameter.ActualName = "Results";
    566566      successfulOffspringAnalyzer.GenerationsParameter.ActualName = "Generations";
    567       successfulOffspringAnalyzer.SuccessfulOffspringFlag.Value.Value = "SuccessfulOffspring";
     567      successfulOffspringAnalyzer.SuccessfulOffspringFlagParameter.Value.Value = "SuccessfulOffspring";
    568568      successfulOffspringAnalyzer.DepthParameter.Value = new IntValue(2);
    569569
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithm.cs

    r5683 r5725  
    418418      successfulOffspringAnalyzer.ResultsParameter.ActualName = "Results";
    419419      successfulOffspringAnalyzer.GenerationsParameter.ActualName = "Generations";
    420       successfulOffspringAnalyzer.SuccessfulOffspringFlag.Value.Value = "SuccessfulOffspring";
     420      successfulOffspringAnalyzer.SuccessfulOffspringFlagParameter.Value.Value = "SuccessfulOffspring";
    421421      successfulOffspringAnalyzer.DepthParameter.Value = new IntValue(1);
    422422      if (Problem != null) {
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASA.cs

    r5683 r5725  
    503503      successfulOffspringAnalyzer.ResultsParameter.ActualName = "Results";
    504504      successfulOffspringAnalyzer.GenerationsParameter.ActualName = "Generations";
    505       successfulOffspringAnalyzer.SuccessfulOffspringFlag.Value.Value = "SuccessfulOffspring";
     505      successfulOffspringAnalyzer.SuccessfulOffspringFlagParameter.Value.Value = "SuccessfulOffspring";
    506506      successfulOffspringAnalyzer.DepthParameter.Value = new IntValue(2);
    507507
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SuccessfulOffspringAnalysis/SuccessfulOffspringAnalyzer.cs

    r5683 r5725  
    4040  [StorableClass]
    4141  public sealed class SuccessfulOffspringAnalyzer : SingleSuccessorOperator, IAnalyzer {
    42     public ValueParameter<StringValue> SuccessfulOffspringFlag {
     42    public ValueParameter<StringValue> SuccessfulOffspringFlagParameter {
    4343      get { return (ValueParameter<StringValue>)Parameters["SuccessfulOffspringFlag"]; }
    4444    }
    4545
    46     public ValueParameter<ItemCollection<StringValue>> CollectedValues {
     46    public ValueParameter<ItemCollection<StringValue>> CollectedValuesParameter {
    4747      get { return (ValueParameter<ItemCollection<StringValue>>)Parameters["CollectedValues"]; }
    4848    }
     
    5050    public ValueLookupParameter<ResultCollection> ResultsParameter {
    5151      get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; }
     52    }
     53
     54    public LookupParameter<ResultCollection> SuccessfulOffspringAnalysisParameter {
     55      get { return (LookupParameter<ResultCollection>)Parameters["SuccessfulOffspringAnalysis"];  }
    5256    }
    5357
     
    7175        Parameters.Add(new ValueParameter<ItemCollection<StringValue>>("CollectedValues", "The properties of the successful offspring that should be collected.", new ItemCollection<StringValue>()));
    7276        Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the succedd progress analysis results should be stored."));
    73         Parameters.Add(new LookupParameter<IntValue>("Generations", "The current number of generations."));
     77        Parameters.Add(new LookupParameter<IntValue>("Generations", "The current number of generations.")); 
     78        Parameters.Add(new LookupParameter<ResultCollection>("SuccessfulOffspringAnalysis", "The successful offspring analysis which is created."));
    7479        Parameters.Add(new ValueParameter<IntValue>("Depth", "The depth of the individuals in the scope tree.", new IntValue(1)));
    7580    }
     
    8287        scopes = scopes.Select(x => (IEnumerable<IScope>)x.SubScopes).Aggregate((a, b) => a.Concat(b)).ToList();
    8388
    84       ItemCollection<StringValue> collectedValues = CollectedValues.Value;
     89      ItemCollection<StringValue> collectedValues = CollectedValuesParameter.Value;
    8590        foreach (StringValue collected in collectedValues) {
    8691          //collect the values of the successful offspring
     
    8893          for (int i = 0; i < scopes.Count; i++) {
    8994            IScope child = scopes[i];
    90             string successfulOffspringFlag = SuccessfulOffspringFlag.Value.Value;
     95            string successfulOffspringFlag = SuccessfulOffspringFlagParameter.Value.Value;
    9196            if (child.Variables.ContainsKey(collected.Value) &&
    9297                child.Variables.ContainsKey(successfulOffspringFlag) &&
     
    103108
    104109          //create a data table containing the collected values
     110          ResultCollection successfulOffspringAnalysis;
     111
     112          if (SuccessfulOffspringAnalysisParameter.ActualValue == null) {
     113            successfulOffspringAnalysis = new ResultCollection();
     114            SuccessfulOffspringAnalysisParameter.ActualValue = successfulOffspringAnalysis;
     115          } else {
     116            successfulOffspringAnalysis = SuccessfulOffspringAnalysisParameter.ActualValue;
     117          }
     118
     119          string resultKey = "SuccessfulOffspringAnalyzer Results";
     120          if (!results.ContainsKey(resultKey)) {
     121            results.Add(new Result(resultKey, successfulOffspringAnalysis));
     122          } else {
     123            results[resultKey].Value = successfulOffspringAnalysis;
     124          }             
     125
    105126          DataTable successProgressAnalysis;
    106           string resultKey = "Success Progress " + collected.Value;
    107           if (!results.ContainsKey(resultKey)) {
     127          if (!successfulOffspringAnalysis.ContainsKey(collected.Value)) {
    108128            successProgressAnalysis = new DataTable();
    109             successProgressAnalysis.Name = "Success Progress Analysis";
    110             results.Add(new Result(resultKey, successProgressAnalysis));
     129            successProgressAnalysis.Name = collected.Value;
     130            successfulOffspringAnalysis.Add(new Result(collected.Value, successProgressAnalysis));
    111131          } else {
    112             successProgressAnalysis = results[resultKey].Value as DataTable;
    113           }
     132            successProgressAnalysis = successfulOffspringAnalysis[collected.Value].Value as DataTable;
     133          }         
    114134
    115135          int successfulCount = 0;
  • trunk/sources/HeuristicLab.Operators/3.3/StochasticMultiBranch.cs

    r5683 r5725  
    5252      get { return (ValueParameter<BoolValue>)Parameters["TraceSelectedOperator"]; }
    5353    }
    54     public ValueLookupParameter<StringValue> SelectedOperatorParameter {
    55       get { return (ValueLookupParameter<StringValue>)Parameters["SelectedOperator"]; }
     54    public LookupParameter<StringValue> SelectedOperatorParameter {
     55      get { return (LookupParameter<StringValue>)Parameters["SelectedOperator"]; }
    5656    }
    5757
     
    6565      #region Backwards Compatibility
    6666      if (!Parameters.ContainsKey("SelectedOperator")) {
    67         Parameters.Add(new ValueLookupParameter<StringValue>("SelectedOperator", "If the TraceSelectedOperator flag is set, the name of the operator is traced in this parameter."));
     67        Parameters.Add(new LookupParameter<StringValue>("SelectedOperator", "If the TraceSelectedOperator flag is set, the name of the operator is traced in this parameter."));
    6868      }
    6969      if (!Parameters.ContainsKey("TraceSelectedOperator")) {
     
    8686      Parameters.Add(new ValueLookupParameter<DoubleArray>("Probabilities", "The array of relative probabilities for each operator.", new DoubleArray()));
    8787      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use."));
    88       Parameters.Add(new ValueLookupParameter<StringValue>("SelectedOperator", "If the TraceSelectedOperator flag is set, the name of the operator is traced in this parameter."));
     88      Parameters.Add(new LookupParameter<StringValue>("SelectedOperator", "If the TraceSelectedOperator flag is set, the name of the operator is traced in this parameter."));
    8989      Parameters.Add(new ValueParameter<BoolValue>("TraceSelectedOperator", "Indicates, if the selected operator should be traced.", new BoolValue(false)));
    9090    }
Note: See TracChangeset for help on using the changeset viewer.