Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/17/19 23:06:18 (5 years ago)
Author:
mkommend
Message:

#2521: Added StorableType attributes to interfaces and adapted basic problems.

File:
1 edited

Legend:

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

    r16801 r16806  
    3636    where TEncodedSolution : class, IEncodedSolution {
    3737
     38    protected IValueParameter<BoolArray> MaximizationParameter {
     39      get { return (IValueParameter<BoolArray>)Parameters["Maximization"]; }
     40    }
     41
    3842    [StorableConstructor]
    3943    protected MultiObjectiveProblem(StorableConstructorFlag _) : base(_) { }
     
    4448    }
    4549
    46     protected MultiObjectiveProblem()
    47       : base() {
     50    protected MultiObjectiveProblem() : base() {
     51      Parameters.Add(new ValueParameter<BoolArray>("Maximization", "Set to false if the problem should be minimized.", (BoolArray)new BoolArray(Maximization).AsReadOnly()));
     52
     53      Operators.Add(Evaluator);
     54      Operators.Add(new MultiObjectiveAnalyzer<TEncodedSolution>());
     55
     56      ParameterizeOperators();
     57    }
     58
     59    protected MultiObjectiveProblem(TEncoding encoding) : base(encoding) {
    4860      Parameters.Add(new ValueParameter<BoolArray>("Maximization", "Set to false if the problem should be minimized.", (BoolArray)new BoolArray(Maximization).AsReadOnly()));
    4961
     
    5971    }
    6072
     73    public int Objectives => Maximization.Length;
    6174    public abstract bool[] Maximization { get; }
    62     public abstract double[] Evaluate(TEncodedSolution individual, IRandom random);
    63     public virtual void Analyze(TEncodedSolution[] individuals, double[][] qualities, ResultCollection results, IRandom random) { }
     75    public abstract double[] Evaluate(TEncodedSolution solution, IRandom random);
     76    public virtual void Analyze(TEncodedSolution[] solutions, double[][] qualities, ResultCollection results, IRandom random) { }
    6477
    6578    protected override void OnOperatorsChanged() {
Note: See TracChangeset for help on using the changeset viewer.