Changeset 2167
- Timestamp:
- 07/16/09 14:38:15 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/ModelAnalyzerExporter.cs
r2166 r2167 120 120 121 121 public static string ExportToHL2(this Constant constant, IFunctionTree tree) { 122 double value = ((DoubleData)tree.GetLocalVariable(Constant.VALUE).Value).Data; 122 HeuristicLab.Core.IItem constantItem = tree.GetLocalVariable(Constant.VALUE).Value; 123 double value; 124 if (constantItem is ConstrainedDoubleData) { 125 value = ((ConstrainedDoubleData)constantItem).Data; 126 } else { 127 value = ((DoubleData)constantItem).Data; 128 } 123 129 return "[T]Constant(" + value.ToString("r") + ";0;0)"; 124 130 } … … 129 135 130 136 public static string ExportToHL2(this Differential differential, IFunctionTree tree) { 131 double weight = ((DoubleData)tree.GetLocalVariable(Differential.WEIGHT).Value).Data; 132 double index = ((ConstrainedIntData)tree.GetLocalVariable(Differential.INDEX).Value).Data; 133 double offset = ((ConstrainedIntData)tree.GetLocalVariable(Differential.OFFSET).Value).Data; 137 HeuristicLab.Core.IItem weightItem = tree.GetLocalVariable(Differential.WEIGHT).Value; 138 double weight; 139 if (weightItem is ConstrainedDoubleData) { 140 weight = ((ConstrainedDoubleData)weightItem).Data; 141 } else { 142 weight = ((DoubleData)weightItem).Data; 143 } 144 var index = tree.GetLocalVariable(Differential.INDEX).Value; 145 var offset = ((ConstrainedDoubleData)tree.GetLocalVariable(Differential.OFFSET).Value).Data; 134 146 135 147 return "[T]Differential(" + weight.ToString("r") + ";" + index + ";" + -offset + ")"; … … 177 189 178 190 public static string ExportToHL2(this Variable variable, IFunctionTree tree) { 179 double weight = ((DoubleData)tree.GetLocalVariable(Variable.WEIGHT).Value).Data; 191 HeuristicLab.Core.IItem weightItem = tree.GetLocalVariable(Differential.WEIGHT).Value; 192 double weight; 193 if (weightItem is ConstrainedDoubleData) { 194 weight = ((ConstrainedDoubleData)weightItem).Data; 195 } else { 196 weight = ((DoubleData)weightItem).Data; 197 } 180 198 double index = ((ConstrainedIntData)tree.GetLocalVariable(Variable.INDEX).Value).Data; 181 199 double offset = ((ConstrainedIntData)tree.GetLocalVariable(Variable.OFFSET).Value).Data;
Note: See TracChangeset
for help on using the changeset viewer.