Changeset 7153
- Timestamp:
- 12/07/11 21:09:40 (13 years ago)
- Location:
- branches/HeuristicLab.MetaOptimization
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.HiveEngine/3.3/Exceptions/HiveEngineException.cs
r6984 r7153 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 3 24 namespace HeuristicLab.HiveEngine { -
branches/HeuristicLab.MetaOptimization/HeuristicLab.HiveEngine/3.3/Exceptions/ScopeMergeException.cs
r6984 r7153 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.Runtime.Serialization; 3 24 -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/ConstrainedTypeValue.cs
r5337 r7153 2 2 using System.Collections.Generic; 3 3 using System.Linq; 4 using System.Text;4 using HeuristicLab.Common; 5 5 using HeuristicLab.Core; 6 using HeuristicLab.Data;7 using System.Drawing;8 6 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 9 using HeuristicLab.Common;10 7 using HeuristicLab.PluginInfrastructure; 11 8 … … 15 12 public class ConstrainedTypeValue : TypeValue { 16 13 17 [Storable]18 14 private IEnumerable<Type> validTypes; 19 15 public IEnumerable<Type> ValidTypes { … … 29 25 } 30 26 31 public ConstrainedTypeValue() : base() { 27 public ConstrainedTypeValue() 28 : base() { 32 29 this.readOnly = false; 33 30 } 34 public ConstrainedTypeValue(Type value) : this() { 31 public ConstrainedTypeValue(Type value) 32 : this() { 35 33 this.Value = value; 36 34 } … … 51 49 public class ConstrainedTypeValue<T> : ConstrainedTypeValue where T : class, IItem { 52 50 53 public ConstrainedTypeValue() : base() { 51 public ConstrainedTypeValue() 52 : base() { 54 53 this.ValidTypes = ApplicationManager.Manager.GetTypes(typeof(T), true).ToList(); 55 54 this.Value = ValidTypes.First(); 56 55 } 57 public ConstrainedTypeValue(Type value) : base() { 56 public ConstrainedTypeValue(Type value) 57 : base() { 58 58 this.ValidTypes = ApplicationManager.Manager.GetTypes(typeof(T), true).ToList(); 59 59 this.Value = value; 60 60 } 61 61 62 [StorableConstructor] 62 protected ConstrainedTypeValue(bool deserializing) : base(deserializing) { } 63 protected ConstrainedTypeValue(bool deserializing) 64 : base(deserializing) { 65 if (deserializing) { 66 this.ValidTypes = ApplicationManager.Manager.GetTypes(typeof(T), true).ToList(); 67 } 68 } 69 63 70 protected ConstrainedTypeValue(ConstrainedTypeValue original, Cloner cloner) : base(original, cloner) { } 64 71 public override IDeepCloneable Clone(Cloner cloner) { -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurations/ParameterConfiguration.cs
r6489 r7153 21 21 } 22 22 23 [Storable]24 23 public string Filename { get; set; } 25 24 … … 66 65 } 67 66 68 [Storable]69 67 protected Type[] validTypes; 70 68 public Type[] ValidTypes { … … 136 134 } 137 135 138 [Storable]139 136 protected IItemSet<IItem> validValues; 140 137 … … 216 213 [StorableConstructor] 217 214 protected ParameterConfiguration(bool deserializing) { } 215 218 216 protected ParameterConfiguration(ParameterConfiguration original, Cloner cloner) 219 217 : base(original, cloner) { … … 236 234 } 237 235 238 239 236 public override IDeepCloneable Clone(Cloner cloner) { 240 237 return new ParameterConfiguration(this, cloner); … … 242 239 [StorableHook(HookType.AfterDeserialization)] 243 240 protected virtual void AfterDeserialization() { 241 this.validTypes = GetValidTypes(parameterDataType).ToArray(); 242 243 if (IsNullable) { 244 validTypes = new List<Type>(validTypes) { typeof(NullValue) }.ToArray(); 245 } 246 this.validValues = CreateValidValues(); 247 244 248 if (this.valueConfigurations != null) RegisterValueConfigurationEvents(); 245 249 if (this.actualValue != null) RegisterActualValueEvents(); … … 323 327 } 324 328 329 private static IEnumerable<Type> GetValidTypes(Type parameter) { 330 // in case of IOperator return empty list, otherwise hundreds of types would be returned. this mostly occurs for Successor which will never be optimized 331 if (parameter == typeof(IOperator)) 332 return new List<Type>(); 333 334 // return only one type for ValueTypeValues<> (Int, Double, Percent, Bool). Otherwise 2 types would be returned for DoubleValue (PercentValue which is derived) 335 if (IsSubclassOfRawGeneric(typeof(ValueTypeValue<>), parameter)) 336 return new List<Type> { parameter }; 337 338 //TODO: not sure if this if makes sense; maybe only leave else branch here 339 if (IsSubclassOfRawGeneric(typeof(OptionalConstrainedValueParameter<>), parameter.GetType())) { 340 // use existing validvalues if known 341 var parameterValidValues = (IEnumerable)parameter.GetType().GetProperty("ValidValues").GetValue(parameter, new object[] { }); 342 return parameterValidValues.Cast<object>().Select(x => x.GetType()); 343 } else { 344 // otherwise use all assignable types 345 return ApplicationManager.Manager.GetTypes(parameter, true); 346 } 347 } 348 325 349 private IItemSet<IItem> GetValidValues(IValueParameter parameter) { 326 350 if (IsSubclassOfRawGeneric(typeof(OptionalConstrainedValueParameter<>), parameter.GetType())) { … … 330 354 return null; 331 355 } 332 333 356 } 334 357 … … 612 635 private void KeepActualValueConfigurationIndexConsistent() { 613 636 if (this.valueConfigurations != null && this.valueConfigurations.CheckedItems.Count() > 0) { 614 if (this.valueConfigurations.Count <= this.actualValueConfigurationIndex &&637 if (this.valueConfigurations.Count <= this.actualValueConfigurationIndex && 615 638 this.valueConfigurations.CheckedItems.Count(x => x.Index == this.actualValueConfigurationIndex) == 1) { 616 639 // everything is ok; do nothing -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Plugin.cs.frame
r7101 r7153 28 28 [Plugin("HeuristicLab.Problems.MetaOptimization", "3.3.2.$WCREV$")] 29 29 [PluginFile("HeuristicLab.Problems.MetaOptimization-3.3.dll", PluginFileType.Assembly)] 30 30 [PluginDependency("HeuristicLab.Algorithms.GeneticAlgorithm", "3.3")] 31 31 [PluginDependency("HeuristicLab.Analysis", "3.3")] 32 32 [PluginDependency("HeuristicLab.Collections", "3.3")] … … 38 38 [PluginDependency("HeuristicLab.Encodings.IntegerVectorEncoding", "3.3")] 39 39 [PluginDependency("HeuristicLab.Encodings.RealVectorEncoding", "3.3")] 40 [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.4")] 40 41 [PluginDependency("HeuristicLab.Operators", "3.3")] 41 42 [PluginDependency("HeuristicLab.Optimization", "3.3")] 42 43 [PluginDependency("HeuristicLab.Parameters", "3.3")] 43 44 [PluginDependency("HeuristicLab.Persistence", "3.3")] 44 [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.3")] 45 [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")] 46 [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic", "3.4")] 47 [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic.Regression", "3.4")] 45 48 [PluginDependency("HeuristicLab.Problems.TestFunctions", "3.3")] 46 49 [PluginDependency("HeuristicLab.Random", "3.3")]
Note: See TracChangeset
for help on using the changeset viewer.