warehouse_area_ratio = 2 trunk_ratio = 0.2 # load the data filename = "model_input_WL.xlsx" data_ins = DataHandler(file=filename, config=Config) df_performance = pd.DataFrame() m = 0 # for num in range(37, 3, -1): # for num in range(4,21): for num in [10]: # define the facility location model log.info('the model {} is running ....'.format(num)) Config.num_rdc = num Config.area_ratio = data_ins.warehouse_coeff[num] location_model = FacilityLocation(data=data_ins, config=Config) model = location_model.facility_location() if model == 0: continue log.info('the model is end') # toC df_c_network = location_model.c_end_network() df_c_network.to_csv('C_Network_{}.csv'.format(num)) if Config.sku_split: df_cdc_rdc_network = location_model.cdc_rdc_network() df_cdc_rdc_network.to_csv('CDC_RDC_Network_{}.csv'.format(num))
scheduler = Scheduler(Config, data_ins) model = scheduler.resource_scheduler_expected() solution, employee_num = scheduler.scheduler_solution() # total_cost, total_basic_cost, total_payment, total_discount_payment = scheduler.total_cost() # result_df = scheduler.scheduler_result() # result_df.to_excel('results/results_{}.xlsx'.format(key.strftime('%Y-%m-%d'))) result_solution[key.strftime('%Y-%m-%d')] = dict(solution) with open("results/solution_{}.json".format(mode), "w") as fp: json.dump(result_solution, fp) fp.close() elif mode =='expected_cvar': result_solution = {} for key in data_ins.demands.keys(): log.info('running the model based on {} predicted results'.format(key.strftime('%Y-%m-%d'))) data_ins.demands_daily = (data_ins.demands[key]) scheduler = Scheduler(Config, data_ins) model = scheduler.resource_scheduler_expected_cvar() solution, employee_num = scheduler.scheduler_solution() # total_cost, total_basic_cost, total_payment, total_discount_payment = scheduler.total_cost() # result_df = scheduler.scheduler_result() # result_df.to_excel('results/results_{}.xlsx'.format(key.strftime('%Y-%m-%d'))) result_solution[key.strftime('%Y-%m-%d')] = dict(solution) with open("results/solution_{}.json".format(mode), "w") as fp: json.dump(result_solution, fp) fp.close()