コード例 #1
0
        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));
        }
コード例 #2
0
        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();
        }
コード例 #3
0
 public Result Calculate(CalculateModel calculateModel)
 {
     var calculateManager = new CalculateManager(calculateModel, new VariationManager());
     Result result = calculateManager.TryCalculate();
     return result;
 }
コード例 #4
0
 public CalculateManager(CalculateModel calculate, VariationManager variationManager)
 {
     _calculate = calculate;
     _variationManager = variationManager;
 }