Ejemplo n.º 1
0
    num_nodes_statistics = Statistics()
    depth_statistics = Statistics()
    stats_statistics = [Statistics() for _ in range(5)]
    planner_value_statistics = defaultdict(lambda: Statistics())
    value_statistics = defaultdict(lambda: Statistics())

    while len(total_reward_statistics) < 100 or total_reward_statistics.stderr(
    ) > TARGET_SE:
        # Read request and process.
        (steps, total_reward, collision, num_nodes, depth,
         stats) = socket.recv_pyobj()
        socket.send_pyobj(0)

        if args.task not in ['DriveHard']:
            if not collision:
                steps_statistics.append(steps)
        else:
            steps_statistics.append(steps)
        total_reward_statistics.append(total_reward)
        collision_statistics.append(collision)
        if num_nodes is not None:
            num_nodes_statistics.append(num_nodes)
        if depth is not None:
            depth_statistics.append(depth)
        for (s, ss) in zip(stats, stats_statistics):
            if s is not None:
                ss.extend(s)

        print(
            '\r\033[K{}\t| {}\t| {}\t| {}\t| {}\t| {}\t| {}\t| {}\t| {}\t| {}'.
            format(steps_statistics, total_reward_statistics,
Ejemplo n.º 2
0
    while True:

        # Read request and process.
        request = socket.recv_pyobj()
        instruction = request[0]
        instruction_data = request[1:]

        if instruction == 'ADD_TRAJECTORY_RESULT':

            socket.send_pyobj(0)  # Return immediately.
            (steps, total_reward, collision, macro_length, num_nodes, depth,
             stats) = instruction_data

            if args.task not in ['DriveHard']:
                if not collision:
                    steps_statistics.append(steps)
            else:
                steps_statistics.append(steps)
            total_reward_statistics.append(total_reward)
            collision_statistics.append(collision)
            macro_length_statistics.append(macro_length)
            num_nodes_statistics.append(num_nodes)
            depth_statistics.append(depth)
            for (s, ss) in zip(stats, stats_statistics):
                if s is not None:
                    ss.extend(s)

            print('\r\033[K{} |{} |{} |{} |{} |{} |{} |{} |{}| {}'.format(
                str(steps_statistics).rjust(16, ' '),
                str(total_reward_statistics).rjust(19, ' '),
                str(collision_statistics).rjust(12, ' '),