private void Generate_csv_button_Click(object sender, RoutedEventArgs e) { int items_number = (int)items_slider.Value; int orders_number = (int)orders_slider.Value; CsvGenerator csv_generator = new CsvGenerator(items_number, orders_number); csv_generator.GenerateOrdersFile(); shop.Orders = obj_generator.CreateOrders(); // 1.Input Csv csv_generator.GenerateShipmentFile(shop.Orders); //Send Sum to Factory shop.Shipment = obj_generator.CreateShipment(); // 2.Input Csv all_label.Content = shop.Orders.Sum(x => x.TotalItems); }
public void OptimizationStoresLessItems_BiggerAmounts(int items_number, int orders_number) { CsvGenerator csv_generator = new CsvGenerator(items_number, orders_number); ObjectGenerator obj_generator = new ObjectGenerator(); optimizer = new Optimizer(); CancellationTokenSource cts = new CancellationTokenSource(); csv_generator.GenerateOrdersFile(); var orders = obj_generator.CreateOrders(); csv_generator.GenerateShipmentFile(orders); var shipment = obj_generator.CreateShipment(); Random rnd = new Random(); int test_num = 10; for (int i = 1; i <= test_num; i++) { var optimized_orders = optimizer.GetMonteCarlo(orders, shipment, cts.Token); var nonOpt_package = optimizer.GetNonOpt(orders, shipment); var opt_num = optimized_orders.Sum(x => x.TotalItems); var nonOpt_num = nonOpt_package.Sum(x => x.TotalItems); Assert.That(opt_num > nonOpt_num); } }