Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/21/18 09:18:49 (6 years ago)
Author:
bwerth
Message:

#2943 worked on MOBasicProblem - added Interfaces;reworked MOCalculators; several minor changes

Location:
branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Optimization/3.3/BasicProblems
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Optimization/3.3/BasicProblems/BasicProblem.cs

    r15583 r16171  
    3030namespace HeuristicLab.Optimization {
    3131  [StorableClass]
    32   public abstract class BasicProblem<TEncoding, TEvaluator> : HeuristicOptimizationProblem<TEvaluator, ISolutionCreator>, IProblemDefinition, IStorableContent
     32  public abstract class BasicProblem<TEncoding, TEvaluator> : HeuristicOptimizationProblem<TEvaluator, ISolutionCreator>, IBasicProblem
    3333    where TEncoding : class, IEncoding
    3434    where TEvaluator : class, IEvaluator {
  • branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Optimization/3.3/BasicProblems/MultiObjectiveBasicProblem.cs

    r15583 r16171  
    3131namespace HeuristicLab.Optimization {
    3232  [StorableClass]
    33   public abstract class MultiObjectiveBasicProblem<TEncoding> : BasicProblem<TEncoding, MultiObjectiveEvaluator>, IMultiObjectiveHeuristicOptimizationProblem, IMultiObjectiveProblemDefinition
     33  public abstract class MultiObjectiveBasicProblem<TEncoding> : BasicProblem<TEncoding, MultiObjectiveEvaluator>, IMultiObjectiveBasicProblem
    3434  where TEncoding : class, IEncoding {
     35
     36    #region Parameternames
     37    public const string MaximizationParameterName = "Maximization";
     38    public const string BestKnownFrontParameterName = "BestKnownFront";
     39    public const string ReferencePointParameterName = "ReferencePoint";
     40    #endregion
     41
     42    #region Parameterproperties
     43    public IValueParameter<BoolArray> MaximizationParameter {
     44      get { return (IValueParameter<BoolArray>) Parameters[MaximizationParameterName]; }
     45    }
     46    public IValueParameter<DoubleMatrix> BestKnownFrontParameter {
     47      get { return (IValueParameter<DoubleMatrix>)Parameters[BestKnownFrontParameterName]; }
     48    }
     49    public IValueParameter<DoubleArray> ReferencePointParameter {
     50      get { return (IValueParameter<DoubleArray>)Parameters[ReferencePointParameterName]; }
     51    }
     52    #endregion
     53
     54    #region Properties
     55
     56    public abstract bool[] Maximization { get; }
     57
     58    public DoubleMatrix BestKnownFront {
     59      get { return Parameters.ContainsKey(BestKnownFrontParameterName) ? BestKnownFrontParameter.Value : null; }
     60      set { BestKnownFrontParameter.Value = value; }
     61    }
     62    public DoubleArray ReferencePoint {
     63      get { return Parameters.ContainsKey(ReferencePointParameterName) ? ReferencePointParameter.Value : null; }
     64      set { ReferencePointParameter.Value = value; }
     65    }
     66    #endregion
     67
    3568    [StorableConstructor]
    3669    protected MultiObjectiveBasicProblem(bool deserializing) : base(deserializing) { }
     
    4376    protected MultiObjectiveBasicProblem()
    4477      : base() {
    45       Parameters.Add(new ValueParameter<BoolArray>("Maximization", "Set to false if the problem should be minimized.", (BoolArray)new BoolArray(Maximization).AsReadOnly()));
    46 
     78      Parameters.Add(new ValueParameter<BoolArray>(MaximizationParameterName, "Set to false if the problem should be minimized.", (BoolArray)new BoolArray(Maximization).AsReadOnly()));
     79      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."));
     80      Parameters.Add(new OptionalValueParameter<DoubleArray>(ReferencePointParameterName, "The refrence point for hypervolume calculations on this problem"));
    4781      Operators.Add(Evaluator);
    4882      Operators.Add(new MultiObjectiveAnalyzer());
     
    5690    }
    5791
    58     public abstract bool[] Maximization { get; }
     92   
    5993    public abstract double[] Evaluate(Individual individual, IRandom random);
    6094    public virtual void Analyze(Individual[] individuals, double[][] qualities, ResultCollection results, IRandom random) { }
     
    96130    }
    97131
    98 
    99132    #region IMultiObjectiveHeuristicOptimizationProblem Members
    100133    IParameter IMultiObjectiveHeuristicOptimizationProblem.MaximizationParameter {
    101       get { return Parameters["Maximization"]; }
     134      get { return Parameters[MaximizationParameterName]; }
    102135    }
    103136    IMultiObjectiveEvaluator IMultiObjectiveHeuristicOptimizationProblem.Evaluator {
  • branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Optimization/3.3/BasicProblems/SingleObjectiveBasicProblem.cs

    r15583 r16171  
    3131namespace HeuristicLab.Optimization {
    3232  [StorableClass]
    33   public abstract class SingleObjectiveBasicProblem<TEncoding> : BasicProblem<TEncoding, SingleObjectiveEvaluator>,
    34     ISingleObjectiveProblemDefinition, ISingleObjectiveHeuristicOptimizationProblem
     33  public abstract class SingleObjectiveBasicProblem<TEncoding> : BasicProblem<TEncoding, SingleObjectiveEvaluator>, ISingleObjectiveBasicProblem
    3534  where TEncoding : class, IEncoding {
    3635
Note: See TracChangeset for help on using the changeset viewer.