Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/23/15 15:15:27 (8 years ago)
Author:
mkommend
Message:

#2521: Refactored encodings and problems.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Operators/MultiObjectiveAnalyzer.cs

    r11961 r13336  
    3333  [Item("Multi-objective Analyzer", "Calls the Analyze method of the problem definition.")]
    3434  [StorableClass]
    35   public class MultiObjectiveAnalyzer : SingleSuccessorOperator, IMultiObjectiveAnalysisOperator, IStochasticOperator {
     35  public class MultiObjectiveAnalyzer<TSolution> : SingleSuccessorOperator, IMultiObjectiveAnalysisOperator<TSolution>, IStochasticOperator
     36  where TSolution : class, ISolution {
    3637    public bool EnabledByDefault { get { return true; } }
    3738
    38     public ILookupParameter<IEncoding> EncodingParameter {
    39       get { return (ILookupParameter<IEncoding>)Parameters["Encoding"]; }
     39    public ILookupParameter<IEncoding<TSolution>> EncodingParameter {
     40      get { return (ILookupParameter<IEncoding<TSolution>>)Parameters["Encoding"]; }
    4041    }
    4142
     
    5253    }
    5354
    54     public Action<Individual[], double[][], ResultCollection, IRandom> AnalyzeAction { get; set; }
     55    public Action<TSolution[], double[][], ResultCollection, IRandom> AnalyzeAction { get; set; }
    5556
    5657    [StorableConstructor]
    5758    protected MultiObjectiveAnalyzer(bool deserializing) : base(deserializing) { }
    58     protected MultiObjectiveAnalyzer(MultiObjectiveAnalyzer original, Cloner cloner) : base(original, cloner) { }
     59    protected MultiObjectiveAnalyzer(MultiObjectiveAnalyzer<TSolution> original, Cloner cloner) : base(original, cloner) { }
    5960    public MultiObjectiveAnalyzer() {
    6061      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use."));
    61       Parameters.Add(new LookupParameter<IEncoding>("Encoding", "An item that holds the problem's encoding."));
     62      Parameters.Add(new LookupParameter<IEncoding<TSolution>>("Encoding", "An item that holds the problem's encoding."));
    6263      Parameters.Add(new ScopeTreeLookupParameter<DoubleArray>("Qualities", "The qualities of the parameter vector."));
    6364      Parameters.Add(new LookupParameter<ResultCollection>("Results", "The results collection to write to."));
     
    6566
    6667    public override IDeepCloneable Clone(Cloner cloner) {
    67       return new MultiObjectiveAnalyzer(this, cloner);
     68      return new MultiObjectiveAnalyzer<TSolution>(this, cloner);
    6869    }
    6970
     
    7778        scopes = scopes.Select(x => (IEnumerable<IScope>)x.SubScopes).Aggregate((a, b) => a.Concat(b));
    7879
    79       var individuals = scopes.Select(encoding.GetIndividual).ToArray();
     80      var individuals = scopes.Select(s => ScopeUtil.GetSolution(s, encoding)).ToArray();
    8081      AnalyzeAction(individuals, QualitiesParameter.ActualValue.Select(x => x.ToArray()).ToArray(), results, random);
    8182      return base.Apply();
Note: See TracChangeset for help on using the changeset viewer.