Changeset 13663 for branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/ExpertSystem.cs
- Timestamp:
- 03/07/16 21:29:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/ExpertSystem.cs
r13649 r13663 41 41 using SingleObjectiveOKBProblem = HeuristicLab.Clients.OKB.RunCreation.SingleObjectiveOKBProblem; 42 42 43 namespace HeuristicLab.OptimizationExpertSystem {43 namespace HeuristicLab.OptimizationExpertSystem.Common { 44 44 [Item("Expert-System", "Currently in experimental phase, an expert system that makes algorithm suggestions based on fitness landscape analysis features and an optimization knowledge base.")] 45 45 [StorableClass] … … 123 123 } 124 124 125 [Storable(Name = "solutionPool")] 126 private ItemList<IScope> oldBackwardsCompatible; 127 [Storable(Name = "newSolutionPool")] 128 private CheckedItemList<IScope> solutionPool; 129 public CheckedItemList<IScope> SolutionPool { 130 get { return solutionPool; } 131 set { 132 if (solutionPool == value) return; 133 solutionPool = value; 134 OnPropertyChanged("SolutionPool"); 135 } 136 } 137 125 138 [Storable] 126 139 private BidirectionalLookup<long, IRun> algorithmId2RunMapping; … … 155 168 algorithmId2AlgorithmInstanceMapping.Add(kvp.Key, cloner.Clone(kvp.Value)); 156 169 } 170 currentResult = cloner.Clone(original.currentResult); 171 solutionPool = cloner.Clone(original.solutionPool); 157 172 currentInstance = cloner.Clone(original.currentInstance); 158 173 RegisterEventHandlers(); … … 167 182 problemInstances = new RunCollection(); 168 183 problem = new SingleObjectiveOKBProblem(); 184 solutionPool = new CheckedItemList<IScope>(); 169 185 algorithmId2RunMapping = new BidirectionalLookup<long, IRun>(); 170 186 algorithmId2AlgorithmInstanceMapping = new BidirectionalDictionary<long, IAlgorithm>(); … … 183 199 private void AfterDeserialization() { 184 200 readOnlySuggestedInstances = suggestedInstances.AsReadOnly(); 201 // BackwardsCompatibility3.3 202 #region Backwards compatible code, remove with trunk integration 203 if (oldBackwardsCompatible != null) solutionPool = new CheckedItemList<IScope>(solutionPool); 204 else if (solutionPool == null) solutionPool = new CheckedItemList<IScope>(); 205 #endregion 185 206 RegisterEventHandlers(); 186 207 } … … 395 416 alg.ExceptionOccurred -= AlgorithmOnExceptionOccurred; 396 417 alg.ExecutionTimeChanged -= AlgorithmOnExecutionTimeChanged; 418 foreach (var solution in alg.Results.Where(x => x.Name.ToLower().Contains("solution")).Select(x => x.Value).OfType<IScope>()) { 419 solutionPool.Add(solution); 420 } 421 Runs.Add(alg.Runs.Last()); 397 422 if (algWh != null) algWh.Set(); 398 423 }
Note: See TracChangeset
for help on using the changeset viewer.