Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Operators/SolutionContextScope.cs @ 17363

Last change on this file since 17363 was 17363, checked in by mkommend, 4 years ago

#2521: First version of contexts in problem evaluation.

File size: 3.5 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 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
23using System;
24using HeuristicLab.Common;
25using HeuristicLab.Core;
26
27//TODO: don't derive from NamedItem, this has been done to have a fast working prototype
28namespace HeuristicLab.Optimization {
29  internal class SolutionContextScope<TEncodedSolution> : SolutionContext<TEncodedSolution>, ISolutionScope
30   where TEncodedSolution : class, IEncodedSolution {
31    private readonly IScope scope;
32
33    public SolutionContextScope(IScope scope, TEncodedSolution solution) : base(solution) {
34      this.scope = scope;
35    }
36
37    public override IDeepCloneable Clone(Cloner cloner) {
38      throw new NotSupportedException();
39    }
40
41    IScope IScope.Parent {
42      get { return scope.Parent; }
43      set { throw new NotSupportedException(); }
44    }
45
46    VariableCollection IScope.Variables => scope.Variables;
47    ScopeList IScope.SubScopes => scope.SubScopes;
48
49    void IScope.Clear() { throw new NotImplementedException(); }
50
51
52
53    #region INamedItem members
54    string INamedItem.Name { get { return scope.Name; } set => throw new NotImplementedException(); }
55    bool INamedItem.CanChangeName => false;
56
57    string INamedItem.Description { get { return scope.Description; } set => throw new NotImplementedException(); }
58    bool INamedItem.CanChangeDescription => false;
59
60    event EventHandler<CancelEventArgs<string>> INamedItem.NameChanging {
61      add { throw new NotImplementedException(); }
62      remove { throw new NotImplementedException(); }
63    }
64
65    event EventHandler INamedItem.NameChanged {
66      add { throw new NotImplementedException(); }
67      remove { throw new NotImplementedException(); }
68    }
69
70    event EventHandler INamedItem.DescriptionChanged {
71      add { throw new NotImplementedException(); }
72      remove { throw new NotImplementedException(); }
73    }
74    #endregion
75  }
76
77  internal class SingleObjectiveSolutionContextScope<TEncodedSolution> : SolutionContextScope<TEncodedSolution>, ISingleObjectiveSolutionScope<TEncodedSolution>
78    where TEncodedSolution : class, IEncodedSolution {
79
80    public new ISingleObjectiveEvaluationResult EvaluationResult { get; set; }
81    public SingleObjectiveSolutionContextScope(IScope scope, TEncodedSolution solution) : base(scope, solution) {
82    }
83  }
84
85  internal class MultiObjectiveSolutionContextScope<TEncodedSolution> : SolutionContextScope<TEncodedSolution>, IMultiObjectiveSolutionScope<TEncodedSolution>
86  where TEncodedSolution : class, IEncodedSolution {
87
88    public new IMultiObjectiveEvaluationResult EvaluationResult { get; set; }
89    public MultiObjectiveSolutionContextScope(IScope scope, TEncodedSolution solution) : base(scope, solution) {
90    }
91  }
92}
Note: See TracBrowser for help on using the repository browser.