Changeset 2165 for trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/FunctionLibraryInjector.cs
- Timestamp:
- 07/16/09 11:34:22 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/FunctionLibraryInjector.cs
r2130 r2165 32 32 namespace HeuristicLab.GP.StructureIdentification { 33 33 public class FunctionLibraryInjector : OperatorBase { 34 private const string NUMBEROFINPUTVARIABLES = "NumberOfInputVariables"; 34 35 private const string FUNCTIONLIBRARY = "FunctionLibrary"; 35 36 private const string TARGETVARIABLE = "TargetVariable"; 36 private const string ALLOWEDFEATURES = "AllowedFeatures";37 37 private const string MINTIMEOFFSET = "MinTimeOffset"; 38 38 private const string MAXTIMEOFFSET = "MaxTimeOffset"; … … 70 70 public FunctionLibraryInjector() 71 71 : base() { 72 AddVariableInfo(new VariableInfo(NUMBEROFINPUTVARIABLES, "The number of available input variables", typeof(IntData), VariableKind.In)); 72 73 AddVariableInfo(new VariableInfo(TARGETVARIABLE, "The target variable", typeof(IntData), VariableKind.In)); 73 AddVariableInfo(new VariableInfo(ALLOWEDFEATURES, "List of indexes of allowed features", typeof(ItemList<IntData>), VariableKind.In)); 74 AddVariableInfo(new Core.VariableInfo(MINTIMEOFFSET, "Minimal time offset for all features", typeof(IntData), Core.VariableKind.In)); 75 AddVariableInfo(new Core.VariableInfo(MAXTIMEOFFSET, "Maximal time offset for all feature", typeof(IntData), Core.VariableKind.In)); 74 AddVariableInfo(new VariableInfo(MINTIMEOFFSET, "Minimal time offset for all features", typeof(IntData), VariableKind.In)); 75 AddVariableInfo(new VariableInfo(MAXTIMEOFFSET, "Maximal time offset for all feature", typeof(IntData), VariableKind.In)); 76 76 AddVariableInfo(new VariableInfo(FUNCTIONLIBRARY, "Preconfigured default operator library", typeof(GPOperatorLibrary), VariableKind.New)); 77 77 … … 111 111 StructId.Variable variable; 112 112 GPOperatorLibrary operatorLibrary; 113 114 ItemList<IntData> allowedFeatures = GetVariableValue<ItemList<IntData>>(ALLOWEDFEATURES, scope, true); 113 int nInputVariables = GetVariableValue<IntData>(NUMBEROFINPUTVARIABLES, scope, true).Data; 115 114 int targetVariable = GetVariableValue<IntData>(TARGETVARIABLE, scope, true).Data; 116 115 … … 226 225 ConditionalAddOperator(XOR_ALLOWED, operatorLibrary, xor); 227 226 228 int[] allowedIndexes = new int[allowedFeatures.Count]; 229 for (int i = 0; i < allowedIndexes.Length; i++) { 230 allowedIndexes[i] = allowedFeatures[i].Data; 231 } 232 233 variable.SetConstraints(allowedIndexes, minTimeOffset, maxTimeOffset); 234 differential.SetConstraints(allowedIndexes, minTimeOffset, maxTimeOffset); 227 variable.SetConstraints(1, nInputVariables, minTimeOffset, maxTimeOffset); 228 differential.SetConstraints(1, nInputVariables, minTimeOffset, maxTimeOffset); 235 229 236 230 scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName(FUNCTIONLIBRARY), operatorLibrary));
Note: See TracChangeset
for help on using the changeset viewer.