#region License Information /* HeuristicLab * Copyright (C) 2002-2011 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.Optimization; using HeuristicLab.Parameters; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; namespace HeuristicLab.Problems.DataAnalysis.Symbolic { [StorableClass] public abstract class SymbolicDataAnalysisSingleObjectiveProblem : SymbolicDataAnalysisProblem, ISingleObjectiveHeuristicOptimizationProblem where T : class,IDataAnalysisProblemData where U : class, ISymbolicDataAnalysisSingleObjectiveEvaluator where V : class, ISymbolicDataAnalysisSolutionCreator { private const string MaximizationParameterName = "Maximization"; private const string BestKnownQualityParameterName = "BestKnownQuality"; #region parameter properties public IFixedValueParameter MaximizationParameter { get { return (IFixedValueParameter)Parameters[MaximizationParameterName]; } } IParameter ISingleObjectiveHeuristicOptimizationProblem.MaximizationParameter { get { return MaximizationParameter; } } public IFixedValueParameter BestKnownQualityParameter { get { return (IFixedValueParameter)Parameters[BestKnownQualityParameterName]; } } IParameter ISingleObjectiveHeuristicOptimizationProblem.BestKnownQualityParameter { get { return BestKnownQualityParameter; } } #endregion #region properties public BoolValue Maximization { get { return MaximizationParameter.Value; } } public DoubleValue BestKnownQuality { get { return BestKnownQualityParameter.Value; } } ISingleObjectiveEvaluator ISingleObjectiveHeuristicOptimizationProblem.Evaluator { get { return Evaluator; } } #endregion [StorableConstructor] protected SymbolicDataAnalysisSingleObjectiveProblem(bool deserializing) : base(deserializing) { } protected SymbolicDataAnalysisSingleObjectiveProblem(SymbolicDataAnalysisSingleObjectiveProblem original, Cloner cloner) : base(original, cloner) { } public SymbolicDataAnalysisSingleObjectiveProblem(T problemData, U evaluator, V solutionCreator) : base(problemData, evaluator, solutionCreator) { Parameters.Add(new FixedValueParameter(MaximizationParameterName, "Set to false if the problem should be minimized.", new BoolValue())); Parameters.Add(new FixedValueParameter(BestKnownQualityParameterName, "The quality of the best known solution of this problem.", new DoubleValue())); } protected override void OnEvaluatorChanged() { base.OnEvaluatorChanged(); Maximization.Value = base.Evaluator.Maximization; } } }