31 lines
631 B
C#
31 lines
631 B
C#
|
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;
|
|||
|
}
|