Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/21/13 16:55:07 (12 years ago)
Author:
bburlacu
Message:

#1772: Merged trunk changes for HeuristicLab.Problems.DataAnalysis.Symbolic. Added SymbolicDataAnalysisSolutionTextRenderer, a class for displaying symbolic expression trees in the console.

Location:
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Problems.DataAnalysis.Symbolic
Files:
3 edited

Legend:

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

  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4

    • Property svn:ignore
      •  

        old new  
         1*.user
         2Plugin.cs
        13bin
        2 *.user
        3 HeuristicLabProblemsDataAnalysisSymbolicPlugin.cs
        44obj
        5 *.vs10x
        6 Plugin.cs
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs

    r8557 r9241  
    5353    private const string FitnessCalculationPartitionParameterName = "FitnessCalculationPartition";
    5454    private const string ValidationPartitionParameterName = "ValidationPartition";
     55    private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
    5556
    5657    private const string ProblemDataParameterDescription = "";
     
    6465    private const string FitnessCalculationPartitionParameterDescription = "The partition of the problem data training partition, that should be used to calculate the fitness of an individual.";
    6566    private const string ValidationPartitionParameterDescription = "The partition of the problem data training partition, that should be used to select the best model from (optional).";
     67    private const string ApplyLinearScalingParameterDescription = "Flag that indicates if the individual should be linearly scaled before evaluating.";
    6668    #endregion
    6769
     
    100102      get { return (IFixedValueParameter<IntRange>)Parameters[ValidationPartitionParameterName]; }
    101103    }
     104    public IFixedValueParameter<BoolValue> ApplyLinearScalingParameter {
     105      get { return (IFixedValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; }
     106    }
    102107    #endregion
    103108
     
    144149    public IntRange ValidationPartition {
    145150      get { return ValidationPartitionParameter.Value; }
     151    }
     152    public BoolValue ApplyLinearScaling {
     153      get { return ApplyLinearScalingParameter.Value; }
    146154    }
    147155    #endregion
     
    151159    [StorableHook(HookType.AfterDeserialization)]
    152160    private void AfterDeserialization() {
     161      if (!Parameters.ContainsKey(ApplyLinearScalingParameterName)) {
     162        Parameters.Add(new FixedValueParameter<BoolValue>(ApplyLinearScalingParameterName, ApplyLinearScalingParameterDescription, new BoolValue(false)));
     163        ApplyLinearScalingParameter.Hidden = true;
     164
     165        //it is assumed that for all symbolic regression algorithms linear scaling was set to true
     166        //there is no possibility to determine the previous value of the parameter as it was stored in the evaluator
     167        if (GetType().Name.Contains("SymbolicRegression"))
     168          ApplyLinearScaling.Value = true;
     169      }
     170
    153171      RegisterEventHandlers();
    154172    }
     
    170188      Parameters.Add(new FixedValueParameter<IntRange>(ValidationPartitionParameterName, ValidationPartitionParameterDescription));
    171189      Parameters.Add(new FixedValueParameter<PercentValue>(RelativeNumberOfEvaluatedSamplesParameterName, RelativeNumberOfEvaluatedSamplesParameterDescription, new PercentValue(1)));
     190      Parameters.Add(new FixedValueParameter<BoolValue>(ApplyLinearScalingParameterName, ApplyLinearScalingParameterDescription, new BoolValue(false)));
    172191
    173192      SymbolicExpressionTreeInterpreterParameter.Hidden = true;
    174193      MaximumFunctionArgumentsParameter.Hidden = true;
    175194      MaximumFunctionDefinitionsParameter.Hidden = true;
     195      ApplyLinearScalingParameter.Hidden = true;
    176196
    177197      SymbolicExpressionTreeGrammar = new TypeCoherentExpressionGrammar();
     
    191211      SymbolicExpressionTreeGrammar.MaximumFunctionDefinitions = MaximumFunctionDefinitions.Value;
    192212      foreach (var varSymbol in SymbolicExpressionTreeGrammar.Symbols.OfType<HeuristicLab.Problems.DataAnalysis.Symbolic.Variable>()) {
    193         if (!varSymbol.Fixed) varSymbol.VariableNames = ProblemData.AllowedInputVariables;
     213        if (!varSymbol.Fixed) {
     214          varSymbol.AllVariableNames = ProblemData.InputVariables.Select(x => x.Value);
     215          varSymbol.VariableNames = ProblemData.AllowedInputVariables;
     216        }
    194217      }
    195218      foreach (var varSymbol in SymbolicExpressionTreeGrammar.Symbols.OfType<HeuristicLab.Problems.DataAnalysis.Symbolic.VariableCondition>()) {
    196         if (!varSymbol.Fixed) varSymbol.VariableNames = ProblemData.AllowedInputVariables;
     219        if (!varSymbol.Fixed) {
     220          varSymbol.AllVariableNames = ProblemData.InputVariables.Select(x => x.Value);
     221          varSymbol.VariableNames = ProblemData.AllowedInputVariables;
     222        }
    197223      }
    198224    }
     
    274300
    275301      foreach (var op in operators.OfType<ISymbolicExpressionTreeGrammarBasedOperator>()) {
    276         op.SymbolicExpressionTreeGrammarParameter.ActualName = SymbolicExpressionTreeGrammarParameterName;
     302        op.SymbolicExpressionTreeGrammarParameter.ActualName = SymbolicExpressionTreeGrammarParameter.Name;
    277303      }
    278304      foreach (var op in operators.OfType<ISymbolicExpressionTreeSizeConstraintOperator>()) {
    279         op.MaximumSymbolicExpressionTreeDepthParameter.ActualName = MaximumSymbolicExpressionTreeDepthParameterName;
    280         op.MaximumSymbolicExpressionTreeLengthParameter.ActualName = MaximumSymbolicExpressionTreeLengthParameterName;
     305        op.MaximumSymbolicExpressionTreeDepthParameter.ActualName = MaximumSymbolicExpressionTreeDepthParameter.Name;
     306        op.MaximumSymbolicExpressionTreeLengthParameter.ActualName = MaximumSymbolicExpressionTreeLengthParameter.Name;
    281307      }
    282308      foreach (var op in operators.OfType<ISymbolicExpressionTreeArchitectureAlteringOperator>()) {
    283         op.MaximumFunctionArgumentsParameter.ActualName = MaximumFunctionArgumentsParameterName;
    284         op.MaximumFunctionDefinitionsParameter.ActualName = MaximumFunctionDefinitionsParameterName;
     309        op.MaximumFunctionArgumentsParameter.ActualName = MaximumFunctionArgumentsParameter.Name;
     310        op.MaximumFunctionDefinitionsParameter.ActualName = MaximumFunctionDefinitionsParameter.Name;
    285311      }
    286312      foreach (var op in operators.OfType<ISymbolicDataAnalysisEvaluator<T>>()) {
     
    289315        op.EvaluationPartitionParameter.ActualName = FitnessCalculationPartitionParameter.Name;
    290316        op.RelativeNumberOfEvaluatedSamplesParameter.ActualName = RelativeNumberOfEvaluatedSamplesParameter.Name;
     317        op.ApplyLinearScalingParameter.ActualName = ApplyLinearScalingParameter.Name;
    291318      }
    292319      foreach (var op in operators.OfType<ISymbolicExpressionTreeCrossover>()) {
     
    300327        op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
    301328      }
     329      foreach (var op in operators.OfType<ISymbolicDataAnalysisSingleObjectiveAnalyzer>()) {
     330        op.ApplyLinearScalingParameter.ActualName = ApplyLinearScalingParameter.Name;
     331      }
     332      foreach (var op in operators.OfType<ISymbolicDataAnalysisMultiObjectiveAnalyzer>()) {
     333        op.ApplyLinearScalingParameter.ActualName = ApplyLinearScalingParameter.Name;
     334      }
    302335      foreach (var op in operators.OfType<ISymbolicDataAnalysisAnalyzer>()) {
    303336        op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
     
    308341      }
    309342      foreach (var op in operators.OfType<ISymbolicDataAnalysisInterpreterOperator>()) {
    310         op.SymbolicDataAnalysisTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameterName;
     343        op.SymbolicDataAnalysisTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter.Name;
    311344      }
    312345      foreach (var op in operators.OfType<ISymbolicDataAnalysisExpressionCrossover<T>>()) {
    313         op.EvaluationPartitionParameter.ActualName = FitnessCalculationPartitionParameterName;
    314       }
    315       foreach (var op in operators.OfType<ISymbolicDataAnalysisExpressionCrossover<T>>()) {
     346        op.EvaluationPartitionParameter.ActualName = FitnessCalculationPartitionParameter.Name;
    316347        op.ProblemDataParameter.ActualName = ProblemDataParameter.Name;
    317348        op.EvaluationPartitionParameter.ActualName = FitnessCalculationPartitionParameter.Name;
     
    331362      Description = data.Description;
    332363      ProblemData = data;
    333       OnReset();
    334364    }
    335365
Note: See TracChangeset for help on using the changeset viewer.