Changeset 5337 for branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurations/ParameterConfiguration.cs
- Timestamp:
- 01/20/11 01:30:44 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurations/ParameterConfiguration.cs
r5313 r5337 217 217 } 218 218 219 private IEnumerable<Type> GetValidTypes(IValueParameter parameter) {219 private static IEnumerable<Type> GetValidTypes(IValueParameter parameter) { 220 220 // in case of IOperator return empty list, otherwise hundreds of types would be returned. this mostly occurs for Successor which will never be optimized 221 221 if (parameter.DataType == typeof(IOperator)) 222 222 return new List<Type>(); 223 223 224 // return only one type for ValueTypeValues<> (Int, Double, Percent, Bool). Otherwise 2 types would be returned for DoubleValue (PercentValue which is derived) 225 if (IsSubclassOfRawGeneric(typeof(ValueTypeValue<>), parameter.DataType)) 226 return new List<Type> { parameter.DataType }; 227 224 228 if (IsSubclassOfRawGeneric(typeof(OptionalConstrainedValueParameter<>), parameter.GetType())) { 229 // use existing validvalues if known 225 230 var parameterValidValues = (IEnumerable)parameter.GetType().GetProperty("ValidValues").GetValue(parameter, new object[] { }); 226 231 return parameterValidValues.Cast<object>().Select(x => x.GetType()); 227 232 } else { 228 return ApplicationManager.Manager.GetTypes(valueDataType, true); 233 // otherwise use all assignable types 234 return ApplicationManager.Manager.GetTypes(parameter.DataType, true); 229 235 } 230 236 } … … 273 279 return true; 274 280 } 275 toCheck = toCheck.BaseType; 281 toCheck = toCheck.BaseType; // baseType is null when toCheck is an Interface 282 if (toCheck == null) 283 return false; 276 284 } 277 285 return false;
Note: See TracChangeset
for help on using the changeset viewer.