Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/07/16 21:29:00 (8 years ago)
Author:
abeham
Message:

#2457: worked on expert system

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/ExpertSystem.cs

    r13649 r13663  
    4141using SingleObjectiveOKBProblem = HeuristicLab.Clients.OKB.RunCreation.SingleObjectiveOKBProblem;
    4242
    43 namespace HeuristicLab.OptimizationExpertSystem {
     43namespace HeuristicLab.OptimizationExpertSystem.Common {
    4444  [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.")]
    4545  [StorableClass]
     
    123123    }
    124124
     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   
    125138    [Storable]
    126139    private BidirectionalLookup<long, IRun> algorithmId2RunMapping;
     
    155168        algorithmId2AlgorithmInstanceMapping.Add(kvp.Key, cloner.Clone(kvp.Value));
    156169      }
     170      currentResult = cloner.Clone(original.currentResult);
     171      solutionPool = cloner.Clone(original.solutionPool);
    157172      currentInstance = cloner.Clone(original.currentInstance);
    158173      RegisterEventHandlers();
     
    167182      problemInstances = new RunCollection();
    168183      problem = new SingleObjectiveOKBProblem();
     184      solutionPool = new CheckedItemList<IScope>();
    169185      algorithmId2RunMapping = new BidirectionalLookup<long, IRun>();
    170186      algorithmId2AlgorithmInstanceMapping = new BidirectionalDictionary<long, IAlgorithm>();
     
    183199    private void AfterDeserialization() {
    184200      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
    185206      RegisterEventHandlers();
    186207    }
     
    395416        alg.ExceptionOccurred -= AlgorithmOnExceptionOccurred;
    396417        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());
    397422        if (algWh != null) algWh.Set();
    398423      }
Note: See TracChangeset for help on using the changeset viewer.