Ejemplo n.º 1
0
 public void GetBigKnapsackMaxCostTest()
 {
     var items = new[] { new KnapsackItem(3, 4), new KnapsackItem(2, 3), new KnapsackItem(4, 2), new KnapsackItem(4, 3) };
     var knapsack = new Knapsack(items, 6);
     var solver = new BigKnapsackSolver(knapsack);
     solver.GetMaxCost().Should().Be(8);
 }
Ejemplo n.º 2
0
 public void Run()
 {
     using (var reader = new StreamReader("InputFiles//knapsack_big.txt"))
     using (var writer = new StreamWriter("output2.txt"))
     {
         var knapsack = KnapsackReader.GetKnapsack(reader);
         var solver = new BigKnapsackSolver(knapsack);
         var maxCost = solver.GetMaxCost();
         writer.WriteLine(maxCost);
     }
 }