#region License Information /* HeuristicLab * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using System; using HeuristicLab.Common; using HeuristicLab.Core; using HeuristicLab.Encodings.IntegerVectorEncoding; using HeuristicLab.Optimization; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; namespace HeuristicLab.Problems.Orienteering { [Item("Orienteering Problem", "Represents a single objective Orienteering Problem.")] [Creatable("Problems")] [StorableClass] public class OrienteeringProblem : SingleObjectiveHeuristicOptimizationProblem, IStorableContent { public string Filename { get; set; } [StorableConstructor] private OrienteeringProblem(bool deserializing) : base(deserializing) { } private OrienteeringProblem(OrienteeringProblem original, Cloner cloner) : base(original, cloner) { RegisterEventHandlers(); } public override IDeepCloneable Clone(Cloner cloner) { return new OrienteeringProblem(this, cloner); } public OrienteeringProblem() : base(new OrienteeringEvaluator(), new UniformRandomIntegerVectorCreator()) { // TODO: Parameters Maximization.Value = true; MaximizationParameter.Hidden = true; SolutionCreator.IntegerVectorParameter.ActualName = "OrienteeringSolution"; InitializeRandomOrienteeringInstance(); ParameterizeSolutionCreator(); ParameterizeEvaluator(); InitializeOperators(); RegisterEventHandlers(); } #region events protected override void OnSolutionCreatorChanged() { base.OnSolutionCreatorChanged(); SolutionCreator.IntegerVectorParameter.ActualNameChanged += new EventHandler(SolutionCreator_IntegerVectorParameter_ActualNameChanged); ParameterizeSolutionCreator(); ParameterizeEvaluator(); ParameterizeAnalyzer(); ParameterizeOperators(); } protected override void OnEvaluatorChanged() { base.OnEvaluatorChanged(); ParameterizeEvaluator(); ParameterizeAnalyzer(); } private void SolutionCreator_IntegerVectorParameter_ActualNameChanged(object sender, EventArgs e) { ParameterizeEvaluator(); ParameterizeAnalyzer(); ParameterizeOperators(); } #endregion #region Helpers [StorableHook(HookType.AfterDeserialization)] private void AfterDeserialization() { RegisterEventHandlers(); } private void RegisterEventHandlers() { SolutionCreator.IntegerVectorParameter.ActualNameChanged += new EventHandler(SolutionCreator_IntegerVectorParameter_ActualNameChanged); } private void ParameterizeSolutionCreator() { // TODO } private void ParameterizeEvaluator() { if (Evaluator is OrienteeringEvaluator) { var orienteeringEvaluator = (OrienteeringEvaluator)Evaluator; // TODO } } private void ParameterizeAnalyzer() { // TODO } private void InitializeOperators() { // TODO } private void ParameterizeOperators() { // TODO } #endregion private void InitializeRandomOrienteeringInstance() { // TODO } } }