1 | using HeuristicLab.Common;
|
---|
2 | using HeuristicLab.Core;
|
---|
3 | using HeuristicLab.Data;
|
---|
4 | using HeuristicLab.Operators;
|
---|
5 | using HeuristicLab.Optimization;
|
---|
6 | using HeuristicLab.Parameters;
|
---|
7 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
8 |
|
---|
9 | namespace HeuristicLab.Analysis {
|
---|
10 | [Item("ParetoFrontAnalyzer", "Analyzer for multiobjective problems that collects and presents the current Pareto front as double matrix as well as the solution scopes that lie on the current front.")]
|
---|
11 | [StorableClass]
|
---|
12 | public abstract class ParetoFrontAnalyzer : SingleSuccessorOperator, IAnalyzer {
|
---|
13 | public virtual bool EnabledByDefault {
|
---|
14 | get { return true; }
|
---|
15 | }
|
---|
16 |
|
---|
17 | public IScopeTreeLookupParameter<DoubleArray> QualitiesParameter {
|
---|
18 | get { return (IScopeTreeLookupParameter<DoubleArray>)Parameters["Qualities"]; }
|
---|
19 | }
|
---|
20 | public ILookupParameter<ResultCollection> ResultsParameter {
|
---|
21 | get { return (ILookupParameter<ResultCollection>)Parameters["Results"]; }
|
---|
22 | }
|
---|
23 |
|
---|
24 | [StorableConstructor]
|
---|
25 | protected ParetoFrontAnalyzer(bool deserializing) : base(deserializing) { }
|
---|
26 | protected ParetoFrontAnalyzer(ParetoFrontAnalyzer original, Cloner cloner) : base(original, cloner) { }
|
---|
27 | public ParetoFrontAnalyzer() {
|
---|
28 | Parameters.Add(new ScopeTreeLookupParameter<DoubleArray>("Qualities", "The vector of qualities of each solution."));
|
---|
29 | Parameters.Add(new LookupParameter<ResultCollection>("Results", "The result collection to store the front to."));
|
---|
30 | }
|
---|
31 |
|
---|
32 | public override IOperation Apply() {
|
---|
33 | ItemArray<DoubleArray> qualities = QualitiesParameter.ActualValue;
|
---|
34 | ResultCollection results = ResultsParameter.ActualValue;
|
---|
35 | Analyze(qualities, results);
|
---|
36 | return base.Apply();
|
---|
37 | }
|
---|
38 |
|
---|
39 | protected abstract void Analyze(ItemArray<DoubleArray> qualities, ResultCollection results);
|
---|
40 | }
|
---|
41 | }
|
---|