Ejemplo n.º 1
0
def run_and_plot(emulator, network_trace, log_packet_file):
    # Run the emulator and you can specify the time for the emualtor's running.
    # It will run until there is no packet can sent by default.
    emulator.run_for_dur(15)

    # print the debug information of links and senders
    emulator.print_debug()

    # Output the picture of emulator-analysis.png
    # You can get more information from https://github.com/AItransCompetition/simple_emulator/tree/master#emulator-analysispng.
    analyze_emulator(log_packet_file, file_range="all", sender=[1])

    # Output the picture of rate_changing.png
    # You can get more information from https://github.com/AItransCompetition/simple_emulator/tree/master#cwnd_changingpng
    plot_rate(log_packet_file, trace_file=network_trace, file_range="all", sender=[1])

    print("Qoe : %d" % (cal_qoe()) )
def evaluate(solution_file, block_traces, network_trace, log_packet_file):
    # fixed random seed
    import random
    random.seed(1)

    # import the solution
    import importlib
    solution = importlib.import_module(solution_file)

    # Use the object you created above
    my_solution = solution.MySolution()

    # Create the emulator using your solution
    # Specify USE_CWND to decide whether or not use crowded windows. USE_CWND=False by default.
    # Specify ENABLE_LOG to decide whether or not output the log of packets. ENABLE_LOG=True by default.
    # You can get more information about parameters at https://github.com/AItransCompetition/simple_emulator/tree/master#constant
    emulator = SimpleEmulator(
        block_file=block_traces,
        trace_file=network_trace,
        solution=my_solution,
        # enable logging packet. You can train faster if USE_CWND=False
        ENABLE_LOG=True)

    # Run the emulator and you can specify the time for the emualtor's running.
    # It will run until there is no packet can sent by default.
    emulator.run_for_dur(15)

    # print the debug information of links and senders
    emulator.print_debug()

    # Output the picture of emulator-analysis.png
    # You can get more information from https://github.com/AItransCompetition/simple_emulator/tree/master#emulator-analysispng.
    analyze_emulator(log_packet_file, file_range="all")

    # Output the picture of rate_changing.png
    # You can get more information from https://github.com/AItransCompetition/simple_emulator/tree/master#cwnd_changingpng
    plot_rate(log_packet_file,
              trace_file=network_trace,
              file_range="all",
              sender=[1])

    print("Qoe : %d" % (cal_qoe()))
Ejemplo n.º 3
0
    
    # The file path of packets' log
    log_packet_file = "output/packet_log/packet-0.log"

    # Use the object you created above
    my_solution = MySolution()

    # Create the emulator using your solution
    # Specify USE_CWND to decide whether or not use crowded windows. USE_CWND=True by default.
    # Specify ENABLE_LOG to decide whether or not output the log of packets. ENABLE_LOG=True by default.
    # You can get more information about parameters at https://github.com/AItransCompetition/simple_emulator/tree/master#constant
    emulator = create_2flow_emulator(
        block_file=["../traces/data_video.csv", "../traces/data_audio.csv"],
        trace_file="../traces/trace.txt",
        solution=my_solution
    )

    # Run the emulator and you can specify the time for the emualtor's running.
    # It will run until there is no packet can sent by default.
    emulator.run_for_dur(15)

    # print the debug information of links and senders
    emulator.print_debug()

    # Output the picture of emulator-analysis.png
    # You can get more information from https://github.com/AItransCompetition/simple_emulator/tree/master#emulator-analysispng.
    analyze_pcc_emulator(log_packet_file, file_range="all", sender=[1])

    plot_rate(log_packet_file, trace_file="../traces/trace.txt", file_range="all", sender=[1])

    print(cal_qoe())
Ejemplo n.º 4
0
    # Use the object you created above
    my_solution = MySolution()

    # Create the emulator using your solution
    # Specify USE_CWND to decide whether or not use crowded windows. USE_CWND=True by default.
    # Specify ENABLE_LOG to decide whether or not output the log of packets. ENABLE_LOG=True by default.
    # You can get more information about parameters at https://github.com/AItransCompetition/simple_emulator/tree/master#constant
    emulator = PccEmulator(
        block_file=["traces/data_video.csv", "traces/data_audio.csv"],
        trace_file="traces/trace.txt",
        solution=my_solution,
        SEED=1,
        ENABLE_LOG=True
    )

    # Run the emulator and you can specify the time for the emualtor's running.
    # It will run until there is no packet can sent by default.
    emulator.run_for_dur(15)

    # print the debug information of links and senders
    emulator.print_debug()

    # Output the picture of emulator-analysis.png
    # You can get more information from https://github.com/AItransCompetition/simple_emulator/tree/master#emulator-analysispng.
    analyze_pcc_emulator(log_packet_file, file_range="all")

    plot_rate(log_packet_file, trace_file="traces/trace.txt", file_range="all")

    print(cal_qoe())