Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/19/20 17:53:36 (4 years ago)
Author:
abeham
Message:

#2521: work in progress (removed solution creator parameter from encoding), OrienteeringProblem and test functions are broken

File:
1 edited

Legend:

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

    r17612 r17614  
    3737    where TEvaluator : class, IEvaluator {
    3838
     39    [Storable] protected ConstrainedValueParameter<ISolutionCreator> SolutionCreatorParameter { get; private set; }
    3940
    4041    //TODO remove parameter for encoding?
     
    5253    }
    5354
    54 
    55     ISolutionCreator IHeuristicOptimizationProblem.SolutionCreator {
    56       get { return Encoding.SolutionCreator; }
    57     }
    58     IParameter IHeuristicOptimizationProblem.SolutionCreatorParameter {
    59       get { return Encoding.SolutionCreatorParameter; }
    60     }
     55    ISolutionCreator IHeuristicOptimizationProblem.SolutionCreator { get => SolutionCreatorParameter.Value; }
     56    IParameter IHeuristicOptimizationProblem.SolutionCreatorParameter { get => SolutionCreatorParameter; }
     57
    6158    event EventHandler IHeuristicOptimizationProblem.SolutionCreatorChanged {
    6259      add {
    63         if (Encoding != null) Encoding.SolutionCreatorChanged += value;
     60        SolutionCreatorParameter.ValueChanged += value;
    6461      }
    6562      remove {
    66         if (Encoding != null) Encoding.SolutionCreatorChanged -= value;
     63        SolutionCreatorParameter.ValueChanged -= value;
    6764      }
    6865    }
     
    106103      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 });
    107104      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."));
    108106
    109107      oldEncoding = Encoding;
     
    116114      : base(original, cloner) {
    117115      oldEncoding = cloner.Clone(original.oldEncoding);
     116      SolutionCreatorParameter = cloner.Clone(original.SolutionCreatorParameter);
    118117      RegisterEvents();
    119118    }
     
    124123    private void AfterDeserialization() {
    125124      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
    126128      RegisterEvents();
    127129    }
     
    157159
    158160      Encoding.ConfigureOperators(Operators);
     161
     162      SolutionCreatorParameter.Repopulate(GetOperators());
    159163      //var multiEncoding = Encoding as MultiEncoding;
    160164      //if (multiEncoding != null) multiEncoding.EncodingsChanged += MultiEncodingOnEncodingsChanged;
Note: See TracChangeset for help on using the changeset viewer.