Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/29/09 18:28:45 (15 years ago)
Author:
gkronber
Message:

GP Refactoring #713

  • introduced a plugin for GP interfaces
  • created a new interface IGeneticProgrammingModel which represents GP models in HL scopes instead of IFunctionTree
  • changed interfaces IFunction and IFunctionTree
  • moved some files to new directories (general housekeeping)
  • changed all GP operators and engines to work with IGeneticProgrammingModels
  • removed parameters TreeSize and TreeHeight in all GP operators
  • changed parameter OperatorLibrary to FunctionLibrary in all GP operators
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Variable.cs

    r2202 r2210  
    3030using HeuristicLab.Random;
    3131using HeuristicLab.Operators;
     32using HeuristicLab.GP.Interfaces;
    3233
    3334namespace HeuristicLab.GP.StructureIdentification {
     
    3536    public const string WEIGHT = "Weight";
    3637    public const string OFFSET = "SampleOffset";
    37     public const string INDEX = "Variable";
    38 
    39     private BakedFunctionTree variableNodeTemplate;
     38    public const string VARIABLENAME = "Variable";
    4039
    4140    private int minOffset;
     
    5049    }
    5150
    52     public override IEnumerable<string> LocalParameterNames {
    53       get {
    54         return new string[] { WEIGHT, OFFSET, INDEX };
    55       }
    56     }
    57 
    5851    public override IFunctionTree GetTreeNode() {
    59       return (IFunctionTree)variableNodeTemplate.Clone();
     52      return new VariableFunctionTree(this);
    6053    }
    6154
    6255    public Variable()
    6356      : base() {
    64       //AddVariableInfo(new VariableInfo(INDEX, "The variable name", typeof(StringData), VariableKind.None));
    65       //GetVariableInfo(INDEX).Local = true;
    66       //AddVariableInfo(new VariableInfo(WEIGHT, "Weight is multiplied to the feature value", typeof(DoubleData), VariableKind.None));
    67       //GetVariableInfo(WEIGHT).Local = true;
    68       //AddVariableInfo(new VariableInfo(OFFSET, "SampleOffset is added to the sample index", typeof(ConstrainedIntData), VariableKind.None));
    69       //GetVariableInfo(OFFSET).Local = true;
    70       variableNodeTemplate = new BakedFunctionTree(this);
    71 
    72       DoubleData weight = new DoubleData();
    73       variableNodeTemplate.AddVariable(new HeuristicLab.Core.Variable(WEIGHT, weight));
    74 
    75       StringData variable = new StringData();
    76       variableNodeTemplate.AddVariable(new HeuristicLab.Core.Variable(INDEX, variable));
    77 
    78       ConstrainedIntData sampleOffset = new ConstrainedIntData();
    79       variableNodeTemplate.AddVariable(new HeuristicLab.Core.Variable(OFFSET, sampleOffset));
    80 
    8157      SetupInitialization();
    8258      SetupManipulation();
     
    8763      SequentialProcessor seq = new SequentialProcessor();
    8864      UniformItemChooser variableRandomizer = new UniformItemChooser();
    89       variableRandomizer.GetVariableInfo("Value").ActualName = INDEX;
     65      variableRandomizer.GetVariableInfo("Value").ActualName = VARIABLENAME;
    9066      variableRandomizer.GetVariableInfo("Values").ActualName = "InputVariables";
    9167      variableRandomizer.Name = "Variable randomizer";
     
    11793      SequentialProcessor seq = new SequentialProcessor();
    11894      UniformItemChooser variableRandomizer = new UniformItemChooser();
    119       variableRandomizer.GetVariableInfo("Value").ActualName = INDEX;
     95      variableRandomizer.GetVariableInfo("Value").ActualName = VARIABLENAME;
    12096      variableRandomizer.GetVariableInfo("Values").ActualName = "InputVariables";
    12197      variableRandomizer.Name = "Variable randomizer";
     
    143119
    144120    public void SetConstraints(int minSampleOffset, int maxSampleOffset) {
    145       ConstrainedIntData offset = (ConstrainedIntData)variableNodeTemplate.GetLocalVariable(OFFSET).Value;
    146       IntBoundedConstraint offsetConstraint = new IntBoundedConstraint();
    147121      this.minOffset = minSampleOffset;
    148122      this.maxOffset = maxSampleOffset;
    149       offsetConstraint.LowerBound = minSampleOffset;
    150       offsetConstraint.LowerBoundEnabled = true;
    151       offsetConstraint.LowerBoundIncluded = true;
    152       offsetConstraint.UpperBound = maxSampleOffset;
    153       offsetConstraint.UpperBoundEnabled = true;
    154       offsetConstraint.UpperBoundIncluded = true;
    155       offset.AddConstraint(offsetConstraint);
    156 
    157       //ConstrainedIntData index = GetVariableValue<ConstrainedIntData>(INDEX, null, false);
    158       //IntBoundedConstraint indexConstraint = new IntBoundedConstraint();
    159       //minIndex = minInputIndex;
    160       //maxIndex = maxInputIndex;
    161       //indexConstraint.LowerBound = minInputIndex;
    162       //indexConstraint.LowerBoundEnabled = true;
    163       //indexConstraint.LowerBoundIncluded = true;
    164       //indexConstraint.UpperBound = maxInputIndex;
    165       //indexConstraint.UpperBoundEnabled = true;
    166       //indexConstraint.UpperBoundIncluded = true;
    167       //index.AddConstraint(indexConstraint);
    168 
    169123      SetupInitialization();
    170124      SetupManipulation();
Note: See TracChangeset for help on using the changeset viewer.