Changeset 13336 for branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Operators/MultiObjectiveAnalyzer.cs
- Timestamp:
- 11/23/15 15:15:27 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Operators/MultiObjectiveAnalyzer.cs
r11961 r13336 33 33 [Item("Multi-objective Analyzer", "Calls the Analyze method of the problem definition.")] 34 34 [StorableClass] 35 public class MultiObjectiveAnalyzer : SingleSuccessorOperator, IMultiObjectiveAnalysisOperator, IStochasticOperator { 35 public class MultiObjectiveAnalyzer<TSolution> : SingleSuccessorOperator, IMultiObjectiveAnalysisOperator<TSolution>, IStochasticOperator 36 where TSolution : class, ISolution { 36 37 public bool EnabledByDefault { get { return true; } } 37 38 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"]; } 40 41 } 41 42 … … 52 53 } 53 54 54 public Action< Individual[], double[][], ResultCollection, IRandom> AnalyzeAction { get; set; }55 public Action<TSolution[], double[][], ResultCollection, IRandom> AnalyzeAction { get; set; } 55 56 56 57 [StorableConstructor] 57 58 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) { } 59 60 public MultiObjectiveAnalyzer() { 60 61 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.")); 62 63 Parameters.Add(new ScopeTreeLookupParameter<DoubleArray>("Qualities", "The qualities of the parameter vector.")); 63 64 Parameters.Add(new LookupParameter<ResultCollection>("Results", "The results collection to write to.")); … … 65 66 66 67 public override IDeepCloneable Clone(Cloner cloner) { 67 return new MultiObjectiveAnalyzer (this, cloner);68 return new MultiObjectiveAnalyzer<TSolution>(this, cloner); 68 69 } 69 70 … … 77 78 scopes = scopes.Select(x => (IEnumerable<IScope>)x.SubScopes).Aggregate((a, b) => a.Concat(b)); 78 79 79 var individuals = scopes.Select( encoding.GetIndividual).ToArray();80 var individuals = scopes.Select(s => ScopeUtil.GetSolution(s, encoding)).ToArray(); 80 81 AnalyzeAction(individuals, QualitiesParameter.ActualValue.Select(x => x.ToArray()).ToArray(), results, random); 81 82 return base.Apply();
Note: See TracChangeset
for help on using the changeset viewer.