Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13448


Ignore:
Timestamp:
12/11/15 11:21:44 (9 years ago)
Author:
bwerth
Message:

#1087 implemented more Testfunctions; enabled setting of SolutionSize

Location:
branches/HeuristicLab.Problems.MultiObjectiveTestFunctions
Files:
16 added
8 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/HeuristicLab.Problems.MultiObjectiveTestFunctions-3.3.csproj

    r13421 r13448  
    9999    <Compile Include="Plugin.cs" />
    100100    <Compile Include="Properties\AssemblyInfo.cs" />
     101    <Compile Include="Testfunctions\DTLZ7.cs" />
     102    <Compile Include="Testfunctions\DTLZ6.cs" />
     103    <Compile Include="Testfunctions\DTLZ5.cs" />
     104    <Compile Include="Testfunctions\DTLZ4.cs" />
     105    <Compile Include="Testfunctions\DTLZ3.cs" />
     106    <Compile Include="Testfunctions\DTLZ2.cs" />
    101107    <Compile Include="Testfunctions\Evaluators.cs" />
     108    <Compile Include="Testfunctions\Kursawe.cs" />
     109    <Compile Include="Testfunctions\DTLZ1.cs" />
     110    <Compile Include="Testfunctions\ZDT6.cs" />
     111    <Compile Include="Testfunctions\ZDT4.cs" />
     112    <Compile Include="Testfunctions\ZDT3.cs" />
     113    <Compile Include="Testfunctions\ZDT2.cs" />
     114    <Compile Include="Testfunctions\ZDT1.cs" />
     115    <Compile Include="Testfunctions\SchafferN2.cs" />
     116    <Compile Include="Testfunctions\SchafferN1.cs" />
    102117    <Compile Include="Testfunctions\Fonseca.cs" />
    103118    <Compile Include="Testfunctions\MultiObjectiveTestFunction.cs" />
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Interfaces/IMultiObjectiveTestFunction.cs

    r13421 r13448  
    3636    int MinimumSolutionSize { get; }
    3737    int MaximumSolutionSize { get; }
     38    int ActualSolutionSize { get; set; }
    3839
    3940    //double Evaluate2D(double x, double y);
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/MultiObjectiveTestFunctionProblem.cs

    r13421 r13448  
    2121      get {
    2222        return Parameters.ContainsKey("TestFunction") ? TestFunction.Maximization : new bool[2];
    23       } //TODO shady
     23      }
    2424    }
    2525
    2626    #region Parameter Properties
     27
     28
    2729    private IFixedValueParameter<IntValue> ProblemSizeParameter {
    2830      get { return (IFixedValueParameter<IntValue>)Parameters["ProblemSize"]; }
     
    7375      Parameters.Add(new FixedValueParameter<IntValue>("ProblemSize", "The dimensionality of the problem instance (number of variables in the function).", new IntValue(2)));
    7476      Parameters.Add(new FixedValueParameter<IntValue>("SolutionSize", "The dimensionality of the solution vector (number of objectives).", new IntValue(2)));
    75       Parameters.Add(new ValueParameter<DoubleMatrix>("Bounds", "The bounds of the solution given as either one line for all variables or a line for each variable. The first column specifies lower bound, the second upper bound.", new DoubleMatrix(new double[,] { { -100, 100 } })));
     77      Parameters.Add(new ValueParameter<DoubleMatrix>("Bounds", "The bounds of the solution given as either one line for all variables or a line for each variable. The first column specifies lower bound, the second upper bound.", new DoubleMatrix(new double[,] { { -4, 4 } })));
    7678      Parameters.Add(new ValueParameter<IMultiObjectiveTestFunction>("TestFunction", "The function that is to be optimized.", new Fonseca()));
    7779
     
    9799      TestFunctionParameter.ValueChanged += TestFunctionParameterOnValueChanged;
    98100      ProblemSizeParameter.Value.ValueChanged += ProblemSizeOnValueChanged;
     101      SolutionSizeParameter.Value.ValueChanged += SolutionSizeOnValueChanged;
    99102      BoundsParameter.ValueChanged += BoundsParameterOnValueChanged;
    100103    }
    101104
    102     public double[] Evaluate(RealVector vector, IRandom random) {
    103       return TestFunction.Evaluate(vector);
     105    public double[] Evaluate(RealVector individual, IRandom random) {
     106      return TestFunction.Evaluate(individual);
    104107    }
    105     public sealed override double[] Evaluate(Individual individual, IRandom random) {
     108
     109    public override double[] Evaluate(Individual individual, IRandom random) {
    106110      return Evaluate(individual.RealVector(), random);
    107111    }
     112
    108113
    109114    #region Events
     
    114119    protected override void OnEvaluatorChanged() {
    115120      base.OnEvaluatorChanged();
    116      // Evaluator.QualityParameter.ActualNameChanged += Evaluator_QualityParameter_ActualNameChanged;
     121      // Evaluator.QualityParameter.ActualNameChanged += Evaluator_QualityParameter_ActualNameChanged;
    117122      Parameterize();
    118123    }
     124
    119125    //private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
    120126    //  Parameterize();
     
    134140        ProblemSize = Math.Max(TestFunction.MinimumSolutionSize, Math.Min(SolutionSize, TestFunction.MaximumSolutionSize));
    135141      }
    136 
    137142      Bounds = (DoubleMatrix)TestFunction.Bounds.Clone();
    138143      OnReset();
     
    143148        || ProblemSize > TestFunction.MaximumProblemSize)
    144149        ProblemSize = Math.Min(TestFunction.MaximumProblemSize, Math.Max(TestFunction.MinimumProblemSize, ProblemSize));
     150      //TODO problemsize dominates solutionSize
     151      SolutionSizeOnValueChanged(sender, eventArgs);
    145152    }
    146153
    147154    private void SolutionSizeOnValueChanged(object sender, EventArgs eventArgs) {
    148155      if (SolutionSize < TestFunction.MinimumSolutionSize
    149         || ProblemSize > TestFunction.MaximumSolutionSize)
    150         ProblemSize = Math.Min(TestFunction.MaximumSolutionSize, Math.Max(TestFunction.MinimumSolutionSize, SolutionSize));
     156        || SolutionSize > TestFunction.MaximumSolutionSize)
     157        SolutionSize = Math.Min(TestFunction.MaximumSolutionSize, Math.Max(TestFunction.MinimumSolutionSize, SolutionSize));
     158      TestFunction.ActualSolutionSize = SolutionSize;
     159      OnReset();
    151160    }
    152161
     
    163172
    164173    private void Parameterize() {
    165       //empty for now
    166174    }
     175
     176   
    167177    #endregion
    168 
    169 
    170178  }
    171179}
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Evaluators.cs

    r13421 r13448  
    226226    //original paper not accessible + wikipedia definition works only with fixed (3) dimensions
    227227    //http://darwin.di.uminho.pt/jecoli/index.php/Multiobjective_example [30.11.2015]
    228     private double[] Kursawe(RealVector r) { //no Bounds??
     228    private double[] Kursawe(RealVector r) { //-5,5
    229229      //objective 1
    230230      double f0 = 0.0;
     
    241241      return res;
    242242    }
    243 
    244243    //http://www.eng.buffalo.edu/Research/MODEL/mdo.test.orig/class2prob4/descr.html
    245244    //TODO this is not multi-objective
     
    305304      return res;
    306305    }
    307     private double[] Schaffer1(RealVector r) { //-5,10??
     306    private double[] Schaffer1(RealVector r) { //-A,A
    308307      if (r.Length != 1) return null;
    309308      double x = r[0];
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Fonseca.cs

    r13421 r13448  
    1313namespace HeuristicLab.Problems.TestFunctions {
    1414  [Item("Fonseca", "from // https://en.wikipedia.org/wiki/Test_functions_for_optimization [30.11.2015]")]
    15   [Creatable(CreatableAttribute.Categories.CombinatorialProblems, Priority = 210)]
    1615  [StorableClass]
    1716  public class Fonseca : MultiObjectiveTestFunction {
     
    5352    }
    5453
     54    public override int ActualSolutionSize {
     55      get {
     56        return 2;
     57      }
     58
     59      set {
     60      }
     61    }
     62
    5563    [StorableConstructor]
    5664    protected Fonseca(bool deserializing) : base(deserializing) { }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/MultiObjectiveTestFunction.cs

    r13421 r13448  
    5757    public abstract int MaximumProblemSize { get; }
    5858    /// <summary>
    59     /// Gets the minimum problem size.
     59    /// Gets and sets the actual solution size.
     60    /// </summary>
     61    public abstract int ActualSolutionSize { get; set; }
     62    /// <summary>
     63    /// Gets the minimum solution size.
    6064    /// </summary>
    6165    public abstract int MinimumSolutionSize { get; }
    6266    /// <summary>
    63     /// Gets the maximum problem size.
     67    /// Gets the maximum solution size.
    6468    /// </summary>
    6569    public abstract int MaximumSolutionSize { get; }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/SchafferN1.cs

    r13421 r13448  
    1313namespace HeuristicLab.Problems.TestFunctions {
    1414  [Item("SchafferN1", "from // https://en.wikipedia.org/wiki/Test_functions_for_optimization [30.11.2015]")]
    15   [Creatable(CreatableAttribute.Categories.CombinatorialProblems, Priority = 210)]
    1615  [StorableClass]
    1716  public class SchafferN1 : MultiObjectiveTestFunction {
     
    5352    }
    5453
     54    public override int ActualSolutionSize {
     55      get {
     56        return 2;
     57      }
     58
     59      set {
     60      }
     61    }
     62
    5563    [StorableConstructor]
    5664    protected SchafferN1(bool deserializing) : base(deserializing) { }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/SchafferN2.cs

    r13421 r13448  
    1313namespace HeuristicLab.Problems.TestFunctions {
    1414  [Item("SchafferN2", "from // https://en.wikipedia.org/wiki/Test_functions_for_optimization [30.11.2015]")]
    15   [Creatable(CreatableAttribute.Categories.CombinatorialProblems, Priority = 210)]
    1615  [StorableClass]
    1716  public class SchafferN2 : MultiObjectiveTestFunction {
     
    5352    }
    5453
     54    public override int ActualSolutionSize {
     55      get {
     56        return 2;
     57      }
     58
     59      set {
     60      }
     61    }
     62
    5563    [StorableConstructor]
    5664    protected SchafferN2(bool deserializing) : base(deserializing) { }
Note: See TracChangeset for help on using the changeset viewer.