Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/12/16 14:15:05 (9 years ago)
Author:
abeham
Message:

#2551: added SetMaximization method, because there's no way to add a setter to an overridden property

Location:
trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.4/ExternalEvaluationProblem.cs

    r13498 r13500  
    108108    public override bool Maximization {
    109109      get { return Parameters.ContainsKey("Maximization") && ((IValueParameter<BoolValue>)Parameters["Maximization"]).Value.Value; }
    110       set { MaximizationParameter.Value.Value = value; }
     110    }
     111
     112    public virtual void SetMaximization(bool maximization) {
     113      MaximizationParameter.Value.Value = maximization;
    111114    }
    112115
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.4/MultiObjectiveExternalEvaluationProblem.cs

    r13491 r13500  
    5656      get { return (IFixedValueParameter<MultiObjectiveOptimizationSupportScript>)Parameters["SupportScript"]; }
    5757    }
     58
     59    private IFixedValueParameter<BoolArray> MaximizationParameter {
     60      get { return (IFixedValueParameter<BoolArray>)Parameters["Maximization"]; }
     61    }
    5862    #endregion
    5963
     
    101105        return Parameters.ContainsKey("Maximization") ? ((IValueParameter<BoolArray>)Parameters["Maximization"]).Value.ToArray() : new bool[0];
    102106      }
     107    }
     108
     109    public virtual void SetMaximization(bool[] maximization) {
     110      ((IStringConvertibleArray)MaximizationParameter.Value).Length = maximization.Length;
     111      var array = MaximizationParameter.Value;
     112      for (var i = 0; i < maximization.Length; i++)
     113        array[i] = maximization[i];
    103114    }
    104115
Note: See TracChangeset for help on using the changeset viewer.