public void GetQAPLIBInstanceTest() { var target = new QAPLIBInstanceProvider(); StringBuilder erroneousInstances = new StringBuilder(); int count = 0; foreach (var id in target.GetDataDescriptors()) { try { target.LoadData(id); } catch (Exception ex) { erroneousInstances.AppendLine(id.Name + ": " + ex.Message); } count++; } Assert.IsTrue(count > 0, "No problem instances were found."); Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString()); }
public void TestQAPLIBInstances() { var provider = new QAPLIBInstanceProvider(); var qap = new QuadraticAssignmentProblem(); var failedInstances = new StringBuilder(); var instances = provider.GetDataDescriptors(); Assert.IsTrue(instances.Any(), "No instances could be found."); foreach (var instance in instances) { try { qap.Load(provider.LoadData(instance)); } catch (Exception ex) { failedInstances.AppendLine(instance + ": " + ex.Message); } } Assert.IsTrue(failedInstances.Length == 0, "Following instances failed: " + Environment.NewLine + failedInstances.ToString()); }
public void TestQAPLIBSolutions() { var provider = new QAPLIBInstanceProvider(); var qap = new QuadraticAssignmentProblem(); var failedInstances = new StringBuilder(); var instances = provider.GetDataDescriptors(); Assert.IsTrue(instances.Any(), "No instances could be found."); foreach (var instance in instances) { qap.Load(provider.LoadData(instance)); if (qaplibInstances.ContainsKey(instance.Name) && qap.BestKnownQuality != null && qap.BestKnownQuality.Value != qaplibInstances[instance.Name]) { failedInstances.AppendLine(instance.Name + ": " + qap.BestKnownQuality.Value.ToString() + " vs " + qaplibInstances[instance.Name]); } } Assert.IsTrue(failedInstances.Length == 0, "Following instances/solutions have suspicious best quality: " + Environment.NewLine + failedInstances.ToString()); }
public void TestQAPLIBLowerBounds() { var provider = new QAPLIBInstanceProvider(); var qap = new QuadraticAssignmentProblem(); var failedInstances = new StringBuilder(); var instances = provider.GetDataDescriptors(); Assert.IsTrue(instances.Any(), "No instances could be found."); foreach (var instance in instances) { if (lowerBounds.ContainsKey(instance.Name)) { qap.Load(provider.LoadData(instance)); if (qap.LowerBound.Value != lowerBounds[instance.Name]) { failedInstances.AppendLine(instance.Name + ": The Gilmore-Lawler lower bound is not valid."); } } } Assert.IsTrue(failedInstances.Length == 0, "Following instances failed for the GLB calculation: " + Environment.NewLine + failedInstances.ToString()); }
public void TestQAPLIBLowerBounds() { var provider = new QAPLIBInstanceProvider(); var qap = new QuadraticAssignmentProblem(); var failedInstances = new StringBuilder(); var instances = provider.GetDataDescriptors(); Assert.IsTrue(instances.Any(), "No instances could be found."); foreach (var instance in instances) { if (lowerBounds.ContainsKey(instance.Name)) { qap.Load(provider.LoadData(instance)); if (qap.LowerBound.Value != lowerBounds[instance.Name]) failedInstances.AppendLine(instance.Name + ": The Gilmore-Lawler lower bound is not valid."); } } Assert.IsTrue(failedInstances.Length == 0, "Following instances failed for the GLB calculation: " + Environment.NewLine + failedInstances.ToString()); }
public void TestQAPLIBSolutions() { var provider = new QAPLIBInstanceProvider(); var qap = new QuadraticAssignmentProblem(); var failedInstances = new StringBuilder(); var instances = provider.GetDataDescriptors(); Assert.IsTrue(instances.Any(), "No instances could be found."); foreach (var instance in instances) { qap.Load(provider.LoadData(instance)); if (qaplibInstances.ContainsKey(instance.Name) && qap.BestKnownQuality != null && qap.BestKnownQuality.Value != qaplibInstances[instance.Name]) failedInstances.AppendLine(instance.Name + ": " + qap.BestKnownQuality.Value.ToString() + " vs " + qaplibInstances[instance.Name]); } Assert.IsTrue(failedInstances.Length == 0, "Following instances/solutions have suspicious best quality: " + Environment.NewLine + failedInstances.ToString()); }