Changeset 2210 for branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Variable.cs
- Timestamp:
- 07/29/09 18:28:45 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Variable.cs
r2202 r2210 30 30 using HeuristicLab.Random; 31 31 using HeuristicLab.Operators; 32 using HeuristicLab.GP.Interfaces; 32 33 33 34 namespace HeuristicLab.GP.StructureIdentification { … … 35 36 public const string WEIGHT = "Weight"; 36 37 public const string OFFSET = "SampleOffset"; 37 public const string INDEX = "Variable"; 38 39 private BakedFunctionTree variableNodeTemplate; 38 public const string VARIABLENAME = "Variable"; 40 39 41 40 private int minOffset; … … 50 49 } 51 50 52 public override IEnumerable<string> LocalParameterNames {53 get {54 return new string[] { WEIGHT, OFFSET, INDEX };55 }56 }57 58 51 public override IFunctionTree GetTreeNode() { 59 return (IFunctionTree)variableNodeTemplate.Clone();52 return new VariableFunctionTree(this); 60 53 } 61 54 62 55 public Variable() 63 56 : 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 81 57 SetupInitialization(); 82 58 SetupManipulation(); … … 87 63 SequentialProcessor seq = new SequentialProcessor(); 88 64 UniformItemChooser variableRandomizer = new UniformItemChooser(); 89 variableRandomizer.GetVariableInfo("Value").ActualName = INDEX;65 variableRandomizer.GetVariableInfo("Value").ActualName = VARIABLENAME; 90 66 variableRandomizer.GetVariableInfo("Values").ActualName = "InputVariables"; 91 67 variableRandomizer.Name = "Variable randomizer"; … … 117 93 SequentialProcessor seq = new SequentialProcessor(); 118 94 UniformItemChooser variableRandomizer = new UniformItemChooser(); 119 variableRandomizer.GetVariableInfo("Value").ActualName = INDEX;95 variableRandomizer.GetVariableInfo("Value").ActualName = VARIABLENAME; 120 96 variableRandomizer.GetVariableInfo("Values").ActualName = "InputVariables"; 121 97 variableRandomizer.Name = "Variable randomizer"; … … 143 119 144 120 public void SetConstraints(int minSampleOffset, int maxSampleOffset) { 145 ConstrainedIntData offset = (ConstrainedIntData)variableNodeTemplate.GetLocalVariable(OFFSET).Value;146 IntBoundedConstraint offsetConstraint = new IntBoundedConstraint();147 121 this.minOffset = minSampleOffset; 148 122 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 169 123 SetupInitialization(); 170 124 SetupManipulation();
Note: See TracChangeset
for help on using the changeset viewer.