Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Optimization/3.3/SingleObjectiveProblem.cs @ 4596

Last change on this file since 4596 was 4596, checked in by mkommend, 14 years ago

Corrected item descriptions and added parameter descriptions for Problem and SingleObjectiveProblem (ticket #1232).

File size: 2.9 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 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
22using HeuristicLab.Core;
23using HeuristicLab.Data;
24using HeuristicLab.Parameters;
25using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
26
27namespace HeuristicLab.Optimization {
28  [Item("Single Objective Problem", "Represents the base class for a single objective problem.")]
29  [StorableClass]
30  public abstract class SingleObjectiveProblem<T, U> : Problem<T, U>, ISingleObjectiveProblem
31    where T : class, ISingleObjectiveEvaluator
32    where U : class, ISolutionCreator {
33    private const string MaximizationParameterName = "Maximization";
34    private const string BestKnownQualityParameterName = "BestKnownQuality";
35
36    protected SingleObjectiveProblem()
37      : base() {
38      Parameters.Add(new ValueParameter<BoolValue>(MaximizationParameterName, "Set to false if the problem should be minimized."));
39      Parameters.Add(new ValueParameter<DoubleValue>(BestKnownQualityParameterName, "The quality of the best known solution of this problem."));
40    }
41    [StorableConstructor]
42    protected SingleObjectiveProblem(bool deserializing) : base(deserializing) { }
43
44    #region properties
45    ISingleObjectiveEvaluator ISingleObjectiveProblem.Evaluator { get { return Evaluator; } }
46
47    public BoolValue Maximization {
48      get { return MaximizationParameter.Value; }
49      protected set { MaximizationParameter.Value = value; }
50    }
51    public ValueParameter<BoolValue> MaximizationParameter {
52      get { return (ValueParameter<BoolValue>)Parameters[MaximizationParameterName]; }
53    }
54    IParameter ISingleObjectiveProblem.MaximizationParameter {
55      get { return MaximizationParameter; }
56    }
57
58    public DoubleValue BestKnownQuality {
59      get { return BestKnownQualityParameter.Value; }
60      protected set { BestKnownQualityParameter.Value = value; }
61    }
62    public ValueParameter<DoubleValue> BestKnownQualityParameter {
63      get { return (ValueParameter<DoubleValue>)Parameters[BestKnownQualityParameterName]; }
64    }
65    IParameter ISingleObjectiveProblem.BestKnownQualityParameter {
66      get { return BestKnownQualityParameter; }
67    }
68    #endregion
69  }
70}
Note: See TracBrowser for help on using the repository browser.