1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-$year$ 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 System;
|
---|
23 | using System.Collections.Generic;
|
---|
24 | using System.Drawing;
|
---|
25 | using System.IO;
|
---|
26 | using System.Linq;
|
---|
27 | using HeuristicLab.Common;
|
---|
28 | using HeuristicLab.Core;
|
---|
29 | using HeuristicLab.Data;
|
---|
30 | using HeuristicLab.Optimization;
|
---|
31 | using HeuristicLab.Parameters;
|
---|
32 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
33 | using HeuristicLab.PluginInfrastructure;
|
---|
34 |
|
---|
35 | namespace $rootnamespace$ {
|
---|
36 | [Item("$problemName$", "$problemDescription$")]
|
---|
37 | [Creatable("Problems")]
|
---|
38 | [StorableClass]
|
---|
39 | public sealed class $safeitemname$ : $problemTypeImplementation$ {
|
---|
40 | public override Image ItemImage {
|
---|
41 | get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.Type; }
|
---|
42 | }
|
---|
43 |
|
---|
44 | #region Parameter Properties
|
---|
45 | $parameterProperties$
|
---|
46 | #endregion
|
---|
47 |
|
---|
48 | #region Properties
|
---|
49 | $properties$
|
---|
50 | #endregion
|
---|
51 |
|
---|
52 | [Storable]
|
---|
53 | private List<IOperator> operators;
|
---|
54 |
|
---|
55 | [StorableConstructor]
|
---|
56 | private $safeitemname$(bool deserializing) : base(deserializing) { }
|
---|
57 | public $safeitemname$()
|
---|
58 | : base() {
|
---|
59 | // TODO: Create a new instance of evaluator and solution creator
|
---|
60 |
|
---|
61 | $problemSpecificParameterInitializers$
|
---|
62 | $parameterInitializers$
|
---|
63 |
|
---|
64 | ParameterizeSolutionCreator();
|
---|
65 | ParameterizeEvaluator();
|
---|
66 |
|
---|
67 | InitializeOperators();
|
---|
68 | AttachEventHandlers();
|
---|
69 | }
|
---|
70 |
|
---|
71 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
72 | $safeitemname$ clone = ($safeitemname$)base.Clone(cloner);
|
---|
73 | clone.operators = operators.Select(x => (IOperator)cloner.Clone(x)).ToList();
|
---|
74 | // TODO: Clone private fields here
|
---|
75 | clone.AttachEventHandlers();
|
---|
76 | return clone;
|
---|
77 | }
|
---|
78 |
|
---|
79 | #region Events
|
---|
80 | public event EventHandler SolutionCreatorChanged;
|
---|
81 | private void OnSolutionCreatorChanged() {
|
---|
82 | EventHandler handler = SolutionCreatorChanged;
|
---|
83 | if (handler != null) handler(this, EventArgs.Empty);
|
---|
84 | }
|
---|
85 | public event EventHandler EvaluatorChanged;
|
---|
86 | private void OnEvaluatorChanged() {
|
---|
87 | EventHandler handler = EvaluatorChanged;
|
---|
88 | if (handler != null) handler(this, EventArgs.Empty);
|
---|
89 | }
|
---|
90 | public event EventHandler OperatorsChanged;
|
---|
91 | private void OnOperatorsChanged() {
|
---|
92 | EventHandler handler = OperatorsChanged;
|
---|
93 | if (handler != null) handler(this, EventArgs.Empty);
|
---|
94 | }
|
---|
95 | public event EventHandler Reset;
|
---|
96 | private void OnReset() {
|
---|
97 | EventHandler handler = Reset;
|
---|
98 | if (handler != null) handler(this, EventArgs.Empty);
|
---|
99 | }
|
---|
100 |
|
---|
101 | // TODO: Add your event handlers here
|
---|
102 | #endregion
|
---|
103 |
|
---|
104 | #region Helpers
|
---|
105 | [StorableHook(HookType.AfterDeserialization)]
|
---|
106 | private void AfterDeserializationHook() {
|
---|
107 | AttachEventHandlers();
|
---|
108 | }
|
---|
109 |
|
---|
110 | private void AttachEventHandlers() {
|
---|
111 | // TODO: Add event handlers to the parameters here
|
---|
112 | }
|
---|
113 |
|
---|
114 | private void InitializeOperators() {
|
---|
115 | operators = new List<IOperator>();
|
---|
116 | // TODO: Add custom problem analyzer to the list
|
---|
117 | // TODO: Add operators from the representation either by direct instantiation, or by using ApplicationManager.Manger.GetInstances<T>().Cast<IOperator>()
|
---|
118 | }
|
---|
119 | private void ParameterizeSolutionCreator() {
|
---|
120 | // TODO: Set the parameters of the solution creator
|
---|
121 | }
|
---|
122 | private void ParameterizeEvaluator() {
|
---|
123 | // TODO: Set the parameters of the evaluator
|
---|
124 | }
|
---|
125 | #endregion
|
---|
126 | }
|
---|
127 | }
|
---|