import agentpy as ap import random import numpy as np from numpy import random import pandas as pd class Order(ap.Agent): xv_time_created: int # 订单创建时间 xv_time_circle: int # 随机生成的交货周期 xv_dlv_t: int # 客户希望的交货时间 ev_actual_dlv_t: int # 实际交付时间 ev_is_delivered: bool # 订单是否已交付 ev_is_accepted: bool # 订单是否被接受 ev_int_delay_time: int # 订单延迟交付时间 xv_ary_dlv_product: np.ndarray ev_ary_dlv_product: np.ndarray def setup(self, time_created): self.xv_time_created = time_created # 订单创建时间 # read the demand of 23 productions self.xv_ary_dlv_product = pd.read_excel("demand23.xlsx").to_numpy() # 接神经网络结果 self.ev_ary_dlv_product = pd.read_excel("demand23.xlsx").to_numpy()[:, 1] # 23x1 把产品的顺序按照xv_ary_product_id重新排列!!! self.xv_time_circle = np.random.randint(7, 11, 1) self.xv_dlv_t = self.xv_time_created + self.xv_time_circle # 随机生成期望交付时间 self.ev_actual_dlv_t = self.xv_dlv_t self.ev_int_delay_time = 0 # Set the initial status of order to be undelivered, accepted self.ev_is_delivered = False self.ev_is_accepted = False