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("BasicMultiObjectiveSolutionAnalyzer", "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 IScopeTreeLookupParameter<DoubleArray> QualitiesParameter {
|
---|
14 | get { return (IScopeTreeLookupParameter<DoubleArray>)Parameters["Qualities"]; }
|
---|
15 | }
|
---|
16 | public ILookupParameter<ResultCollection> ResultsParameter {
|
---|
17 | get { return (ILookupParameter<ResultCollection>)Parameters["Results"]; }
|
---|
18 | }
|
---|
19 |
|
---|
20 | [StorableConstructor]
|
---|
21 | protected ParetoFrontAnalyzer(bool deserializing) : base(deserializing) { }
|
---|
22 | protected ParetoFrontAnalyzer(ParetoFrontAnalyzer original, Cloner cloner) : base(original, cloner) { }
|
---|
23 | public ParetoFrontAnalyzer() {
|
---|
24 | Parameters.Add(new ScopeTreeLookupParameter<DoubleArray>("Qualities", "The vector of qualities of each solution."));
|
---|
25 | Parameters.Add(new LookupParameter<ResultCollection>("Results", "The result collection to store the front to."));
|
---|
26 | }
|
---|
27 |
|
---|
28 | public override IOperation Apply(IExecutionContext context) {
|
---|
29 | ItemArray<DoubleArray> qualities = QualitiesParameter.ActualValue;
|
---|
30 | ResultCollection results = ResultsParameter.ActualValue;
|
---|
31 | Analyze(context, qualities, results);
|
---|
32 | return base.Apply(context);
|
---|
33 | }
|
---|
34 |
|
---|
35 | protected abstract void Analyze(IExecutionContext context, ItemArray<DoubleArray> qualities, ResultCollection results);
|
---|
36 | }
|
---|
37 | }
|
---|