Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13408


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
Files:
20 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
  • branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.QuadraticAssignment-3.3/QAPLIBInstancesTest.cs

    r12012 r13408  
    223223        qap.Load(provider.LoadData(instance));
    224224        if (qaplibInstances.ContainsKey(instance.Name)
    225           && qap.BestKnownQuality != null && qap.BestKnownQuality.Value != qaplibInstances[instance.Name])
    226           failedInstances.AppendLine(instance.Name + ": " + qap.BestKnownQuality.Value.ToString() + " vs " + qaplibInstances[instance.Name]);
     225          && qap.BestKnownQuality != null && qap.BestKnownQuality != qaplibInstances[instance.Name])
     226          failedInstances.AppendLine(instance.Name + ": " + qap.BestKnownQuality.ToString() + " vs " + qaplibInstances[instance.Name]);
    227227      }
    228228      Assert.IsTrue(failedInstances.Length == 0, "Following instances/solutions have suspicious best quality: " + Environment.NewLine + failedInstances.ToString());
  • branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.QuadraticAssignment-3.3/QAPMoveEvaluatorTest.cs

    r12012 r13408  
    3535    private const int ProblemSize = 10;
    3636    private static DoubleMatrix symmetricDistances, symmetricWeights, asymmetricDistances, asymmetricWeights, nonZeroDiagonalWeights, nonZeroDiagonalDistances;
     37
     38    private static QuadraticAssignmentProblem symmetricProblem, asymmetricProblem, nonZeroDiagonalProblem;
    3739    private static Permutation assignment;
    3840    private static MersenneTwister random;
     
    8284        nonZeroDiagonalWeights[index, index] = random.Next(1, ProblemSize * 100);
    8385      assignment = new Permutation(PermutationTypes.Absolute, ProblemSize, random);
     86
     87      symmetricProblem = new QuadraticAssignmentProblem();
     88      symmetricProblem.Distances = symmetricDistances;
     89      symmetricProblem.Weights = symmetricWeights;
     90
     91      asymmetricProblem = new QuadraticAssignmentProblem();
     92      asymmetricProblem.Distances = asymmetricDistances;
     93      asymmetricProblem.Weights = asymmetricWeights;
     94
     95      nonZeroDiagonalProblem = new QuadraticAssignmentProblem();
     96      nonZeroDiagonalProblem.Distances = nonZeroDiagonalDistances;
     97      nonZeroDiagonalProblem.Weights = nonZeroDiagonalWeights;
    8498    }
    8599
     
    88102    [TestProperty("Time", "short")]
    89103    public void Swap2MoveEvaluatorFastEvaluationTest() {
    90 
    91104      for (int i = 0; i < 500; i++) {
    92105        Swap2Move lastMove = new Swap2Move(random.Next(ProblemSize), random.Next(ProblemSize));
     
    100113        double moveAfter = QAPSwap2MoveEvaluator.Apply(assignment, currentMove,
    101114                moveBefore, symmetricWeights, symmetricDistances, lastMove);
    102         double before = QAPEvaluator.Apply(assignment, symmetricWeights, symmetricDistances);
    103         double after = QAPEvaluator.Apply(nextAssignment, symmetricWeights, symmetricDistances);
     115        double before = symmetricProblem.Evaluate(assignment);
     116        double after = symmetricProblem.Evaluate(nextAssignment);
    104117
    105118        Assert.IsTrue(moveAfter.IsAlmost(after - before), "Failed on symmetric matrices: " + Environment.NewLine
     
    109122        moveAfter = QAPSwap2MoveEvaluator.Apply(assignment, currentMove,
    110123                moveBefore, asymmetricWeights, asymmetricDistances, lastMove);
    111         before = QAPEvaluator.Apply(assignment, asymmetricWeights, asymmetricDistances);
    112         after = QAPEvaluator.Apply(nextAssignment, asymmetricWeights, asymmetricDistances);
     124        before = asymmetricProblem.Evaluate(assignment);
     125        after = asymmetricProblem.Evaluate(nextAssignment);
    113126
    114127        Assert.IsTrue(moveAfter.IsAlmost(after - before), "Failed on asymmetric matrices: " + Environment.NewLine
     
    118131        moveAfter = QAPSwap2MoveEvaluator.Apply(assignment, currentMove,
    119132                moveBefore, nonZeroDiagonalWeights, nonZeroDiagonalDistances, lastMove);
    120         before = QAPEvaluator.Apply(assignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);
    121         after = QAPEvaluator.Apply(nextAssignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);
     133        before = nonZeroDiagonalProblem.Evaluate(assignment);
     134        after = nonZeroDiagonalProblem.Evaluate(nextAssignment);
    122135
    123136        Assert.IsTrue(moveAfter.IsAlmost(after - before), "Failed on non-zero diagonal matrices: " + Environment.NewLine
     
    130143    [TestProperty("Time", "short")]
    131144    public void Swap2MoveEvaluatorTest() {
     145
    132146      for (int i = 0; i < 500; i++) {
    133147        int index1 = random.Next(ProblemSize);
     
    135149
    136150        // SYMMETRIC MATRICES
    137         double before = QAPEvaluator.Apply(assignment, symmetricWeights, symmetricDistances);
     151        double before = symmetricProblem.Evaluate(assignment);
    138152        Swap2Manipulator.Apply(assignment, index1, index2);
    139         double after = QAPEvaluator.Apply(assignment, symmetricWeights, symmetricDistances);
     153        double after = symmetricProblem.Evaluate(assignment);
    140154        double move = QAPSwap2MoveEvaluator.Apply(assignment, new Swap2Move(index1, index2, assignment), symmetricWeights, symmetricDistances);
    141155        Assert.IsTrue(move.IsAlmost(before - after), "Failed on symmetric matrices");
    142156
    143157        // ASYMMETRIC MATRICES
    144         before = QAPEvaluator.Apply(assignment, asymmetricWeights, asymmetricDistances);
     158        before = asymmetricProblem.Evaluate(assignment);
    145159        Permutation clone = (Permutation)assignment.Clone();
    146160        Swap2Manipulator.Apply(assignment, index1, index2);
    147         after = QAPEvaluator.Apply(assignment, asymmetricWeights, asymmetricDistances);
     161        after = asymmetricProblem.Evaluate(assignment);
    148162        move = QAPSwap2MoveEvaluator.Apply(clone, new Swap2Move(index1, index2), asymmetricWeights, asymmetricDistances);
    149163        Assert.IsTrue(move.IsAlmost(after - before), "Failed on asymmetric matrices");
    150164
    151165        // NON-ZERO DIAGONAL ASSYMETRIC MATRICES
    152         before = QAPEvaluator.Apply(assignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);
     166        before = nonZeroDiagonalProblem.Evaluate(assignment);
    153167        clone = (Permutation)assignment.Clone();
    154168        Swap2Manipulator.Apply(assignment, index1, index2);
    155         after = QAPEvaluator.Apply(assignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);
     169        after = nonZeroDiagonalProblem.Evaluate(assignment);
    156170        move = QAPSwap2MoveEvaluator.Apply(clone, new Swap2Move(index1, index2), nonZeroDiagonalWeights, nonZeroDiagonalDistances);
    157171        Assert.IsTrue(move.IsAlmost(after - before), "Failed on non-zero diagonal matrices");
     
    169183
    170184        // SYMMETRIC MATRICES
    171         double before = QAPEvaluator.Apply(assignment, symmetricWeights, symmetricDistances);
     185        double before = symmetricProblem.Evaluate(assignment);
    172186        InversionManipulator.Apply(assignment, Math.Min(index1, index2), Math.Max(index1, index2));
    173         double after = QAPEvaluator.Apply(assignment, symmetricWeights, symmetricDistances);
     187        double after = symmetricProblem.Evaluate(assignment);
    174188        double move = QAPInversionMoveEvaluator.Apply(assignment, new InversionMove(index1, index2, assignment), symmetricWeights, symmetricDistances);
    175189        Assert.IsTrue(move.IsAlmost(before - after), "Failed on symmetric matrices");
    176190
    177191        // ASYMMETRIC MATRICES
    178         before = QAPEvaluator.Apply(assignment, asymmetricWeights, asymmetricDistances);
     192        before = asymmetricProblem.Evaluate(assignment);
    179193        Permutation clone = (Permutation)assignment.Clone();
    180194        InversionManipulator.Apply(assignment, index1, index2);
    181         after = QAPEvaluator.Apply(assignment, asymmetricWeights, asymmetricDistances);
     195        after = asymmetricProblem.Evaluate(assignment);
    182196        move = QAPInversionMoveEvaluator.Apply(clone, new InversionMove(index1, index2), asymmetricWeights, asymmetricDistances);
    183197        Assert.IsTrue(move.IsAlmost(after - before), "Failed on asymmetric matrices");
    184198
    185199        // NON-ZERO DIAGONAL ASYMMETRIC MATRICES
    186         before = QAPEvaluator.Apply(assignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);
     200        before = nonZeroDiagonalProblem.Evaluate(assignment);
    187201        clone = (Permutation)assignment.Clone();
    188202        InversionManipulator.Apply(assignment, index1, index2);
    189         after = QAPEvaluator.Apply(assignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);
     203        after = nonZeroDiagonalProblem.Evaluate(assignment);
    190204        move = QAPInversionMoveEvaluator.Apply(clone, new InversionMove(index1, index2), nonZeroDiagonalWeights, nonZeroDiagonalDistances);
    191205        Assert.IsTrue(move.IsAlmost(after - before), "Failed on non-zero diagonal matrices");
     
    208222
    209223        // SYMMETRIC MATRICES
    210         double before = QAPEvaluator.Apply(assignment, symmetricWeights, symmetricDistances);
     224        double before = symmetricProblem.Evaluate(assignment);
    211225        Permutation clone = new Cloner().Clone(assignment);
    212226        TranslocationManipulator.Apply(assignment, index1, index2, insertPoint);
    213         double after = QAPEvaluator.Apply(assignment, symmetricWeights, symmetricDistances);
     227        double after = symmetricProblem.Evaluate(assignment);
    214228        double move = QAPTranslocationMoveEvaluator.Apply(clone, new TranslocationMove(index1, index2, insertPoint, assignment), symmetricWeights, symmetricDistances);
    215229        Assert.IsTrue(move.IsAlmost(after - before), "Failed on symmetric matrices");
    216230
    217231        // ASYMMETRIC MATRICES
    218         before = QAPEvaluator.Apply(assignment, asymmetricWeights, asymmetricDistances);
     232        before = asymmetricProblem.Evaluate(assignment);
    219233        clone = new Cloner().Clone(assignment);
    220234        TranslocationManipulator.Apply(assignment, index1, index2, insertPoint);
    221         after = QAPEvaluator.Apply(assignment, asymmetricWeights, asymmetricDistances);
     235        after = asymmetricProblem.Evaluate(assignment);
    222236        move = QAPTranslocationMoveEvaluator.Apply(clone, new TranslocationMove(index1, index2, insertPoint, assignment), asymmetricWeights, asymmetricDistances);
    223237        Assert.IsTrue(move.IsAlmost(after - before), "Failed on asymmetric matrices");
    224238
    225239        // NON-ZERO DIAGONAL ASYMMETRIC MATRICES
    226         before = QAPEvaluator.Apply(assignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);
     240        before = nonZeroDiagonalProblem.Evaluate(assignment);
    227241        clone = new Cloner().Clone(assignment);
    228242        TranslocationManipulator.Apply(assignment, index1, index2, insertPoint);
    229         after = QAPEvaluator.Apply(assignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);
     243        after = nonZeroDiagonalProblem.Evaluate(assignment);
    230244        move = QAPTranslocationMoveEvaluator.Apply(clone, new TranslocationMove(index1, index2, insertPoint, assignment), nonZeroDiagonalWeights, nonZeroDiagonalDistances);
    231245        Assert.IsTrue(move.IsAlmost(after - before), "Failed on non-zero diagonal matrices");
     
    241255
    242256        // SYMMETRIC MATRICES
    243         double before = QAPEvaluator.Apply(assignment, symmetricWeights, symmetricDistances);
     257        double before = symmetricProblem.Evaluate(assignment);
    244258        double move = QAPScrambleMoveEvaluator.Apply(assignment, scramble, symmetricWeights, symmetricDistances);
    245259        ScrambleManipulator.Apply(assignment, scramble.StartIndex, scramble.ScrambledIndices);
    246         double after = QAPEvaluator.Apply(assignment, symmetricWeights, symmetricDistances);
     260        double after = symmetricProblem.Evaluate(assignment);
    247261        Assert.IsTrue(move.IsAlmost(after - before), "Failed on symmetric matrices");
    248262
    249263        // ASYMMETRIC MATRICES
    250         before = QAPEvaluator.Apply(assignment, asymmetricWeights, asymmetricDistances);
     264        before = asymmetricProblem.Evaluate(assignment);
    251265        move = QAPScrambleMoveEvaluator.Apply(assignment, scramble, asymmetricWeights, asymmetricDistances);
    252266        ScrambleManipulator.Apply(assignment, scramble.StartIndex, scramble.ScrambledIndices);
    253         after = QAPEvaluator.Apply(assignment, asymmetricWeights, asymmetricDistances);
     267        after = asymmetricProblem.Evaluate(assignment);
    254268        Assert.IsTrue(move.IsAlmost(after - before), "Failed on asymmetric matrices");
    255269
    256270        // NON-ZERO DIAGONAL ASYMMETRIC MATRICES
    257         before = QAPEvaluator.Apply(assignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);
     271        before = nonZeroDiagonalProblem.Evaluate(assignment);
    258272        move = QAPScrambleMoveEvaluator.Apply(assignment, scramble, nonZeroDiagonalWeights, nonZeroDiagonalDistances);
    259273        ScrambleManipulator.Apply(assignment, scramble.StartIndex, scramble.ScrambledIndices);
    260         after = QAPEvaluator.Apply(assignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);
     274        after = nonZeroDiagonalProblem.Evaluate(assignment);
    261275        Assert.IsTrue(move.IsAlmost(after - before), "Failed on non-zero diagonal matrices");
    262276      }
  • branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/AckleyEvaluatorTest.cs

    r13235 r13408  
    3737    [TestProperty("Time", "short")]
    3838    public void AckleyEvaluateFunctionTest() {
    39       AckleyEvaluator target = new AckleyEvaluator();
     39      var target = new Ackley();
    4040      RealVector point = null;
    4141      double expected = target.BestKnownQuality;
  • branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/BealeEvaluatorTest.cs

    r13235 r13408  
    3737    [TestProperty("Time", "short")]
    3838    public void BealeEvaluateFunctionTest() {
    39       BealeEvaluator target = new BealeEvaluator();
     39      var target = new Beale();
    4040      RealVector point = null;
    4141      double expected = target.BestKnownQuality;
  • branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/BoothEvaluatorTest.cs

    r13235 r13408  
    3737    [TestProperty("Time", "short")]
    3838    public void BoothEvaluateFunctionTest() {
    39       BoothEvaluator target = new BoothEvaluator();
     39      var target = new Booth();
    4040      RealVector point = null;
    4141      double expected = target.BestKnownQuality;
  • branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/GriewankEvaluatorTest.cs

    r13235 r13408  
    3737    [TestProperty("Time", "short")]
    3838    public void GriewankEvaluateFunctionTest() {
    39       GriewankEvaluator target = new GriewankEvaluator();
     39      var target = new Griewank();
    4040      RealVector point = null;
    4141      double expected = target.BestKnownQuality;
  • branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/LevyEvaluatorTest.cs

    r13235 r13408  
    3737    [TestProperty("Time", "short")]
    3838    public void LevyEvaluateFunctionTest() {
    39       LevyEvaluator target = new LevyEvaluator();
     39      var target = new Levy();
    4040      RealVector point = null;
    4141      double expected = target.BestKnownQuality;
  • branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/MatyasEvaluatorTest.cs

    r13235 r13408  
    3737    [TestProperty("Time", "short")]
    3838    public void MatyasEvaluateFunctionTest() {
    39       MatyasEvaluator target = new MatyasEvaluator();
     39      var target = new Matyas();
    4040      RealVector point = null;
    4141      double expected = target.BestKnownQuality;
  • branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/RastriginEvaluatorTest.cs

    r13235 r13408  
    3737    [TestProperty("Time", "short")]
    3838    public void RastriginEvaluateFunctionTest() {
    39       RastriginEvaluator target = new RastriginEvaluator();
     39      var target = new Rastrigin();
    4040      RealVector point = null;
    4141      double expected = target.BestKnownQuality;
  • branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/RosenbrockEvaluatorTest.cs

    r13235 r13408  
    3737    [TestProperty("Time", "short")]
    3838    public void RosenbrockEvaluateFunctionTest() {
    39       RosenbrockEvaluator target = new RosenbrockEvaluator();
     39      var target = new Rosenbrock();
    4040      RealVector point = null;
    4141      double expected = target.BestKnownQuality;
  • branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/SphereEvaluatorTest.cs

    r13235 r13408  
    3737    [TestProperty("Time", "short")]
    3838    public void SphereEvaluateFunctionTest() {
    39       SphereEvaluator target = new SphereEvaluator();
     39      var target = new Sphere();
    4040      RealVector point = null;
    4141      double expected = target.BestKnownQuality;
  • branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/SumSquaresEvaluatorTest.cs

    r13235 r13408  
    3737    [TestProperty("Time", "short")]
    3838    public void SumSquaresEvaluateFunctionTest() {
    39       SumSquaresEvaluator target = new SumSquaresEvaluator();
     39      var target = new SumSquares();
    4040      RealVector point = null;
    4141      double expected = target.BestKnownQuality;
  • branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/ZakharovEvaluatorTest.cs

    r13235 r13408  
    3737    [TestProperty("Time", "short")]
    3838    public void ZakharovEvaluateFunctionTest() {
    39       ZakharovEvaluator target = new ZakharovEvaluator();
     39      var target = new Zakharov();
    4040      RealVector point = null;
    4141      double expected = target.BestKnownQuality;
  • branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Scripting-3.3/Script Sources/GAQAPScriptSource.cs

    r11789 r13408  
    4242    for (int i = 0; i < popSize; i++) {
    4343      population[i] = new Permutation(PermutationTypes.Absolute, qap.Weights.Rows, random);
    44       qualities[i] = QAPEvaluator.Apply(population[i], qap.Weights, qap.Distances);
     44      qualities[i] = qap.Evaluate(population[i]);
    4545    }
    4646    var bestQuality = qualities.Min();
     
    5252        nextGen[i] = PartiallyMatchedCrossover.Apply(random, parents[i * 2], parents[i * 2 + 1]);
    5353        if (random.NextDouble() < mutationRate) Swap2Manipulator.Apply(random, nextGen[i]);
    54         nextQual[i] = QAPEvaluator.Apply(nextGen[i], qap.Weights, qap.Distances);
     54        nextQual[i] = qap.Evaluate(nextGen[i]);
    5555        if (nextQual[i] < bestQuality) {
    5656          bestQuality = nextQual[i];
  • branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Tests.csproj

    r13266 r13408  
    440440    <Compile Include="HeuristicLab-3.3\PluginLoader.cs" />
    441441    <Compile Include="HeuristicLab-3.3\Samples\AlpsSampleTest.cs" />
     442    <Compile Include="HeuristicLab-3.3\Samples\EsGriewankSampleTest.cs">
     443      <SubType>Code</SubType>
     444    </Compile>
    442445    <Compile Include="HeuristicLab-3.3\Samples\GPRobocodeSampleTest.cs" />
    443     <Compile Include="HeuristicLab-3.3\Samples\OSESGriewankSampleTest.cs" />
    444446    <Compile Include="HeuristicLab-3.3\Samples\GAGroupingProblemSampleTest.cs" />
     447    <Compile Include="HeuristicLab-3.3\Samples\LocalSearchKnapsackSampleTest.cs">
     448      <SubType>Code</SubType>
     449    </Compile>
     450    <Compile Include="HeuristicLab-3.3\Samples\OSESGriewankSampleTest.cs">
     451      <SubType>Code</SubType>
     452    </Compile>
     453    <Compile Include="HeuristicLab-3.3\Samples\PsoSchwefelSampleTest.cs">
     454      <SubType>Code</SubType>
     455    </Compile>
     456    <Compile Include="HeuristicLab-3.3\Samples\SimulatedAnnealingRastriginSampleTest.cs">
     457      <SubType>Code</SubType>
     458    </Compile>
    445459    <Compile Include="HeuristicLab-3.3\Samples\VnsOpSampleTest.cs" />
    446     <Compile Include="HeuristicLab-3.3\Samples\EsGriewankSampleTest.cs" />
    447460    <Compile Include="HeuristicLab-3.3\Samples\GaussianProcessRegressionSampleTest.cs" />
    448461    <Compile Include="HeuristicLab-3.3\Samples\GAVrpSampleTest.cs" />
     
    454467    <Compile Include="HeuristicLab-3.3\Samples\GPTimeSeriesSampleTest.cs" />
    455468    <Compile Include="HeuristicLab-3.3\Samples\GPMultiplexerSampleTest.cs" />
    456     <Compile Include="HeuristicLab-3.3\Samples\LocalSearchKnapsackSampleTest.cs" />
    457     <Compile Include="HeuristicLab-3.3\Samples\PsoSchwefelSampleTest.cs" />
    458469    <Compile Include="HeuristicLab-3.3\Samples\RAPGASchedulingSampleTest.cs" />
    459470    <Compile Include="HeuristicLab-3.3\Samples\SamplesUtils.cs" />
     
    461472    <Compile Include="HeuristicLab-3.3\Samples\IslandGaTspSampleTest.cs" />
    462473    <Compile Include="HeuristicLab-3.3\Samples\ScatterSearchVRPSampleTest.cs" />
    463     <Compile Include="HeuristicLab-3.3\Samples\SimulatedAnnealingRastriginSampleTest.cs" />
    464474    <Compile Include="HeuristicLab-3.3\Samples\TabuSearchTspSampleTest.cs" />
    465475    <Compile Include="HeuristicLab-3.3\Samples\TabuSearchVRPSampleTest.cs" />
     
    572582    <Compile Include="HeuristicLab.Problems.Instances-3.3\TSPLIBInstanceProviderTest.cs" />
    573583    <Compile Include="HeuristicLab.Problems.Instances.DataAnalysis-3.3\ClassificationInstanceProviderTest.cs" />
    574     <Compile Include="HeuristicLab.Problems.QuadraticAssignment-3.3\QAPLIBInstancesTest.cs" />
    575     <Compile Include="HeuristicLab.Problems.QuadraticAssignment-3.3\QAPMoveEvaluatorTest.cs" />
    576     <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\AckleyEvaluatorTest.cs" />
    577     <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\BealeEvaluatorTest.cs" />
    578     <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\BoothEvaluatorTest.cs" />
    579     <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\GriewankEvaluatorTest.cs" />
    580     <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\LevyEvaluatorTest.cs" />
    581     <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\MatyasEvaluatorTest.cs" />
    582     <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\RastriginEvaluatorTest.cs" />
    583     <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\RosenbrockEvaluatorTest.cs" />
    584     <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\SphereEvaluatorTest.cs" />
    585     <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\SumSquaresEvaluatorTest.cs" />
    586     <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\ZakharovEvaluatorTest.cs" />
     584    <Compile Include="HeuristicLab.Problems.QuadraticAssignment-3.3\QAPLIBInstancesTest.cs">
     585      <SubType>Code</SubType>
     586    </Compile>
     587    <Compile Include="HeuristicLab.Problems.QuadraticAssignment-3.3\QAPMoveEvaluatorTest.cs">
     588      <SubType>Code</SubType>
     589    </Compile>
     590    <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\AckleyEvaluatorTest.cs">
     591      <SubType>Code</SubType>
     592    </Compile>
     593    <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\BealeEvaluatorTest.cs">
     594      <SubType>Code</SubType>
     595    </Compile>
     596    <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\BoothEvaluatorTest.cs">
     597      <SubType>Code</SubType>
     598    </Compile>
     599    <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\GriewankEvaluatorTest.cs">
     600      <SubType>Code</SubType>
     601    </Compile>
     602    <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\LevyEvaluatorTest.cs">
     603      <SubType>Code</SubType>
     604    </Compile>
     605    <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\MatyasEvaluatorTest.cs">
     606      <SubType>Code</SubType>
     607    </Compile>
     608    <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\RastriginEvaluatorTest.cs">
     609      <SubType>Code</SubType>
     610    </Compile>
     611    <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\RosenbrockEvaluatorTest.cs">
     612      <SubType>Code</SubType>
     613    </Compile>
     614    <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\SphereEvaluatorTest.cs">
     615      <SubType>Code</SubType>
     616    </Compile>
     617    <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\SumSquaresEvaluatorTest.cs">
     618      <SubType>Code</SubType>
     619    </Compile>
     620    <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\ZakharovEvaluatorTest.cs">
     621      <SubType>Code</SubType>
     622    </Compile>
    587623    <Compile Include="HeuristicLab.Problems.TravelingSalesman-3.3\TSPMoveEvaluatorTest.cs" />
    588624    <Compile Include="HeuristicLab.Problems.LinearAssignment-3.3\LinearAssignmentProblemSolverTest.cs" />
     
    660696    </EmbeddedResource>
    661697  </ItemGroup>
     698  <ItemGroup />
    662699  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
    663700  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset for help on using the changeset viewer.