Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/20/17 15:41:27 (6 years ago)
Author:
abeham
Message:

#1614:

  • Implementing basic algorithm according to paper (rechecking all operators)
  • Checking implementation with paper
  • Improved speed of move generator
  • Improved speed of randomized solution creator
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP/UnitTests/ApproximateLocalSearchTest.cs

    r15512 r15553  
    1313    [TestMethod]
    1414    public void ApproximateLocalSearchApplyTest() {
    15       CollectionAssert.AreEqual(new[] { 0, 3, 4, 2, 2, 0, 4, 3, 2, 0 }, assignment.ToArray());
     15      CollectionAssert.AreEqual(new [] { 3, 2, 2, 0, 0, 0, 2, 3, 0, 2 }, assignment.ToArray());
    1616
    1717      var evaluation = instance.Evaluate(assignment);
    18       Assert.AreEqual(7177824, evaluation.FlowCosts);
    19       Assert.AreEqual(45, evaluation.InstallationCosts);
     18      Assert.AreEqual(3764492, evaluation.FlowCosts);
     19      Assert.AreEqual(46, evaluation.InstallationCosts);
    2020      Assert.AreEqual(0, evaluation.ExcessDemand);
    2121
    22       var quality = new DoubleValue(instance.ToSingleObjective(evaluation));
    23       Assert.AreEqual(27898616.781881168, quality.Value, 1e-9);
     22      var quality = instance.ToSingleObjective(evaluation);
     23      Assert.AreEqual(14631771.476177376, quality, 1e-9);
    2424
    25       var evaluatedSolutions = new IntValue(0);
    26       ApproximateLocalSearch.Apply(random, assignment, quality,
    27         ref evaluation, new IntValue(10), new IntValue(1000), instance,
    28         evaluatedSolutions, new PercentValue(0.5));
    29       Assert.AreEqual(896, evaluatedSolutions.Value);
    30       CollectionAssert.AreEqual(new[] { 2, 0, 0, 3, 3, 1, 0, 0, 2, 0 }, assignment.ToArray());
    31       Assert.AreEqual(11733118.305768538, quality.Value, 1e-9);
     25      var evaluatedSolutions = 0;
     26      ApproximateLocalSearch.Apply(random, assignment, ref quality,
     27        ref evaluation, 10, 0.5, 1000, instance,
     28        out evaluatedSolutions);
     29      Assert.AreEqual(300, evaluatedSolutions);
     30      CollectionAssert.AreEqual(new[] { 3, 2, 2, 0, 0, 2, 2, 3, 0, 0 }, assignment.ToArray());
     31      Assert.AreEqual(14271146.913257681, quality, 1e-9);
    3232    }
    3333
Note: See TracChangeset for help on using the changeset viewer.