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.Problems.ExternalEvaluation/3.4/ExternalEvaluationProblemInstances.cs

    r17570 r17614  
    4141  [StorableType("4ea0ded8-4451-4011-b88e-4d0680721b01")]
    4242  public sealed class SingleObjectiveBinaryVectorExternalEvaluationProblem : ExternalEvaluationProblem<BinaryVectorEncoding, BinaryVector> {
    43     [Storable] private ReferenceParameter<IntValue> DimensionRefParameter;
    44     public IValueParameter<IntValue> DimensionParameter => DimensionRefParameter;
     43    [Storable] private ReferenceParameter<IntValue> DimensionRefParameter { get; set; }
    4544
    4645    public int Dimension {
     
    7271  [StorableType("46465e8c-11d8-4d02-8c45-de41a08db7fa")]
    7372  public sealed class SingleObjectiveIntegerVectorExternalEvaluationProblem : ExternalEvaluationProblem<IntegerVectorEncoding, IntegerVector> {
    74     [Storable] private ReferenceParameter<IntValue> DimensionRefParameter;
    75     public IValueParameter<IntValue> DimensionParameter => DimensionRefParameter;
    76     [Storable] private ReferenceParameter<IntMatrix> BoundsRefParameter;
    77     public IValueParameter<IntMatrix> BoundsParameter => BoundsRefParameter;
     73    [Storable] private ReferenceParameter<IntValue> DimensionRefParameter { get; set; }
     74    [Storable] private ReferenceParameter<IntMatrix> BoundsRefParameter { get; set; }
    7875
    7976    public int Dimension {
     
    112109  [StorableType("637f091f-6601-494e-bafb-2a8ea474210c")]
    113110  public sealed class SingleObjectiveRealVectorExternalEvaluationProblem : ExternalEvaluationProblem<RealVectorEncoding, RealVector> {
    114     [Storable] private ReferenceParameter<IntValue> DimensionRefParameter;
    115     public IValueParameter<IntValue> DimensionParameter => DimensionRefParameter;
    116     [Storable] private ReferenceParameter<DoubleMatrix> BoundsRefParameter;
    117     public IValueParameter<DoubleMatrix> BoundsParameter => BoundsRefParameter;
     111    [Storable] private ReferenceParameter<IntValue> DimensionRefParameter { get; set; }
     112    [Storable] private ReferenceParameter<DoubleMatrix> BoundsRefParameter { get; set; }
    118113
    119114    public int Dimension {
     
    152147  [StorableType("ad9d45f8-b97e-49a7-b3d2-487d9a2cbdf9")]
    153148  public sealed class SingleObjectivePermutationExternalEvaluationProblem : ExternalEvaluationProblem<PermutationEncoding, Permutation> {
    154     [Storable] private ReferenceParameter<IntValue> DimensionRefParameter;
    155     public IValueParameter<IntValue> DimensionParameter => DimensionRefParameter;
     149    [Storable] private ReferenceParameter<IntValue> DimensionRefParameter { get; set; }
    156150
    157151    public int Dimension {
     
    183177  [StorableType("9b3ee4a8-7076-4edd-ae7e-4188bc49aaa3")]
    184178  public sealed class SingleObjectiveSymbolicExpressionTreeExternalEvaluationProblem : ExternalEvaluationProblem<SymbolicExpressionTreeEncoding, ISymbolicExpressionTree> {
     179    [Storable] private ReferenceParameter<IntValue> TreeLengthRefParameter { get; set; }
     180    [Storable] private ReferenceParameter<IntValue> TreeDepthRefParameter { get; set; }
     181    [Storable] private ReferenceParameter<ISymbolicExpressionGrammar> GrammarRefParameter { get; set; }
     182
     183    public int TreeLength {
     184      get => TreeLengthRefParameter.Value.Value;
     185      set => TreeLengthRefParameter.Value.Value = value;
     186    }
     187
     188    public int TreeDepth {
     189      get => TreeDepthRefParameter.Value.Value;
     190      set => TreeDepthRefParameter.Value.Value = value;
     191    }
     192
     193    public ISymbolicExpressionGrammar Grammar {
     194      get => GrammarRefParameter.Value;
     195      set => GrammarRefParameter.Value = value;
     196    }
    185197
    186198    [StorableConstructor]
    187199    private SingleObjectiveSymbolicExpressionTreeExternalEvaluationProblem(StorableConstructorFlag _) : base(_) { }
    188     private SingleObjectiveSymbolicExpressionTreeExternalEvaluationProblem(SingleObjectiveSymbolicExpressionTreeExternalEvaluationProblem original, Cloner cloner) : base(original, cloner) { }
     200    private SingleObjectiveSymbolicExpressionTreeExternalEvaluationProblem(SingleObjectiveSymbolicExpressionTreeExternalEvaluationProblem original, Cloner cloner)
     201      : base(original, cloner) {
     202      TreeLengthRefParameter = cloner.Clone(original.TreeLengthRefParameter);
     203      TreeDepthRefParameter = cloner.Clone(original.TreeDepthRefParameter);
     204      GrammarRefParameter = cloner.Clone(original.GrammarRefParameter);
     205    }
    189206
    190207    public SingleObjectiveSymbolicExpressionTreeExternalEvaluationProblem()
    191208      : base(new SymbolicExpressionTreeEncoding()) {
    192       // TODO: Change to ReferenceParameter
    193       var lengthParameter = new FixedValueParameter<IntValue>("TreeLength", "The total amount of nodes.", new IntValue(50));
    194       Parameters.Add(lengthParameter);
    195       Encoding.TreeLengthParameter = lengthParameter;
    196       var depthParameter = new FixedValueParameter<IntValue>("TreeDepth", "The depth of the tree.", new IntValue(10));
    197       Parameters.Add(depthParameter);
    198       Encoding.TreeDepthParameter = depthParameter;
     209      Parameters.Add(TreeLengthRefParameter = new ReferenceParameter<IntValue>("TreeLength", "The maximum amount of nodes.", Encoding.TreeLengthParameter));
     210      Parameters.Add(TreeDepthRefParameter = new ReferenceParameter<IntValue>("TreeDepth", "The maximum depth of the tree.", Encoding.TreeDepthParameter));
     211      Parameters.Add(GrammarRefParameter = new ReferenceParameter<ISymbolicExpressionGrammar>("Grammar", "The grammar that describes a valid tree.", Encoding.GrammarParameter));
    199212      // TODO: Add and parameterize additional operators,
    200213    }
     
    210223  [StorableType("945a35d9-89a8-4423-9ea0-21829ac68887")]
    211224  public sealed class SingleObjectiveLinearLinkageExternalEvaluationProblem : ExternalEvaluationProblem<LinearLinkageEncoding, LinearLinkage> {
    212     [Storable] private ReferenceParameter<IntValue> DimensionRefParameter;
    213     public IValueParameter<IntValue> DimensionParameter => DimensionRefParameter;
     225    [Storable] private ReferenceParameter<IntValue> DimensionRefParameter { get; set; }
    214226
    215227    public int Dimension {
     
    258270  [StorableType("f14c7e88-b74d-4cad-ae55-83daf7b4c288")]
    259271  public sealed class MultiObjectiveBinaryVectorExternalEvaluationProblem : MultiObjectiveExternalEvaluationProblem<BinaryVectorEncoding, BinaryVector> {
    260     [Storable] private ReferenceParameter<IntValue> DimensionRefParameter;
    261     public IValueParameter<IntValue> DimensionParameter => DimensionRefParameter;
     272    [Storable] private ReferenceParameter<IntValue> DimensionRefParameter { get; set; }
    262273
    263274    public int Dimension {
     
    289300  [StorableType("90a82c2f-6c37-4ffd-8495-bee278c583d3")]
    290301  public sealed class MultiObjectiveIntegerVectorExternalEvaluationProblem : MultiObjectiveExternalEvaluationProblem<IntegerVectorEncoding, IntegerVector> {
    291     [Storable] private ReferenceParameter<IntValue> DimensionRefParameter;
    292     public IValueParameter<IntValue> DimensionParameter => DimensionRefParameter;
    293     [Storable] private ReferenceParameter<IntMatrix> BoundsRefParameter;
    294     public IValueParameter<IntMatrix> BoundsParameter => BoundsRefParameter;
     302    [Storable] private ReferenceParameter<IntValue> DimensionRefParameter { get; set; }
     303    [Storable] private ReferenceParameter<IntMatrix> BoundsRefParameter { get; set; }
    295304
    296305    public int Dimension {
     
    329338  [StorableType("38e1d068-d569-48c5-bad6-cbdd685b7c6b")]
    330339  public sealed class MultiObjectiveRealVectorExternalEvaluationProblem : MultiObjectiveExternalEvaluationProblem<RealVectorEncoding, RealVector> {
    331     [Storable] private ReferenceParameter<IntValue> DimensionRefParameter;
    332     public IValueParameter<IntValue> DimensionParameter => DimensionRefParameter;
    333     [Storable] private ReferenceParameter<DoubleMatrix> BoundsRefParameter;
    334     public IValueParameter<DoubleMatrix> BoundsParameter => BoundsRefParameter;
     340    [Storable] private ReferenceParameter<IntValue> DimensionRefParameter { get; set; }
     341    [Storable] private ReferenceParameter<DoubleMatrix> BoundsRefParameter { get; set; }
    335342
    336343    public int Dimension {
     
    369376  [StorableType("f1b265b0-ac7c-4c36-b346-5b3f2c37694b")]
    370377  public sealed class MultiObjectivePermutationExternalEvaluationProblem : MultiObjectiveExternalEvaluationProblem<PermutationEncoding, Permutation> {
    371     [Storable] private ReferenceParameter<IntValue> DimensionRefParameter;
    372     public IValueParameter<IntValue> DimensionParameter => DimensionRefParameter;
     378    [Storable] private ReferenceParameter<IntValue> DimensionRefParameter { get; set; }
    373379
    374380    public int Dimension {
     
    400406  [StorableType("fb6834e2-2d56-4711-a3f8-5e0ab55cd040")]
    401407  public sealed class MultiObjectiveSymbolicExpressionTreeExternalEvaluationProblem : MultiObjectiveExternalEvaluationProblem<SymbolicExpressionTreeEncoding, ISymbolicExpressionTree> {
     408    [Storable] private ReferenceParameter<IntValue> TreeLengthRefParameter { get; set; }
     409    [Storable] private ReferenceParameter<IntValue> TreeDepthRefParameter { get; set; }
     410    [Storable] private ReferenceParameter<ISymbolicExpressionGrammar> GrammarRefParameter { get; set; }
     411
     412    public int TreeLength {
     413      get => TreeLengthRefParameter.Value.Value;
     414      set => TreeLengthRefParameter.Value.Value = value;
     415    }
     416
     417    public int TreeDepth {
     418      get => TreeDepthRefParameter.Value.Value;
     419      set => TreeDepthRefParameter.Value.Value = value;
     420    }
     421
     422    public ISymbolicExpressionGrammar Grammar {
     423      get => GrammarRefParameter.Value;
     424      set => GrammarRefParameter.Value = value;
     425    }
    402426
    403427    [StorableConstructor]
    404428    private MultiObjectiveSymbolicExpressionTreeExternalEvaluationProblem(StorableConstructorFlag _) : base(_) { }
    405     private MultiObjectiveSymbolicExpressionTreeExternalEvaluationProblem(MultiObjectiveSymbolicExpressionTreeExternalEvaluationProblem original, Cloner cloner) : base(original, cloner) { }
     429    private MultiObjectiveSymbolicExpressionTreeExternalEvaluationProblem(MultiObjectiveSymbolicExpressionTreeExternalEvaluationProblem original, Cloner cloner)
     430      : base(original, cloner) {
     431      TreeLengthRefParameter = cloner.Clone(original.TreeLengthRefParameter);
     432      TreeDepthRefParameter = cloner.Clone(original.TreeDepthRefParameter);
     433      GrammarRefParameter = cloner.Clone(original.GrammarRefParameter);
     434    }
    406435
    407436    public MultiObjectiveSymbolicExpressionTreeExternalEvaluationProblem()
    408437      : base(new SymbolicExpressionTreeEncoding()) {
    409       // TODO: Change to ReferenceParameter
    410       var lengthParameter = new FixedValueParameter<IntValue>("TreeLength", "The total amount of nodes.", new IntValue(50));
    411       Parameters.Add(lengthParameter);
    412       Encoding.TreeLengthParameter = lengthParameter;
    413       var depthParameter = new FixedValueParameter<IntValue>("TreeDepth", "The depth of the tree.", new IntValue(10));
    414       Parameters.Add(depthParameter);
    415       Encoding.TreeDepthParameter = depthParameter;
     438      Parameters.Add(TreeLengthRefParameter = new ReferenceParameter<IntValue>("TreeLength", "The maximum amount of nodes.", Encoding.TreeLengthParameter));
     439      Parameters.Add(TreeDepthRefParameter = new ReferenceParameter<IntValue>("TreeDepth", "The maximum depth of the tree.", Encoding.TreeDepthParameter));
     440      Parameters.Add(GrammarRefParameter = new ReferenceParameter<ISymbolicExpressionGrammar>("Grammar", "The grammar that describes a valid tree.", Encoding.GrammarParameter));
    416441      // TODO: Add and parameterize additional operators,
    417442    }
     
    427452  [StorableType("ed0c1129-651d-465f-87b0-f412f3e3b3d1")]
    428453  public sealed class MultiObjectiveLinearLinkageExternalEvaluationProblem : MultiObjectiveExternalEvaluationProblem<LinearLinkageEncoding, LinearLinkage> {
    429     [Storable] private ReferenceParameter<IntValue> DimensionRefParameter;
    430     public IValueParameter<IntValue> DimensionParameter => DimensionRefParameter;
     454    [Storable] private ReferenceParameter<IntValue> DimensionRefParameter { get; set; }
    431455
    432456    public int Dimension {
Note: See TracChangeset for help on using the changeset viewer.