public void CorrectFeaturesSupplYSumTest() { int numberOfProjects = 3; int numberOfExperts = 3; int numberOfFeatures = 4; Problem problem = GenerateProblem(numberOfFeatures, numberOfProjects, numberOfExperts); double methodCoefficient = 0; ProblemSolver solver = new ProblemSolver(problem, methodCoefficient); solver.BuildConnections(); solver.CreateStackOfFeaturesPopularity(); solver.CreateStackOfProjectsDifficulty(); int sum = 0; for (int f = 0; f < numberOfFeatures; f++) { foreach (Expert expert in problem.listExperts) { if (expert.HasFeature(f)) { sum += 1; } } } Assert.AreEqual(sum, solver._featuresSupplySum); }
public void CreateStackOfFeaturesPopularityTest() { int numberOfFeatures = 4; Problem problem = GenerateProblem(numberOfFeatures); double methodCoefficient = 0; ProblemSolver solver = new ProblemSolver(problem, methodCoefficient); solver.BuildConnections(); solver.CreateStackOfFeaturesPopularity(); Assert.AreEqual(numberOfFeatures, solver.StackOfFeaturesByPopularity.Count); }
public void SolveForFeatureTest() { int numberOfProjects = 5; int numberOfExperts = 2; int numberOfFeatures = 3; Problem problem = GenerateProblem(numberOfFeatures, numberOfProjects, numberOfExperts, true); double methodCoefficient = 0; ProblemSolver solver = new ProblemSolver(problem, methodCoefficient); solver.BuildConnections(); solver.CreateStackOfFeaturesPopularity(); solver.CreateStackOfProjectsDifficulty(); bool matched = solver.SolveForFeature(0); Assert.IsTrue(matched); }
public void AssignedExpertsAreRemovedTest() { int numberOfProjects = 5; int numberOfExperts = 2; int numberOfFeatures = 3; Problem problem = GenerateProblem(numberOfFeatures, numberOfProjects, numberOfExperts); double methodCoefficient = 0; ProblemSolver solver = new ProblemSolver(problem, methodCoefficient); solver.BuildConnections(); solver.CreateStackOfFeaturesPopularity(); solver.CreateStackOfProjectsDifficulty(); int expertsCountBefore = problem.listExperts.Count; Expert expert = problem.listExperts.First(); Project proj = problem.listProjects.First(); solver.Assign(expert, proj, 0); Assert.AreEqual(expertsCountBefore - 1, solver.Problem.listExperts.Count); }