Changeset 16956 for branches/2457_ExpertSystem/HeuristicLab.Optimization/3.3/BasicProblems/BasicProblem.cs
- Timestamp:
- 05/15/19 13:36:51 (5 years ago)
- Location:
- branches/2457_ExpertSystem/HeuristicLab.Optimization
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2457_ExpertSystem/HeuristicLab.Optimization
- Property svn:mergeinfo changed
-
branches/2457_ExpertSystem/HeuristicLab.Optimization/3.3/BasicProblems/BasicProblem.cs
r16075 r16956 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 8Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HEAL.Attic; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; 28 using HeuristicLab.Data; 27 29 using HeuristicLab.Parameters; 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;29 30 30 31 namespace HeuristicLab.Optimization { 31 [Storable Class]32 [StorableType("D877082E-9E77-4CB1-ABDB-35F63878E116")] 32 33 public abstract class BasicProblem<TEncoding, TEvaluator> : HeuristicOptimizationProblem<TEvaluator, ISolutionCreator>, IProblemDefinition, IStorableContent 33 34 where TEncoding : class, IEncoding … … 78 79 79 80 [StorableConstructor] 80 protected BasicProblem( bool deserializing) : base(deserializing) { }81 protected BasicProblem(StorableConstructorFlag _) : base(_) { } 81 82 [StorableHook(HookType.AfterDeserialization)] 82 83 private void AfterDeserialization() { … … 157 158 OnOperatorsChanged(); 158 159 } 160 161 protected override IEnumerable<KeyValuePair<string, IItem>> GetCollectedValues(IValueParameter param) { 162 if (param.Value == null) yield break; 163 if (param.GetsCollected) { 164 if (param == EncodingParameter) // store only the name of the encoding 165 yield return new KeyValuePair<string, IItem>(String.Empty, new StringValue(EncodingParameter.Value.Name)); 166 else yield return new KeyValuePair<string, IItem>(String.Empty, param.Value); 167 } 168 var parameterizedItem = param.Value as IParameterizedItem; 169 if (parameterizedItem != null) { 170 var children = new Dictionary<string, IItem>(); 171 parameterizedItem.CollectParameterValues(children); 172 foreach (var child in children) yield return child; 173 } 174 } 159 175 } 160 176 }
Note: See TracChangeset
for help on using the changeset viewer.