Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/06/12 17:50:17 (12 years ago)
Author:
gkronber
Message:

#1081: merged r7266:7459 from the trunk into the time series prognosis branch.

Location:
branches/HeuristicLab.TimeSeries
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.TimeSeries

  • branches/HeuristicLab.TimeSeries/HeuristicLab.Optimization/3.3/Problems/Problem.cs

    r7268 r7460  
    4444
    4545    [StorableConstructor]
    46     protected Problem(bool deserializing)
    47       : base(deserializing) {
    48       operators = new OperatorCollection(); // operators must never be null
    49     }
     46    protected Problem(bool deserializing) : base(deserializing) { }
    5047    protected Problem(Problem original, Cloner cloner)
    5148      : base(original, cloner) {
    52       operators = cloner.Clone(original.operators);
    5349      RegisterEventHandlers();
    5450    }
     
    5652    protected Problem()
    5753      : base() {
    58       operators = new OperatorCollection();
    59       Parameters.Add(new FixedValueParameter<OperatorCollection>(OperatorsParameterName, "The operators that the problem provides to the algorithms.", operators, false));
     54      Parameters.Add(new FixedValueParameter<OperatorCollection>(OperatorsParameterName, "The operators that the problem provides to the algorithms.", new OperatorCollection(), false));
    6055      OperatorsParameter.Hidden = true;
    6156      RegisterEventHandlers();
     
    6459    [StorableHook(HookType.AfterDeserialization)]
    6560    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
    7361      RegisterEventHandlers();
    7462    }
     
    8169
    8270    #region properties
    83     private OperatorCollection operators;
     71    // BackwardsCompatibility3.3
     72    #region Backwards compatible code, remove with 3.4
    8473    [Storable(Name = "Operators")]
    8574    private IEnumerable<IOperator> StorableOperators {
    86       get { return operators; }
    87       set { operators = new OperatorCollection(value); }
     75      get { return null; }
     76      set {
     77        if (!Parameters.ContainsKey(OperatorsParameterName)) {
     78          Parameters.Add(new FixedValueParameter<OperatorCollection>(OperatorsParameterName, "The operators that the problem provides to the algorithms.", new OperatorCollection(value), false));
     79          OperatorsParameter.Hidden = true;
     80        }
     81      }
    8882    }
     83    #endregion
    8984    protected OperatorCollection Operators {
    90       get { return this.operators; }
     85      get {
     86        // BackwardsCompatibility3.3
     87        #region Backwards compatible code, remove with 3.4
     88        if (!Parameters.ContainsKey(OperatorsParameterName)) {
     89          Parameters.Add(new FixedValueParameter<OperatorCollection>(OperatorsParameterName, "The operators that the problem provides to the algorithms.", new OperatorCollection(), false));
     90          OperatorsParameter.Hidden = true;
     91        }
     92        #endregion
     93        return OperatorsParameter.Value;
     94      }
    9195    }
    92     IEnumerable<IOperator> IProblem.Operators { get { return operators; } }
     96    IEnumerable<IOperator> IProblem.Operators { get { return Operators; } }
    9397    #endregion
    9498
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Optimization/3.3/Problems/SingleObjectiveHeuristicOptimizationProblem.cs

    r7268 r7460  
    4141      : base() {
    4242      Parameters.Add(new ValueParameter<BoolValue>(MaximizationParameterName, "Set to false if the problem should be minimized.", new BoolValue()));
    43       Parameters.Add(new OptionalValueParameter<DoubleValue>(BestKnownQualityParameterName, "The quality of the best known solution of this problem.", new DoubleValue()));
     43      Parameters.Add(new OptionalValueParameter<DoubleValue>(BestKnownQualityParameterName, "The quality of the best known solution of this problem."));
    4444    }
    4545
     
    4747      : base(evaluator, solutionCreator) {
    4848      Parameters.Add(new ValueParameter<BoolValue>(MaximizationParameterName, "Set to false if the problem should be minimized.", new BoolValue()));
    49       Parameters.Add(new OptionalValueParameter<DoubleValue>(BestKnownQualityParameterName, "The quality of the best known solution of this problem.", new DoubleValue()));
     49      Parameters.Add(new OptionalValueParameter<DoubleValue>(BestKnownQualityParameterName, "The quality of the best known solution of this problem."));
    5050    }
    5151
     
    6868    public BoolValue Maximization {
    6969      get { return MaximizationParameter.Value; }
    70       protected set { MaximizationParameter.Value = value; }
     70      set { MaximizationParameter.Value = value; }
    7171    }
    7272
     
    7979    public DoubleValue BestKnownQuality {
    8080      get { return BestKnownQualityParameter.Value; }
    81       protected set { BestKnownQualityParameter.Value = value; }
     81      set { BestKnownQualityParameter.Value = value; }
    8282    }
    8383
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Optimization/3.3/Problems/UserDefinedProblem.cs

    r7268 r7460  
    121121    [StorableHook(HookType.AfterDeserialization)]
    122122    private void AfterDeserialization() {
    123       AttachEventHandlers();
     123      RegisterEventHandlers();
    124124    }
    125125    public UserDefinedProblem()
     
    132132      Parameters.Add(new ValueParameter<ItemList<IOperator>>("Operators", "The operators that are passed to the algorithm.", new ItemList<IOperator>()));
    133133
    134       AttachEventHandlers();
     134      RegisterEventHandlers();
    135135    }
    136136
    137137    private UserDefinedProblem(UserDefinedProblem original, Cloner cloner)
    138138      : base(original, cloner) {
    139       AttachEventHandlers();
     139      RegisterEventHandlers();
    140140    }
    141141    public override IDeepCloneable Clone(Cloner cloner) {
     
    194194
    195195    #region Helpers
    196     private void AttachEventHandlers() {
     196    private void RegisterEventHandlers() {
    197197      SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged);
    198198      EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged);
Note: See TracChangeset for help on using the changeset viewer.