private void TryCalculate(int idEx) { var calculateModel = new CalculateModel(); var knManager = new KnapsackManager(); var itManager = new ItemManager(); var exManager = new ExampleManager(); calculateModel.Knapsacks = knManager.GetKnapsacks(idEx); calculateModel.Items = itManager.GetItems(idEx); calculateModel.CalculateError = exManager.GetCalculateError(idEx); _proxy.CalculateCompleted += _proxy_CalculateCompleted; _proxy.CalculateAsync(TransportConverter.CalculateModelConverter(calculateModel)); }
public void TestFindSolution2Knap() { var calculateModel = new CalculateModel {Knapsacks = new List<Knapsack>()}; calculateModel.Knapsacks.Add(new Knapsack {Capacity = 0.7}); calculateModel.Knapsacks.Add(new Knapsack {Capacity = 0.7}); calculateModel.Items = new List<Item> { new Item {Id = 1, Weight = 0.11}, new Item {Id = 2, Weight = 0.24}, new Item {Id = 3, Weight = 0.15}, new Item {Id = 4, Weight = 0.33}, new Item {Id = 5, Weight = 0.12}, new Item {Id = 6, Weight = 0.27} }; Result cm = new CalculateManager(calculateModel, new VariationManager()).TryCalculate(); }
public Result Calculate(CalculateModel calculateModel) { var calculateManager = new CalculateManager(calculateModel, new VariationManager()); Result result = calculateManager.TryCalculate(); return result; }
public CalculateManager(CalculateModel calculate, VariationManager variationManager) { _calculate = calculate; _variationManager = variationManager; }