Changeset 1910
- Timestamp:
- 05/27/09 14:36:09 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/FunctionLibraryInjector.cs
r1908 r1910 154 154 StructId.Xor xor = new StructId.Xor(); 155 155 156 IFunction[] booleanFunctions = new IFunction[] { 157 and,158 equal,159 greaterThan,160 lessThan,161 not,162 or,163 xor164 };165 IFunction[] doubleFunctions = new IFunction[] { 166 differential,167 variable,168 constant,169 addition,170 average,171 cosinus,172 division,173 exponential,174 ifThenElse,175 logarithm,176 multiplication,177 power,178 signum,179 sinus,180 sqrt,181 subtraction,182 tangens183 };156 157 List<IOperator> booleanFunctions = new List<IOperator>(); 158 ConditionalAddOperator(AND_ALLOWED, and, booleanFunctions); 159 ConditionalAddOperator(EQUAL_ALLOWED, equal, booleanFunctions); 160 ConditionalAddOperator(GREATERTHAN_ALLOWED, greaterThan, booleanFunctions); 161 ConditionalAddOperator(LESSTHAN_ALLOWED, lessThan, booleanFunctions); 162 ConditionalAddOperator(NOT_ALLOWED, not, booleanFunctions); 163 ConditionalAddOperator(OR_ALLOWED, or, booleanFunctions); 164 ConditionalAddOperator(XOR_ALLOWED, xor, booleanFunctions); 165 166 List<IOperator> doubleFunctions = new List<IOperator>(); 167 ConditionalAddOperator(DIFFERENTIALS_ALLOWED, differential, doubleFunctions); 168 ConditionalAddOperator(VARIABLES_ALLOWED, variable, doubleFunctions); 169 ConditionalAddOperator(CONSTANTS_ALLOWED, constant, doubleFunctions); 170 ConditionalAddOperator(ADDITION_ALLOWED, addition, doubleFunctions); 171 ConditionalAddOperator(AVERAGE_ALLOWED, average, doubleFunctions); 172 ConditionalAddOperator(COSINUS_ALLOWED, cosinus, doubleFunctions); 173 ConditionalAddOperator(DIVISION_ALLOWED, division, doubleFunctions); 174 ConditionalAddOperator(EXPONENTIAL_ALLOWED, exponential, doubleFunctions); 175 ConditionalAddOperator(IFTHENELSE_ALLOWED, ifThenElse, doubleFunctions); 176 ConditionalAddOperator(LOGARTIHM_ALLOWED, logarithm, doubleFunctions); 177 ConditionalAddOperator(MULTIPLICATION_ALLOWED, multiplication, doubleFunctions); 178 ConditionalAddOperator(POWER_ALLOWED, power, doubleFunctions); 179 ConditionalAddOperator(SIGNUM_ALLOWED, signum, doubleFunctions); 180 ConditionalAddOperator(SINUS_ALLOWED, sinus, doubleFunctions); 181 ConditionalAddOperator(SQRT_ALLOWED, sqrt, doubleFunctions); 182 ConditionalAddOperator(SUBTRACTION_ALLOWED, subtraction, doubleFunctions); 183 ConditionalAddOperator(TANGENS_ALLOWED, tangens, doubleFunctions); 184 184 185 185 SetAllowedSubOperators(and, booleanFunctions); … … 246 246 } 247 247 248 private void ConditionalAddOperator(string condName, IOperator op, List<IOperator> list) { 249 if (GetVariableValue<BoolData>(condName, null, false).Data) list.Add(op); 250 } 251 248 252 private void ConditionalAddOperator(string condName, GPOperatorLibrary operatorLibrary, IOperator op) { 249 253 if (GetVariableValue<BoolData>(condName, null, false).Data) operatorLibrary.GPOperatorGroup.AddOperator(op); 250 254 } 251 255 252 private void SetAllowedSubOperators(IFunction f, IFunction[]gs) {256 private void SetAllowedSubOperators(IFunction f, List<IOperator> gs) { 253 257 foreach (IConstraint c in f.Constraints) { 254 258 if (c is SubOperatorTypeConstraint) { 255 259 SubOperatorTypeConstraint typeConstraint = c as SubOperatorTypeConstraint; 256 260 typeConstraint.Clear(); 257 foreach (I Functiong in gs) {261 foreach (IOperator g in gs) { 258 262 typeConstraint.AddOperator(g); 259 263 } … … 261 265 AllSubOperatorsTypeConstraint typeConstraint = c as AllSubOperatorsTypeConstraint; 262 266 typeConstraint.Clear(); 263 foreach (I Functiong in gs) {267 foreach (IOperator g in gs) { 264 268 typeConstraint.AddOperator(g); 265 269 } … … 268 272 } 269 273 270 private void SetAllowedSubOperators(IFunction f, int p, IFunction[]gs) {274 private void SetAllowedSubOperators(IFunction f, int p, List<IOperator> gs) { 271 275 foreach (IConstraint c in f.Constraints) { 272 276 if (c is SubOperatorTypeConstraint) { … … 274 278 if (typeConstraint.SubOperatorIndex.Data == p) { 275 279 typeConstraint.Clear(); 276 foreach (I Functiong in gs) {280 foreach (IOperator g in gs) { 277 281 typeConstraint.AddOperator(g); 278 282 }
Note: See TracChangeset
for help on using the changeset viewer.