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