Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/24/12 13:56:49 (12 years ago)
Author:
abeham
Message:

#1856: Added unit test for lower bound, made it more obvious that last element is not left out

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.QuadraticAssignment-3.3/QAPLIBInstancesTest.cs

    r7878 r8092  
    168168      { "wil100", 273038 }
    169169    };
     170    private static Dictionary<string, double> lowerBounds = new Dictionary<string, double>() {
     171      { "bur26a", 5315200 },
     172      { "bur26f", 3706888 },
     173      { "chr25a", 2765 },
     174      { "els19", 11971949 },
     175      { "esc32a", 35 },
     176      { "esc32e", 0 },
     177      { "had20", 6166 },
     178      { "kra32", 67390 },
     179      { "lipa50a", 62020 },
     180      { "lipa50b", 1210244 },
     181      { "nug30", 4539 },
     182      { "scr20", 86766 },
     183      { "sko42", 11311 },
     184      { "tai35a", 1951207 },
     185      { "tai35b", 30866283 },
     186      { "tai100a", 15824355 }
     187    };
    170188    #endregion
    171189
     
    204222          failedInstances.AppendLine(instance.Name + ": " + qap.BestKnownQuality.Value.ToString() + " vs " + qaplibInstances[instance.Name]);
    205223      }
    206       Assert.IsTrue(failedInstances.Length == 0, "Following instances/solutions have suspicious quality: " + Environment.NewLine + failedInstances.ToString());
     224      Assert.IsTrue(failedInstances.Length == 0, "Following instances/solutions have suspicious best quality: " + Environment.NewLine + failedInstances.ToString());
     225    }
     226
     227    [TestMethod]
     228    public void TestQAPLIBLowerBounds() {
     229      var provider = new QAPLIBInstanceProvider();
     230      var qap = new QuadraticAssignmentProblem();
     231      var failedInstances = new StringBuilder();
     232
     233      var instances = provider.GetDataDescriptors();
     234      Assert.IsTrue(instances.Any(), "No instances could be found.");
     235
     236      foreach (var instance in instances) {
     237        if (lowerBounds.ContainsKey(instance.Name)) {
     238          qap.Load(provider.LoadData(instance));
     239          if (qap.LowerBound.Value != lowerBounds[instance.Name])
     240            failedInstances.AppendLine(instance.Name + ": The Gilmore-Lawler lower bound is not valid.");
     241        }
     242      }
     243      Assert.IsTrue(failedInstances.Length == 0, "Following instances failed for the GLB calculation: " + Environment.NewLine + failedInstances.ToString());
    207244    }
    208245  }
Note: See TracChangeset for help on using the changeset viewer.