예제 #1
0
    def __init__(self, TANK_PARAMS_LIST, TANK_DIST_LIST, MAIN_PARAMS):
        self.model = []
        for i, TANK_PARAMS in enumerate(TANK_PARAMS_LIST):
            tank = Tank(
                height=TANK_PARAMS["height"],
                radius=TANK_PARAMS["width"],
                max_level=TANK_PARAMS["max_level"],
                min_level=TANK_PARAMS["min_level"],
                pipe_radius=TANK_PARAMS["pipe_radius"],
                init_level=TANK_PARAMS["init_level"],
                dist=TANK_DIST_LIST[i],
            )
            self.model.append(tank)
        self.running = True
        self.episode = 0
        self.all_rewards = []
        self.terminated = False

        self.show_rendering = MAIN_PARAMS["RENDER"]
        self.live_plot = MAIN_PARAMS["LIVE_REWARD_PLOT"]

        if self.show_rendering:
            self.window = Window(self.model)
        if self.live_plot:
            plt.ion()  # enable interactivity
            plt.figure(num="Rewards per episode")  # make a figure
    def __init__(self, TANK_PARAMS, TANK_DIST, MAIN_PARAMS):
        self.tanks = []
        for i, PARAMS in enumerate(TANK_PARAMS):
            tank = Tank(
                height=PARAMS["height"],
                radius=PARAMS["width"],
                max_level=PARAMS["max_level"],
                min_level=PARAMS["min_level"],
                pipe_radius=PARAMS["pipe_radius"],
                init_level=PARAMS["init_level"],
                dist=TANK_DIST[i],
            )
            self.tanks.append(tank)
        self.n_tanks = len(self.tanks)
        self.running = True
        self.terminated = [False] * self.n_tanks
        self.q_inn = [0] * (self.n_tanks + 1)
        self.show_rendering = MAIN_PARAMS["RENDER"]
        self.live_plot = MAIN_PARAMS["LIVE_REWARD_PLOT"]

        if self.show_rendering:
            self.window = Window(self.tanks)
        if self.live_plot:
            plt.ion()  # enable interactivity
            plt.figure(num="Rewards per episode")  # make a figure
    def __init__(self):
        self.model = Tank(TANK_HEIGHT, TANK_RADIUS)  # get model
        self.dist = InflowDist(DIST_PIPE_RADIUS, DIST_NOM_FLOW,
                               DIST_VARIANCE_FLOW)
        self.add_dist = ADD_INFLOW
        self.action_delay = TBCC
        self.action_delay_counter = -OBSERVATIONS  # Does not train on initial settings
        self.running = True
        self.episode = 0
        self.all_rewards = []
        self.terminated = False

        self.show_rendering = RENDER
        self.live_plot = LIVE_REWARD_PLOT
        if RENDER:
            self.window = Window(self.model)
        if LIVE_REWARD_PLOT:
            plt.ion()  # enable interactivity
            fig = plt.figure(num="Rewards per episode")  # make a figure
예제 #4
0
    def __init__(self, TANK_PARAMS, TANK_DIST, MAIN_PARAMS):
        self.tanks = []
        for i, PARAMS in enumerate(TANK_PARAMS):
            tank = Tank(
                height=PARAMS["height"],
                radius=PARAMS["width"],
                max_level=PARAMS["max_level"],
                min_level=PARAMS["min_level"],
                pipe_radius=PARAMS["pipe_radius"],
                init_level=PARAMS["init_level"],
                dist=TANK_DIST[i],
            )
            self.tanks.append(tank)
        self.n_tanks = len(self.tanks)
        self.running = True
        self.terminated = [False] * self.n_tanks
        self.q_inn = [0] * (self.n_tanks + 1)
        self.show_rendering = MAIN_PARAMS["RENDER"]

        if self.show_rendering:
            self.window = Window(self.tanks)