Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/19/20 14:26:41 (4 years ago)
Author:
mkommend
Message:

#2521: Removed unnecessary default ctors from problem base classes.

Location:
branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/MultiObjectiveProblem.cs

    r17567 r17610  
    3838    where TEncoding : class, IEncoding<TEncodedSolution>
    3939    where TEncodedSolution : class, IEncodedSolution {
    40     #region Parameternames
     40    #region Parameter names
    4141    public const string BestKnownFrontParameterName = "BestKnownFront";
    4242    public const string ReferencePointParameterName = "ReferencePoint";
    4343    #endregion
    4444
    45     #region Parameterproperties
     45    #region Parameter properties
    4646    [Storable] public IValueParameter<BoolArray> MaximizationParameter { get; }
    4747    public IValueParameter<DoubleMatrix> BestKnownFrontParameter {
     
    6363    }
    6464
    65     protected MultiObjectiveProblem() : base() {
    66       MaximizationParameter = new ValueParameter<BoolArray>("Maximization", "The dimensions correspond to the different objectives: False if the objective should be minimized, true if it should be maximized..", new BoolArray(new bool[] { }, @readonly: true));
    67       Parameters.Add(MaximizationParameter);
    68       Parameters.Add(new OptionalValueParameter<DoubleMatrix>(BestKnownFrontParameterName, "A double matrix representing the best known qualites for this problem (aka points on the Pareto front). Points are to be given in a row-wise fashion."));
    69       Parameters.Add(new OptionalValueParameter<DoubleArray>(ReferencePointParameterName, "The refrence point for hypervolume calculations on this problem"));
    70       Operators.Add(Evaluator);
    71       Operators.Add(new MultiObjectiveAnalyzer<TEncodedSolution>());
    72       ParameterizeOperators();
    73     }
    74 
    7565    protected MultiObjectiveProblem(TEncoding encoding) : base(encoding) {
    7666      MaximizationParameter = new ValueParameter<BoolArray>("Maximization", "The dimensions correspond to the different objectives: False if the objective should be minimized, true if it should be maximized..", new BoolArray(new bool[] { }, @readonly: true));
    7767      Parameters.Add(MaximizationParameter);
    7868      Parameters.Add(new OptionalValueParameter<DoubleMatrix>(BestKnownFrontParameterName, "A double matrix representing the best known qualites for this problem (aka points on the Pareto front). Points are to be given in a row-wise fashion."));
    79       Parameters.Add(new OptionalValueParameter<DoubleArray>(ReferencePointParameterName, "The refrence point for hypervolume calculations on this problem"));
     69      Parameters.Add(new OptionalValueParameter<DoubleArray>(ReferencePointParameterName, "The reference point for hypervolume calculations on this problem"));
    8070      Operators.Add(Evaluator);
    8171      Operators.Add(new MultiObjectiveAnalyzer<TEncodedSolution>());
  • branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Problem.cs

    r17570 r17610  
    101101    }
    102102
    103     protected Problem()
    104       : base() {
    105       Parameters.Add(new ValueParameter<TEncoding>("Encoding", "Describes the configuration of the encoding, what the variables are called, what type they are and their bounds if any.") { Hidden = true });
    106       Parameters.Add(new ValueParameter<TEvaluator>("Evaluator", "The operator used to evaluate a solution.") { Hidden = true });
    107 
    108       if (Encoding != null) {
    109         oldEncoding = Encoding;
    110         Parameterize();
    111       }
    112       RegisterEvents();
    113     }
    114     protected Problem(TEncoding encoding) {
     103    protected Problem(TEncoding encoding) : base() {
    115104      if (encoding == null) throw new ArgumentNullException("encoding");
    116105      Parameters.Add(new ValueParameter<TEncoding>("Encoding", "Describes the configuration of the encoding, what the variables are called, what type they are and their bounds if any.", encoding) { Hidden = true });
  • branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/SingleObjectiveProblem.cs

    r17570 r17610  
    7272      BestKnownQualityParameter = cloner.Clone(original.BestKnownQualityParameter);
    7373      MaximizationParameter = cloner.Clone(original.MaximizationParameter);
    74       Parameterize();
    75       RegisterEventHandlers();
    76     }
    77 
    78     protected SingleObjectiveProblem() : base() {
    79       MaximizationParameter = new ValueParameter<BoolValue>("Maximization", "Whether the problem should be maximized (True) or minimized (False).", new BoolValue(false).AsReadOnly()) { Hidden = true, ReadOnly = true };
    80       BestKnownQualityParameter = new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this problem.");
    81 
    82       Parameters.Add(MaximizationParameter);
    83       Parameters.Add(BestKnownQualityParameter);
    84 
    85       Operators.Add(Evaluator);
    86       Operators.Add(new SingleObjectiveAnalyzer<TEncodedSolution>());
    87       Operators.Add(new SingleObjectiveImprover<TEncodedSolution>());
    88       Operators.Add(new SingleObjectiveMoveEvaluator<TEncodedSolution>());
    89       Operators.Add(new SingleObjectiveMoveGenerator<TEncodedSolution>());
    90       Operators.Add(new SingleObjectiveMoveMaker<TEncodedSolution>());
    91 
    9274      Parameterize();
    9375      RegisterEventHandlers();
Note: See TracChangeset for help on using the changeset viewer.