Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/OrienteeringProblem.cs @ 11186

Last change on this file since 11186 was 11186, checked in by pfleck, 10 years ago

#2208 added blank OrienteeringProblem and OrienteeringEvaluator

File size: 4.0 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2014 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
22using System;
23using HeuristicLab.Common;
24using HeuristicLab.Core;
25using HeuristicLab.Encodings.IntegerVectorEncoding;
26using HeuristicLab.Optimization;
27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
28
29namespace HeuristicLab.Problems.Orienteering {
30
31  [Item("Orienteering Problem", "Represents a single objective Orienteering Problem.")]
32  [Creatable("Problems")]
33  [StorableClass]
34  public class OrienteeringProblem
35    : SingleObjectiveHeuristicOptimizationProblem<IOrienteeringEvaluator, IIntegerVectorCreator>,
36    IStorableContent {
37
38    public string Filename { get; set; }
39
40    [StorableConstructor]
41    private OrienteeringProblem(bool deserializing)
42      : base(deserializing) {
43    }
44
45    private OrienteeringProblem(OrienteeringProblem original, Cloner cloner)
46      : base(original, cloner) {
47      RegisterEventHandlers();
48    }
49
50    public override IDeepCloneable Clone(Cloner cloner) {
51      return new OrienteeringProblem(this, cloner);
52    }
53
54
55    public OrienteeringProblem()
56      : base(new OrienteeringEvaluator(), new UniformRandomIntegerVectorCreator()) {
57      // TODO: Parameters
58
59      Maximization.Value = true;
60      MaximizationParameter.Hidden = true;
61
62      SolutionCreator.IntegerVectorParameter.ActualName = "OrienteeringSolution";
63
64      InitializeRandomOrienteeringInstance();
65
66      ParameterizeSolutionCreator();
67      ParameterizeEvaluator();
68
69      InitializeOperators();
70      RegisterEventHandlers();
71    }
72
73    #region events
74    protected override void OnSolutionCreatorChanged() {
75      base.OnSolutionCreatorChanged();
76      SolutionCreator.IntegerVectorParameter.ActualNameChanged += new EventHandler(SolutionCreator_IntegerVectorParameter_ActualNameChanged);
77      ParameterizeSolutionCreator();
78      ParameterizeEvaluator();
79      ParameterizeAnalyzer();
80      ParameterizeOperators();
81    }
82    protected override void OnEvaluatorChanged() {
83      base.OnEvaluatorChanged();
84      ParameterizeEvaluator();
85      ParameterizeAnalyzer();
86    }
87    private void SolutionCreator_IntegerVectorParameter_ActualNameChanged(object sender, EventArgs e) {
88      ParameterizeEvaluator();
89      ParameterizeAnalyzer();
90      ParameterizeOperators();
91    }
92    #endregion
93
94    #region Helpers
95    [StorableHook(HookType.AfterDeserialization)]
96    private void AfterDeserialization() {
97      RegisterEventHandlers();
98    }
99
100    private void RegisterEventHandlers() {
101      SolutionCreator.IntegerVectorParameter.ActualNameChanged += new EventHandler(SolutionCreator_IntegerVectorParameter_ActualNameChanged);
102    }
103    private void ParameterizeSolutionCreator() {
104      // TODO
105    }
106    private void ParameterizeEvaluator() {
107      if (Evaluator is OrienteeringEvaluator) {
108        var orienteeringEvaluator = (OrienteeringEvaluator)Evaluator;
109        // TODO
110      }
111    }
112    private void ParameterizeAnalyzer() {
113      // TODO 
114    }
115    private void InitializeOperators() {
116      // TODO 
117    }
118    private void ParameterizeOperators() {
119      // TODO
120    }
121    #endregion
122
123    private void InitializeRandomOrienteeringInstance() {
124      // TODO
125    }
126  }
127}
Note: See TracBrowser for help on using the repository browser.