示例#1
0
def exp_5_profile():
    """

    """
    scales = lab.linspace(0.0, 0.1, 10)
    route_tts = defaultdict(lambda: list())
    for scale in scales:
        net = MinTTTFlowLinkComplacencyProblem.load('../networks/exps/exp5/net_nash.json')
        net.scale = scale
        net.get_program().cr_solve()
        net.realize()
        for route in net.all_routes():
            route_tts[tuple(route.name())].append(net.route_travel_time(route))
    latex_figure()
    # lab.xscale("log")
    lab.hold(True)
    for route, values in route_tts.iteritems():
        lab.plot(scales, values,next(line_cycler), label='rte {0}'.format(route[1]), linewidth=3.0)
    route_tts = defaultdict(lambda: list())
    for scale in scales:
        net = MinTTTFlowLinkComparativeComplacencyProblem.load('../networks/exps/exp5/net_nash.json')
        net.scale = scale
        net.get_program().cr_print()
        net.get_program().cr_solve()
        net.realize()
        for route in net.all_routes():
            route_tts[tuple(route.name())].append(net.route_travel_time(route))
    for route, values in route_tts.iteritems():
        lab.plot(scales, values,next(line_cycler), label='rte {0}: comp.'.format(route[1]))
    lab.ylabel('Route latency $\\ell_r$ (s)')
    lab.xlabel('Complacency scale factor $\\alpha$ (-)')
    lab.title('Comparison of route latencies')
    lab.legend(loc=7)
    lab.savefig('figures/complacency_models_simple_network.pdf')
示例#2
0
def exp_5_test():
  net = MinTTTFlowLinkProblem.load('../networks/exps/exp5/net_nash.json')
  print net.total_travel_time()
  for route in net.all_routes():
    print route
    print net.route_travel_time(route)
  net.get_program().cr_solve()
  net.realize()
  print net.total_travel_time()
  for route in net.all_routes():
    print route
    print net.route_travel_time(route)
  net = MinTTTFlowLinkComplacencyProblem.load('../networks/exps/exp5/net_nash.json')
  net.scale = 1.01
  net.get_program().cr_solve()
  net.realize()
  print net.total_travel_time()
  for route in net.all_routes():
    print route
    print net.route_travel_time(route)