Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/28/14 14:53:39 (11 years ago)
Author:
mkommend
Message:

#2170: Merged r10599 into stable.

Location:
stable
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer.cs

    r9456 r10906  
    3535  [Item("SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer", "An operator that analyzes the training best symbolic data analysis solution for single objective symbolic data analysis problems.")]
    3636  [StorableClass]
    37   public abstract class SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer<T> : SymbolicDataAnalysisSingleObjectiveAnalyzer
     37  public abstract class SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer<T> : SymbolicDataAnalysisSingleObjectiveAnalyzer, IIterationBasedOperator
     38
    3839    where T : class, ISymbolicDataAnalysisSolution {
    3940    private const string TrainingBestSolutionParameterName = "Best training solution";
    4041    private const string TrainingBestSolutionQualityParameterName = "Best training solution quality";
     42    private const string TrainingBestSolutionGenerationParameterName = "Best training solution generation";
    4143    private const string UpdateAlwaysParameterName = "Always update best solution";
     44    private const string IterationsParameterName = "Iterations";
     45    private const string MaximumIterationsParameterName = "Maximum Iterations";
    4246
    4347    #region parameter properties
     
    4852      get { return (ILookupParameter<DoubleValue>)Parameters[TrainingBestSolutionQualityParameterName]; }
    4953    }
     54    public ILookupParameter<IntValue> TrainingBestSolutionGenerationParameter {
     55      get { return (ILookupParameter<IntValue>)Parameters[TrainingBestSolutionGenerationParameterName]; }
     56    }
    5057    public IFixedValueParameter<BoolValue> UpdateAlwaysParameter {
    5158      get { return (IFixedValueParameter<BoolValue>)Parameters[UpdateAlwaysParameterName]; }
     59    }
     60    public ILookupParameter<IntValue> IterationsParameter {
     61      get { return (ILookupParameter<IntValue>)Parameters[IterationsParameterName]; }
     62    }
     63    public IValueLookupParameter<IntValue> MaximumIterationsParameter {
     64      get { return (IValueLookupParameter<IntValue>)Parameters[MaximumIterationsParameterName]; }
    5265    }
    5366    #endregion
     
    7386      Parameters.Add(new LookupParameter<T>(TrainingBestSolutionParameterName, "The training best symbolic data analyis solution."));
    7487      Parameters.Add(new LookupParameter<DoubleValue>(TrainingBestSolutionQualityParameterName, "The quality of the training best symbolic data analysis solution."));
     88      Parameters.Add(new LookupParameter<IntValue>(TrainingBestSolutionGenerationParameterName, "The generation in which the best training solution was found."));
    7589      Parameters.Add(new FixedValueParameter<BoolValue>(UpdateAlwaysParameterName, "Determines if the best training solution should always be updated regardless of its quality.", new BoolValue(false)));
     90      Parameters.Add(new LookupParameter<IntValue>(IterationsParameterName, "The number of performed iterations."));
     91      Parameters.Add(new ValueLookupParameter<IntValue>(MaximumIterationsParameterName, "The maximum number of performed iterations.") { Hidden = true });
    7692      UpdateAlwaysParameter.Hidden = true;
    7793    }
     
    8399        UpdateAlwaysParameter.Hidden = true;
    84100      }
     101      if (!Parameters.ContainsKey(TrainingBestSolutionGenerationParameterName))
     102        Parameters.Add(new LookupParameter<IntValue>(TrainingBestSolutionGenerationParameterName, "The generation in which the best training solution was found."));
     103      if (!Parameters.ContainsKey(IterationsParameterName))
     104        Parameters.Add(new LookupParameter<IntValue>(IterationsParameterName, "The number of performed iterations."));
     105      if (!Parameters.ContainsKey(MaximumIterationsParameterName))
     106        Parameters.Add(new ValueLookupParameter<IntValue>(MaximumIterationsParameterName, "The maximum number of performed iterations.") { Hidden = true });
    85107    }
    86108
     
    104126        TrainingBestSolution = CreateSolution(bestTree, bestQuality);
    105127        TrainingBestSolutionQuality = new DoubleValue(bestQuality);
     128        if (IterationsParameter.ActualValue != null)
     129          TrainingBestSolutionGenerationParameter.ActualValue = new IntValue(IterationsParameter.ActualValue.Value);
    106130
    107131        if (!results.ContainsKey(TrainingBestSolutionParameter.Name)) {
    108132          results.Add(new Result(TrainingBestSolutionParameter.Name, TrainingBestSolutionParameter.Description, TrainingBestSolution));
    109133          results.Add(new Result(TrainingBestSolutionQualityParameter.Name, TrainingBestSolutionQualityParameter.Description, TrainingBestSolutionQuality));
     134          if (TrainingBestSolutionGenerationParameter.ActualValue != null)
     135            results.Add(new Result(TrainingBestSolutionGenerationParameter.Name, TrainingBestSolutionGenerationParameter.Description, TrainingBestSolutionGenerationParameter.ActualValue));
    110136        } else {
    111137          results[TrainingBestSolutionParameter.Name].Value = TrainingBestSolution;
    112138          results[TrainingBestSolutionQualityParameter.Name].Value = TrainingBestSolutionQuality;
     139          if (TrainingBestSolutionGenerationParameter.ActualValue != null)
     140            results[TrainingBestSolutionGenerationParameter.Name].Value = TrainingBestSolutionGenerationParameter.ActualValue;
     141
    113142        }
    114143      }
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer.cs

    r10592 r10906  
    3737  [Item("SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer", "An operator that analyzes the validation best symbolic data analysis solution for single objective symbolic data analysis problems.")]
    3838  [StorableClass]
    39   public abstract class SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<S, T, U> : SymbolicDataAnalysisSingleObjectiveValidationAnalyzer<T, U>
     39  public abstract class SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<S, T, U> : SymbolicDataAnalysisSingleObjectiveValidationAnalyzer<T, U>, IIterationBasedOperator
    4040    where S : class, ISymbolicDataAnalysisSolution
    4141    where T : class, ISymbolicDataAnalysisSingleObjectiveEvaluator<U>
     
    4343    private const string ValidationBestSolutionParameterName = "Best validation solution";
    4444    private const string ValidationBestSolutionQualityParameterName = "Best validation solution quality";
     45    private const string ValidationBestSolutionGenerationParameterName = "Best validation solution generation";
    4546    private const string UpdateAlwaysParameterName = "Always update best solution";
     47    private const string IterationsParameterName = "Iterations";
     48    private const string MaximumIterationsParameterName = "Maximum Iterations";
    4649
    4750    #region parameter properties
     
    5255      get { return (ILookupParameter<DoubleValue>)Parameters[ValidationBestSolutionQualityParameterName]; }
    5356    }
     57    public ILookupParameter<IntValue> ValidationBestSolutionGenerationParameter {
     58      get { return (ILookupParameter<IntValue>)Parameters[ValidationBestSolutionGenerationParameterName]; }
     59    }
    5460    public IFixedValueParameter<BoolValue> UpdateAlwaysParameter {
    5561      get { return (IFixedValueParameter<BoolValue>)Parameters[UpdateAlwaysParameterName]; }
     62    }
     63    public ILookupParameter<IntValue> IterationsParameter {
     64      get { return (ILookupParameter<IntValue>)Parameters[IterationsParameterName]; }
     65    }
     66    public IValueLookupParameter<IntValue> MaximumIterationsParameter {
     67      get { return (IValueLookupParameter<IntValue>)Parameters[MaximumIterationsParameterName]; }
    5668    }
    5769    #endregion
     
    7789      Parameters.Add(new LookupParameter<S>(ValidationBestSolutionParameterName, "The validation best symbolic data analyis solution."));
    7890      Parameters.Add(new LookupParameter<DoubleValue>(ValidationBestSolutionQualityParameterName, "The quality of the validation best symbolic data analysis solution."));
     91      Parameters.Add(new LookupParameter<IntValue>(ValidationBestSolutionGenerationParameterName, "The generation in which the best validation solution was found."));
    7992      Parameters.Add(new FixedValueParameter<BoolValue>(UpdateAlwaysParameterName, "Determines if the best validation solution should always be updated regardless of its quality.", new BoolValue(false)));
     93      Parameters.Add(new LookupParameter<IntValue>(IterationsParameterName, "The number of performed iterations."));
     94      Parameters.Add(new ValueLookupParameter<IntValue>(MaximumIterationsParameterName, "The maximum number of performed iterations.") { Hidden = true });
    8095      UpdateAlwaysParameter.Hidden = true;
    8196    }
     
    8499    private void AfterDeserialization() {
    85100      if (!Parameters.ContainsKey(UpdateAlwaysParameterName)) {
    86         Parameters.Add(new FixedValueParameter<BoolValue>(UpdateAlwaysParameterName, "Determines if the best training solution should always be updated regardless of its quality.", new BoolValue(false)));
     101        Parameters.Add(new FixedValueParameter<BoolValue>(UpdateAlwaysParameterName, "Determines if the best validation solution should always be updated regardless of its quality.", new BoolValue(false)));
    87102        UpdateAlwaysParameter.Hidden = true;
    88103      }
     104      if (!Parameters.ContainsKey(ValidationBestSolutionGenerationParameterName))
     105        Parameters.Add(new LookupParameter<IntValue>(ValidationBestSolutionGenerationParameterName, "The generation in which the best validation solution was found."));
     106      if (!Parameters.ContainsKey(IterationsParameterName))
     107        Parameters.Add(new LookupParameter<IntValue>(IterationsParameterName, "The number of performed iterations."));
     108      if (!Parameters.ContainsKey(MaximumIterationsParameterName))
     109        Parameters.Add(new ValueLookupParameter<IntValue>(MaximumIterationsParameterName, "The maximum number of performed iterations.") { Hidden = true });
    89110    }
    90111
     
    137158        ValidationBestSolution = CreateSolution(bestTree, bestValidationQuality);
    138159        ValidationBestSolutionQuality = new DoubleValue(bestValidationQuality);
     160        if (IterationsParameter.ActualValue != null)
     161          ValidationBestSolutionGenerationParameter.ActualValue = new IntValue(IterationsParameter.ActualValue.Value);
    139162
    140163        if (!results.ContainsKey(ValidationBestSolutionParameter.Name)) {
    141164          results.Add(new Result(ValidationBestSolutionParameter.Name, ValidationBestSolutionParameter.Description, ValidationBestSolution));
    142165          results.Add(new Result(ValidationBestSolutionQualityParameter.Name, ValidationBestSolutionQualityParameter.Description, ValidationBestSolutionQuality));
     166          if (ValidationBestSolutionGenerationParameter.ActualValue != null)
     167            results.Add(new Result(ValidationBestSolutionGenerationParameter.Name, ValidationBestSolutionGenerationParameter.Description, ValidationBestSolutionGenerationParameter.ActualValue));
    143168        } else {
    144169          results[ValidationBestSolutionParameter.Name].Value = ValidationBestSolution;
    145170          results[ValidationBestSolutionQualityParameter.Name].Value = ValidationBestSolutionQuality;
     171          if (ValidationBestSolutionGenerationParameter.ActualValue != null)
     172            results[ValidationBestSolutionGenerationParameter.Name].Value = ValidationBestSolutionGenerationParameter.ActualValue;
    146173        }
    147174      }
Note: See TracChangeset for help on using the changeset viewer.