Changeset 4982 for branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3
- Timestamp:
- 11/28/10 23:03:05 (14 years ago)
- Location:
- branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3
- Files:
-
- 3 added
- 2 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3
- Property svn:ignore
-
old new 2 2 bin 3 3 obj 4 HeuristicLabProblemsMetaOptimizationPlugin.cs
-
- Property svn:ignore
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encodings/ParameterConfigurations/ParameterConfiguration.cs
r4981 r4982 117 117 118 118 private void PopulateValueConfigurations() { 119 foreach (IItem item in this.validValues) { 120 this.ValueConfigurations.Add(new ValueConfiguration(item, item.GetType()), false); 119 foreach (IItem validValue in this.validValues) { 120 IItem val; 121 if (actualValueConfiguration.ConstrainedValue.Value != null && actualValueConfiguration.ConstrainedValue.ValueDataType == validValue.GetType()) { 122 val = actualValueConfiguration.ConstrainedValue.Value; // use existing value for that type (if available) 123 } else { 124 val = validValue; 125 } 126 this.ValueConfigurations.Add(new ValueConfiguration(val, val.GetType()), true); 121 127 } 122 128 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encodings/ValueConfigurations/CheckedValueConfigurationCollection.cs
r4981 r4982 4 4 using System.Text; 5 5 using HeuristicLab.Core; 6 using HeuristicLab.Common; 7 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 6 8 7 9 namespace HeuristicLab.Problems.MetaOptimization { 8 10 // todo: check that at least 1 elements needs to be selected 9 11 // todo: control creatable item types 12 [StorableClass] 10 13 public class CheckedValueConfigurationCollection : CheckedItemCollection<IValueConfiguration>, ICheckedValueConfigurationCollection { 14 [Storable] 15 private int minItemCount = 1; 16 public int MinItemCount { 17 get { return minItemCount; } 18 } 11 19 20 [Storable] 12 21 protected Type valueDataType; 13 22 public Type ValueDataType { … … 17 26 public CheckedValueConfigurationCollection(Type valueDataType) { 18 27 this.valueDataType = valueDataType; 28 RegisterEvents(); 29 } 30 public CheckedValueConfigurationCollection() { 31 RegisterEvents(); 32 } 33 [StorableConstructor] 34 protected CheckedValueConfigurationCollection(bool deserializing) : base(deserializing) { 35 RegisterEvents(); 36 } 37 protected CheckedValueConfigurationCollection(CheckedValueConfigurationCollection original, Cloner cloner) : base(original, cloner) { 38 this.minItemCount = original.MinItemCount; 39 this.valueDataType = original.valueDataType; 40 RegisterEvents(); 41 } 42 public override IDeepCloneable Clone(Cloner cloner) { 43 return new CheckedValueConfigurationCollection(this, cloner); 44 } 45 46 private void RegisterEvents() { 47 this.ItemsRemoved += new Collections.CollectionItemsChangedEventHandler<IValueConfiguration>(CheckedValueConfigurationCollection_ItemsRemoved); 48 } 49 private void DeregisterEvents() { 50 this.ItemsRemoved -= new Collections.CollectionItemsChangedEventHandler<IValueConfiguration>(CheckedValueConfigurationCollection_ItemsRemoved); 51 } 52 53 private void CheckedValueConfigurationCollection_ItemsRemoved(object sender, Collections.CollectionItemsChangedEventArgs<IValueConfiguration> e) { 54 // auch collectionreset gehört berücksichtigt 55 // funktioniert so nicht ganz, weil die view das hinzufügen nicht mitkriegt 56 //if (this.Count < minItemCount) { 57 // foreach (var item in e.Items) { 58 // if (this.Count >= minItemCount) 59 // break; 60 // this.Add(item); 61 // } 62 //} 19 63 } 20 64 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encodings/ValueConfigurations/ValueConfiguration.cs
r4981 r4982 30 30 protected IItemCollection<IParameterConfiguration> parameterConfigurations = new ItemCollection<IParameterConfiguration>(); 31 31 public IItemCollection<IParameterConfiguration> ParameterConfigurations { 32 get { return this.parameterConfigurations; }32 get { return new ReadOnlyItemCollection<IParameterConfiguration>(this.parameterConfigurations); } 33 33 protected set { this.parameterConfigurations = value; } 34 34 } … … 55 55 #region Constructors and Cloning 56 56 public ValueConfiguration(IItem value, Type valueDataType) { 57 this. parameterConfigurations = new ItemList<IParameterConfiguration>();57 this.ParameterConfigurations = new ItemList<IParameterConfiguration>(); 58 58 this.ConstrainedValue = new ConstrainedValue(value, valueDataType); 59 59 if (constrainedValue.ValueDataType == typeof(IntValue)) { … … 86 86 foreach (var childParameter in parameterizedItem.Parameters) { 87 87 var pc = ParameterConfiguration.Create(parameterizedItem, childParameter); 88 if (pc != null) this. ParameterConfigurations.Add(pc);88 if (pc != null) this.parameterConfigurations.Add(pc); 89 89 } 90 90 } 91 91 } 92 92 protected virtual void ClearParameterConfigurations() { 93 ParameterConfigurations.Clear();93 parameterConfigurations.Clear(); 94 94 } 95 95 -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/HeuristicLab.Problems.MetaOptimization-3.3.csproj
r4981 r4982 88 88 <ItemGroup> 89 89 <Compile Include="Analyzers\BestParameterConfigurationAnalyzer.cs" /> 90 <None Include="Properties\AssemblyInfo.cs.frame" /> 91 <None Include="HeuristicLabProblemsMetaOptimizationPlugin.cs.frame" /> 90 92 <Compile Include="Encodings\RangeConstraints\ConstrainedValue.cs"> 91 93 <SubType>Code</SubType> 92 94 </Compile> 95 <Compile Include="Encodings\ValueConfigurations\RootValueConfiguration.cs" /> 93 96 <Compile Include="Encodings\ValueConfigurations\ValueConfiguration.cs" /> 94 97 <Compile Include="Encodings\ValueConfigurations\CheckedValueConfigurationCollection.cs" /> … … 120 123 set ProjectDir=$(ProjectDir) 121 124 set SolutionDir=$(SolutionDir) 122 set Outdir=$(Outdir)</PreBuildEvent> 125 set Outdir=$(Outdir) 126 127 call PreBuildEvent.cmd</PreBuildEvent> 123 128 </PropertyGroup> 124 129 <PropertyGroup> -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Interfaces/ICheckedValueConfigurationCollection.cs
r4981 r4982 7 7 namespace HeuristicLab.Problems.MetaOptimization { 8 8 public interface ICheckedValueConfigurationCollection : ICheckedItemCollection<IValueConfiguration> { 9 int MinItemCount { get; } 9 10 Type ValueDataType { get; } 10 11 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/MetaOptimizationProblem.cs
r4839 r4982 153 153 if (Algorithm != null) { 154 154 Algorithm.ProblemChanged += new EventHandler(BaseLevelAlgorithm_ProblemChanged); 155 AlgorithmParameterConfiguration = new ValueConfiguration(Algorithm, Algorithm.GetType());155 AlgorithmParameterConfiguration = new RootValueConfiguration(Algorithm, Algorithm.GetType()); 156 156 } 157 157 BaseLevelAlgorithm_ProblemChanged(sender, e); -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Properties
-
Property
svn:ignore
set to
AssemblyInfo.cs
AssemblyInfo.cs
-
Property
svn:ignore
set to
Note: See TracChangeset
for help on using the changeset viewer.