Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/23/20 16:21:55 (4 years ago)
Author:
abeham
Message:

#2521:

  • Moving solution creator parameter from problems to algorithms (breaking wiring in some HeuristicOptimizationProblems)
  • Disallowing evaluator or encoding changes in encoding-specific base problems (to avoid confusion in derived problems whether this needs to be handled or not)
  • Added private set to ReferenceParameter property (serialization)
File:
1 edited

Legend:

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

    r17614 r17695  
    3737    where TEvaluator : class, IEvaluator {
    3838
    39     [Storable] protected ConstrainedValueParameter<ISolutionCreator> SolutionCreatorParameter { get; private set; }
    40 
    4139    //TODO remove parameter for encoding?
    4240    protected IValueParameter<TEncoding> EncodingParameter {
     
    5048        if (value == null) throw new ArgumentNullException("Encoding must not be null.");
    5149        EncodingParameter.Value = value;
    52       }
    53     }
    54 
    55     ISolutionCreator IHeuristicOptimizationProblem.SolutionCreator { get => SolutionCreatorParameter.Value; }
    56     IParameter IHeuristicOptimizationProblem.SolutionCreatorParameter { get => SolutionCreatorParameter; }
    57 
    58     event EventHandler IHeuristicOptimizationProblem.SolutionCreatorChanged {
    59       add {
    60         SolutionCreatorParameter.ValueChanged += value;
    61       }
    62       remove {
    63         SolutionCreatorParameter.ValueChanged -= value;
    6450      }
    6551    }
     
    10389      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 });
    10490      Parameters.Add(new ValueParameter<TEvaluator>("Evaluator", "The operator used to evaluate a solution.") { Hidden = true });
    105       Parameters.Add(SolutionCreatorParameter = new ConstrainedValueParameter<ISolutionCreator>("SolutionCreator", "The operator used to create a solution."));
    106 
     91     
    10792      oldEncoding = Encoding;
    10893      Parameterize();
     
    11499      : base(original, cloner) {
    115100      oldEncoding = cloner.Clone(original.oldEncoding);
    116       SolutionCreatorParameter = cloner.Clone(original.SolutionCreatorParameter);
    117101      RegisterEvents();
    118102    }
     
    123107    private void AfterDeserialization() {
    124108      oldEncoding = Encoding;
    125       // TODO: remove below
    126       if (SolutionCreatorParameter == null) Parameters.Add(SolutionCreatorParameter = new ConstrainedValueParameter<ISolutionCreator>("SolutionCreator", "The operator used to create a solution."));
    127 
    128109      RegisterEvents();
    129110    }
     
    160141      Encoding.ConfigureOperators(Operators);
    161142
    162       SolutionCreatorParameter.Repopulate(GetOperators());
    163143      //var multiEncoding = Encoding as MultiEncoding;
    164144      //if (multiEncoding != null) multiEncoding.EncodingsChanged += MultiEncodingOnEncodingsChanged;
Note: See TracChangeset for help on using the changeset viewer.