Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/18/14 16:39:50 (10 years ago)
Author:
bburlacu
Message:

#1772: Merged trunk changes.

Location:
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic

  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer.cs

    r9456 r11208  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    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
     
    121142      var quality = tree
    122143        .Take(topN)
    123         .AsParallel()
    124144        .Select(t => evaluator.Evaluate(childContext, t, problemData, rows))
    125145        .ToArray();
     
    138158        ValidationBestSolution = CreateSolution(bestTree, bestValidationQuality);
    139159        ValidationBestSolutionQuality = new DoubleValue(bestValidationQuality);
     160        if (IterationsParameter.ActualValue != null)
     161          ValidationBestSolutionGenerationParameter.ActualValue = new IntValue(IterationsParameter.ActualValue.Value);
    140162
    141163        if (!results.ContainsKey(ValidationBestSolutionParameter.Name)) {
    142164          results.Add(new Result(ValidationBestSolutionParameter.Name, ValidationBestSolutionParameter.Description, ValidationBestSolution));
    143165          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));
    144168        } else {
    145169          results[ValidationBestSolutionParameter.Name].Value = ValidationBestSolution;
    146170          results[ValidationBestSolutionQualityParameter.Name].Value = ValidationBestSolutionQuality;
     171          if (ValidationBestSolutionGenerationParameter.ActualValue != null)
     172            results[ValidationBestSolutionGenerationParameter.Name].Value = ValidationBestSolutionGenerationParameter.ActualValue;
    147173        }
    148174      }
Note: See TracChangeset for help on using the changeset viewer.