Ejemplo n.º 1
0
def main():
    seed = 37429879
    #seed = 32617879
    timed = True
    filename = "./multi_agent_withouttimed.pth"
    _debug = False
    _refresh = 0.05

    if (_debug):
        window = RailViewWindow()

    evalthread = threading.Thread(target=evaluate,
                                  args=(
                                      seed,
                                      timed,
                                      filename,
                                      _debug,
                                      _refresh,
                                  ))
    evalthread.start()

    if (_debug):
        pyglet.clock.schedule_interval(window.update_texture, 1 / 120.0)
        pyglet.app.run()

    evalthread.join()
                sumreward = sumreward + sum(_reward_dict.values())
                if debug:
                    #print(action)
                    env_renderer.render_env(show=True, frames=False, show_observations=False)
                    time.sleep(refresh)

            # Print the performance of the algorithm
            print("%10s\t%8s\t%8.3f\t%9.6f" % (str(problemsize), str(success), sumreward, duration))


if __name__ == "__main__":

    # Number of maps of each size to consider.
    _num_maps = 10
    # If _timed = true, impose release dates and deadlines. False for regular (Assignment 1) behavior.
    _timed = True

    _debug = True
    _refresh = 0.3

    if (_debug):
        window = RailViewWindow()

    evalthread = threading.Thread(target=evalfun, args=(_num_maps,_timed,_debug,_refresh,))
    evalthread.start()

    if (_debug):
        pyglet.clock.schedule_interval(window.update_texture, 1/120.0)
        pyglet.app.run()

    evalthread.join()