CourseWorkKnapsack/classes/KnapsackManager.cs

31 lines
631 B
C#
Raw Permalink Normal View History

2024-05-20 02:52:44 +04:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectKnapsack.classes;
public class KnapsackManager
{
private KnapsackSolver solver;
private Storage storage;
public KnapsackManager(KnapsackParameters parameters)
{
solver = new KnapsackSolver(parameters);
storage = new Storage();
storage.AddState(solver.SaveState());
}
public void Execute()
{
while (solver.Step())
{
storage.AddState(solver.SaveState());
}
}
public Storage Storage => storage;
}