Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/26/11 23:36:10 (13 years ago)
Author:
abeham
Message:

#1663

  • Added an *Operators* parameter in Problem
  • Adapted KnapsackProblem, OnemaxProblem, SingleObjectiveTestFunctionProblem, TravelingSalesmanProblem, and VehicleRoutingProblem to derive from SingleObjectiveHeuristicOptimizationProblem<U, V>, renamed and marked old list as obsolete. Note that QuadraticAssignmentProblem, as well as the new DataAnalysisProblems already derived from that class. ArtificialAntProblem was not yet modified.
  • Added some test lists and adapted SamplesTest
  • Added plugin dependencies that the unit test was complaining about
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization/3.3/Problems/Problem.cs

    r5954 r6938  
    2626using HeuristicLab.Common;
    2727using HeuristicLab.Core;
     28using HeuristicLab.Parameters;
    2829using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2930
     
    3233  [StorableClass]
    3334  public abstract class Problem : ParameterizedNamedItem, IProblem {
     35    private static readonly string OperatorsParameterName = "Operators";
     36
     37    public IFixedValueParameter<OperatorCollection> OperatorsParameter {
     38      get { return (IFixedValueParameter<OperatorCollection>)Parameters[OperatorsParameterName]; }
     39    }
     40
    3441    public override Image ItemImage {
    3542      get { return HeuristicLab.Common.Resources.VSImageLibrary.Type; }
     
    3744
    3845    [StorableConstructor]
    39     protected Problem(bool deserializing) : base(deserializing) { }
     46    protected Problem(bool deserializing)
     47      : base(deserializing) {
     48      operators = new OperatorCollection(); // operators must never be null
     49    }
    4050    protected Problem(Problem original, Cloner cloner)
    4151      : base(original, cloner) {
     
    4757      : base() {
    4858      operators = new OperatorCollection();
     59      Parameters.Add(new FixedValueParameter<OperatorCollection>(OperatorsParameterName, "The operators that the problem provides to the algorithms.", operators, false));
     60      OperatorsParameter.Hidden = true;
    4961      RegisterEventHandlers();
    5062    }
     
    5264    [StorableHook(HookType.AfterDeserialization)]
    5365    private void AfterDeserialization() {
     66      // BackwardsCompatibility3.3
     67      #region Backwards compatible code, remove with 3.4
     68      if (!Parameters.ContainsKey(OperatorsParameterName)) {
     69        Parameters.Add(new FixedValueParameter<OperatorCollection>(OperatorsParameterName, "The operators that the problem provides to the algorithms.", operators, false));
     70        OperatorsParameter.Hidden = true;
     71      }
     72      #endregion
    5473      RegisterEventHandlers();
    5574    }
Note: See TracChangeset for help on using the changeset viewer.