#region License Information /* HeuristicLab * Copyright (C) 2002-2010 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 HeuristicLab.Common; using HeuristicLab.Core; using HeuristicLab.Data; using HeuristicLab.Parameters; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; namespace HeuristicLab.Optimization { [Item("Single Objective Problem", "Represents the base class for a single objective problem.")] [StorableClass] public abstract class SingleObjectiveProblem : Problem, ISingleObjectiveProblem where T : class, ISingleObjectiveEvaluator where U : class, ISolutionCreator { private const string MaximizationParameterName = "Maximization"; private const string BestKnownQualityParameterName = "BestKnownQuality"; [StorableConstructor] protected SingleObjectiveProblem(bool deserializing) : base(deserializing) { } protected SingleObjectiveProblem(SingleObjectiveProblem original, Cloner cloner) : base(original, cloner) { } protected SingleObjectiveProblem() : base() { Parameters.Add(new ValueParameter(MaximizationParameterName, "Set to false if the problem should be minimized.")); Parameters.Add(new ValueParameter(BestKnownQualityParameterName, "The quality of the best known solution of this problem.")); } #region properties ISingleObjectiveEvaluator ISingleObjectiveProblem.Evaluator { get { return Evaluator; } } public BoolValue Maximization { get { return MaximizationParameter.Value; } protected set { MaximizationParameter.Value = value; } } public ValueParameter MaximizationParameter { get { return (ValueParameter)Parameters[MaximizationParameterName]; } } IParameter ISingleObjectiveProblem.MaximizationParameter { get { return MaximizationParameter; } } public DoubleValue BestKnownQuality { get { return BestKnownQualityParameter.Value; } protected set { BestKnownQualityParameter.Value = value; } } public ValueParameter BestKnownQualityParameter { get { return (ValueParameter)Parameters[BestKnownQualityParameterName]; } } IParameter ISingleObjectiveProblem.BestKnownQualityParameter { get { return BestKnownQualityParameter; } } #endregion } }