1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
4 | *
|
---|
5 | * This file is part of HeuristicLab.
|
---|
6 | *
|
---|
7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU General Public License as published by
|
---|
9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
10 | * (at your option) any later version.
|
---|
11 | *
|
---|
12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU General Public License
|
---|
18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | using HeuristicLab.Analysis;
|
---|
23 | using HeuristicLab.Common;
|
---|
24 | using HeuristicLab.Core;
|
---|
25 | using HeuristicLab.Data;
|
---|
26 | using HeuristicLab.Operators;
|
---|
27 | using HeuristicLab.Optimization;
|
---|
28 | using HeuristicLab.Optimization.Operators;
|
---|
29 | using HeuristicLab.Parameters;
|
---|
30 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
31 |
|
---|
32 | namespace HeuristicLab.Algorithms.ALPS {
|
---|
33 | [Item("EvaluatedSolutionsHistoryAnalyzer", "")]
|
---|
34 | [StorableClass]
|
---|
35 | public sealed class EvaluatedSolutionsHistoryAnalyzer : AlgorithmOperator, IAnalyzer {
|
---|
36 | #region Parameter Properties
|
---|
37 | public ILookupParameter<IntValue> EvaluatedSolutionsParameter {
|
---|
38 | get { return (ILookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; }
|
---|
39 | }
|
---|
40 | public ILookupParameter<DataTable> EvaluatedSolutionsHistoryParameter {
|
---|
41 | get { return (ILookupParameter<DataTable>)Parameters["EvaluatedSolutionsHistory"]; }
|
---|
42 | }
|
---|
43 | public ValueLookupParameter<ResultCollection> ResultsParameter {
|
---|
44 | get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; }
|
---|
45 | }
|
---|
46 | #endregion
|
---|
47 |
|
---|
48 | public bool EnabledByDefault { get { return false; } }
|
---|
49 |
|
---|
50 | [StorableConstructor]
|
---|
51 | private EvaluatedSolutionsHistoryAnalyzer(bool deserializing)
|
---|
52 | : base(deserializing) { }
|
---|
53 | private EvaluatedSolutionsHistoryAnalyzer(EvaluatedSolutionsHistoryAnalyzer original, Cloner cloner)
|
---|
54 | : base(original, cloner) { }
|
---|
55 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
56 | return new EvaluatedSolutionsHistoryAnalyzer(this, cloner);
|
---|
57 | }
|
---|
58 | public EvaluatedSolutionsHistoryAnalyzer()
|
---|
59 | : base() {
|
---|
60 | #region Create parameters
|
---|
61 | Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", ""));
|
---|
62 | Parameters.Add(new ValueLookupParameter<DataTable>("EvaluatedSolutionsHistory"));
|
---|
63 | Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection where the analysis values should be stored."));
|
---|
64 | #endregion
|
---|
65 |
|
---|
66 | #region Create operators
|
---|
67 | DataTableValuesCollector dataTableValuesCollector = new DataTableValuesCollector();
|
---|
68 | ResultsCollector resultsCollector = new ResultsCollector();
|
---|
69 |
|
---|
70 | dataTableValuesCollector.CollectedValues.Add(new LookupParameter<IntValue>("EvaluatedSolutions", null, EvaluatedSolutionsParameter.Name));
|
---|
71 | dataTableValuesCollector.DataTableParameter.ActualName = EvaluatedSolutionsHistoryParameter.Name;
|
---|
72 |
|
---|
73 | resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(EvaluatedSolutionsHistoryParameter.Name));
|
---|
74 | resultsCollector.ResultsParameter.ActualName = ResultsParameter.Name;
|
---|
75 | #endregion
|
---|
76 |
|
---|
77 | #region Create operator graph
|
---|
78 | OperatorGraph.InitialOperator = dataTableValuesCollector;
|
---|
79 | dataTableValuesCollector.Successor = resultsCollector;
|
---|
80 | resultsCollector.Successor = null;
|
---|
81 | #endregion
|
---|
82 | }
|
---|
83 | }
|
---|
84 | } |
---|