Ejemplo n.º 1
0
    def __init__(self):
        #数据输入
        self.base_profit = -5  #multipliers
        data = Excel_processor(self.base_profit)
        self.node_list, self.g_number_of_nodes, self.link_list, self.g_number_of_links, self.task_list, \
        self.g_number_of_tasks,self.virtual_depot_id=data.read_links()
        # 输入车辆属性*5
        self.g_number_of_vehicles = 4
        self.vehicle_capacity = 100
        self.vehicle_departure_time_beginning = 0
        self.vehicle_arrival_time_ending = 200
        self.big_M = 100
        #ADMM
        self.ADMM_iteration_times = 100
        self.rpo = 0.5  #惩罚参数

        # DP参数
        self.g_ending_state_vector = [None] * (self.g_number_of_vehicles + 1)
        # self.g_ending_state_vector_for_lr = [None] * self.g_number_of_vehicles
        self.g_time_dependent_state_vector = []
        for v in range(self.g_number_of_vehicles + 1):
            self.g_time_dependent_state_vector.append([])
            intervals = self.vehicle_arrival_time_ending - self.vehicle_departure_time_beginning
            for t in range(intervals + 1):
                self.g_time_dependent_state_vector[v].append(
                    [None] * self.g_number_of_nodes)
        # beam searching:每个结点保留最多两个状态,成本最小
        self.Best_K_Size = 2

        # SST路径
        self.path_space_seq = []
        self.path_time_seq = []
        self.path_state_seq = []

        # 统计误差、记录乘子
        self.served_time = []
        self.repeat_served = []
        self.un_served = []
        self.record_profit = []
        self.max_label_cost = float("inf")

        # 上下界-ADMM
        self.ADMM_local_LB = [0] * self.ADMM_iteration_times
        self.ADMM_local_UB = [0] * self.ADMM_iteration_times
        self.ADMM_global_LB = [-self.max_label_cost
                               ] * self.ADMM_iteration_times
        self.ADMM_global_UB = [self.max_label_cost] * self.ADMM_iteration_times
        print("初始化完成!")

        #part 1 Column pool information
        self.column_pool_path_seq = [[]
                                     for i in range(self.g_number_of_vehicles)]
        self.column_pool_path_cost = [[]
                                      for i in range(self.g_number_of_vehicles)
                                      ]
        self.column_pool_path_serving = [
            [] for i in range(self.g_number_of_vehicles)
        ]
Ejemplo n.º 2
0
    def __init__(self):
        # Data input
        self.base_profit = -100000  #big profit for initial feasible solution
        data = Excel_processor(self.base_profit)
        self.node_list, self.g_number_of_nodes, self.link_list, self.g_number_of_links, self.task_list, \
        self.g_number_of_tasks, self.virtual_depot_id = data.read_links()
        # vehicle data
        self.g_number_of_vehicles = 1
        self.vehicle_capacity = 100
        self.vehicle_departure_time_beginning = 0
        self.vehicle_arrival_time_ending = 200
        self.big_M = 100
        #DW parameter
        self.DW_iteration_time = 500

        # DP parameters
        self.g_ending_state_vector = [None] * (self.g_number_of_vehicles + 1)
        self.g_time_dependent_state_vector = []
        for v in range(self.g_number_of_vehicles + 1):
            self.g_time_dependent_state_vector.append([])
            intervals = self.vehicle_arrival_time_ending - self.vehicle_departure_time_beginning
            for t in range(intervals + 1):
                self.g_time_dependent_state_vector[v].append(
                    [None] * self.g_number_of_nodes)
        # beam searching:每个结点保留最多两个状态,成本最小
        self.Best_K_Size = 3

        #Column information
        self.g_Column_SST_path = []  #[[[state],[space],[time]]]
        self.g_Column_cost = []  #[cost]
        self.g_Column_task_to_path_matrix = []  #[[all tasks]]

        #Output information
        #1.record LB and UB
        #2.path information (Iteration/vehicle/SST path)
        self.optimal_SST_path = []
        self.optimal_serving_state = []
        self.selected_columns = []
        self.reduced_cost_for_LB = []
        #3.dual variables(iteration/|P|+1)
        # self.dual_variables=[]
        print("Input is complete!")