Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/26/15 17:36:54 (9 years ago)
Author:
mkommend
Message:

#2521: Adapted unit tests in problem refactoring branch.

Location:
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab-3.3/Samples
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab-3.3/Samples/EsGriewankSampleTest.cs

    r12012 r13408  
    6262      SingleObjectiveTestFunctionProblem problem = new SingleObjectiveTestFunctionProblem();
    6363
    64       problem.ProblemSize.Value = 10;
    65       problem.EvaluatorParameter.Value = new GriewankEvaluator();
     64      problem.ProblemSize = 10;
     65      problem.TestFunction = new Griewank();
    6666      problem.SolutionCreatorParameter.Value = new UniformRandomRealVectorCreator();
    67       problem.Maximization.Value = false;
    6867      problem.Bounds = new DoubleMatrix(new double[,] { { -600, 600 } });
    69       problem.BestKnownQuality.Value = 0;
     68      problem.BestKnownQuality = 0;
    7069      problem.BestKnownSolutionParameter.Value = new RealVector(10);
    7170      problem.Name = "Single Objective Test Function";
  • branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab-3.3/Samples/LocalSearchKnapsackSampleTest.cs

    r12012 r13408  
    5959      #region Problem Configuration
    6060      KnapsackProblem problem = new KnapsackProblem();
    61       problem.BestKnownQuality = new DoubleValue(362);
     61      problem.BestKnownQuality = 362;
    6262      problem.BestKnownSolution = new HeuristicLab.Encodings.BinaryVectorEncoding.BinaryVector(new bool[] {
    6363       true , false, false, true , true , true , true , true , false, true , true , true , true , true , true , false, true , false, true , true , false, true , true , false, true , false, true , true , true , false, true , true , false, true , true , false, true , false, true , true , true , true , true , true , true , true , true , true , true , true , true , false, true , false, false, true , true , false, true , true , true , true , true , true , true , true , false, true , false, true , true , true , true , false, true , true , true , true , true , true , true , true});
    64       problem.EvaluatorParameter.Value = new KnapsackEvaluator();
    6564      problem.SolutionCreatorParameter.Value = new RandomBinaryVectorCreator();
    66       problem.KnapsackCapacity.Value = 297;
    67       problem.Maximization.Value = true;
    68       problem.Penalty.Value = 1;
     65      problem.KnapsackCapacity = 297;
    6966      problem.Values = new IntArray(new int[] {
    7067  6, 1, 1, 6, 7, 8, 7, 4, 2, 5, 2, 6, 7, 8, 7, 1, 7, 1, 9, 4, 2, 6, 5,  3, 5, 3, 3, 6, 5, 2, 4, 9, 4, 5, 7, 1, 4, 3, 5, 5, 8, 3, 6, 7, 3, 9, 7, 7, 5, 5, 7, 1, 4, 4, 3, 9, 5, 1, 6, 2, 2, 6, 1, 6, 5, 4, 4, 7, 1,  8, 9, 9, 7, 4, 3, 8, 7, 5, 7, 4, 4, 5});
  • branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab-3.3/Samples/OSESGriewankSampleTest.cs

    r13237 r13408  
    2121
    2222using System.IO;
    23 using HeuristicLab.Algorithms.EvolutionStrategy;
    2423using HeuristicLab.Algorithms.OffspringSelectionEvolutionStrategy;
    2524using HeuristicLab.Data;
     
    6362      SingleObjectiveTestFunctionProblem problem = new SingleObjectiveTestFunctionProblem();
    6463
    65       problem.ProblemSize.Value = 10;
    66       problem.EvaluatorParameter.Value = new GriewankEvaluator();
     64      problem.ProblemSize = 10;
     65      problem.TestFunction = new Griewank();
    6766      problem.SolutionCreatorParameter.Value = new UniformRandomRealVectorCreator();
    68       problem.Maximization.Value = false;
    6967      problem.Bounds = new DoubleMatrix(new double[,] { { -600, 600 } });
    70       problem.BestKnownQuality.Value = 0;
     68      problem.BestKnownQuality = 0;
    7169      problem.BestKnownSolutionParameter.Value = new RealVector(10);
    7270      problem.Name = "Single Objective Test Function";
  • branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab-3.3/Samples/PsoSchwefelSampleTest.cs

    r12012 r13408  
    6868      #region Problem Configuration
    6969      var problem = new SingleObjectiveTestFunctionProblem();
    70       problem.BestKnownQuality.Value = 0.0;
     70      problem.BestKnownQuality = 0.0;
    7171      problem.BestKnownSolutionParameter.Value = new RealVector(new double[] { 420.968746, 420.968746 });
    7272      problem.Bounds = new DoubleMatrix(new double[,] { { -500, 500 } });
    73       problem.EvaluatorParameter.Value = new SchwefelEvaluator();
    74       problem.Maximization.Value = false;
    75       problem.ProblemSize.Value = 2;
     73      problem.TestFunction = new Schwefel();
     74      problem.ProblemSize = 2;
    7675      problem.SolutionCreatorParameter.Value = new UniformRandomRealVectorCreator();
    7776      #endregion
  • branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab-3.3/Samples/SimulatedAnnealingRastriginSampleTest.cs

    r12012 r13408  
    5757      #region Problem Configuration
    5858      var problem = new SingleObjectiveTestFunctionProblem();
    59       problem.BestKnownQuality.Value = 0.0;
     59      problem.BestKnownQuality = 0.0;
    6060      problem.BestKnownSolutionParameter.Value = new RealVector(new double[] { 0, 0 });
    6161      problem.Bounds = new DoubleMatrix(new double[,] { { -5.12, 5.12 } });
    62       problem.EvaluatorParameter.Value = new RastriginEvaluator();
    63       problem.Maximization.Value = false;
    64       problem.ProblemSize.Value = 2;
     62      problem.TestFunction= new Rastrigin();
     63      problem.ProblemSize = 2;
    6564      problem.SolutionCreatorParameter.Value = new UniformRandomRealVectorCreator();
    6665      #endregion
     
    7978      sa.MaximumIterations.Value = 100;
    8079      var moveEvaluator = sa.MoveEvaluatorParameter.ValidValues
    81         .OfType<RastriginAdditiveMoveEvaluator>()
     80        .OfType<AdditiveMoveEvaluator>()
    8281        .Single();
    83       moveEvaluator.A.Value = 10;
    8482      sa.MoveEvaluator = moveEvaluator;
    8583
Note: See TracChangeset for help on using the changeset viewer.