Пример #1
0
def exp_4():
  net = StateConstrainedNetwork.load('../networks/fpnet_with_demands.json')
  net.objective = lambda: 0
  l_9 = net.link_by_name('9')
  l_3 = net.link_by_name('3')
  l_8 = net.link_by_name('8')
  for link in net.get_links():
    if link in [l_9, l_3, l_8]:
      link.set_cong_state(link.CongState.CONG)
    else:
      link.set_cong_state(link.CongState.FF)
  net.get_program().cr_solve()
  net.realize()
  print net.total_travel_time()
  net.dump('../networks/exps/exp4/net_cong.json')

  net = StateConstrainedNetwork.load('../networks/exps/exp4/net_cong.json')
  net.get_program().cr_solve()
  net.realize()
  print net.total_travel_time()

  net = StateConstrainedComplacentNetwork.load('../networks/exps/exp4/net_cong.json')
  net.scale = 1.1
  net.get_program().cr_solve()
  net.realize()
  print net.total_travel_time()

  net = StateConstrainedComplacentNetwork.load('../networks/exps/exp4/net_cong.json')
  net.scale = 1000.0
  net.get_program().cr_solve()
  net.realize()
  print net.total_travel_time()

  net = StateConstrainedComplacentNetwork.load('../networks/exps/exp4/net_cong.json')
  net.scale = 10.0
  net.get_program().cr_solve()
  net.realize()
  print net.total_travel_time()
def exp_3_info():
  net = StateConstrainedComplacentNetwork.load('../networks/exps/exp3/net_demand.json')
  print 'ttt previous', net.total_travel_time()
  net.get_program().cr_solve()
  net.realize()
  print 'ttt after complacence optimize', net.total_travel_time()
  for route in net.all_routes():
    print 'route', route
    print 'heur tt', net.route_tt_heuristic(route).value
    print 'actual tt', route.travel_time()
  net = StateConstrainedNetwork.load('../networks/exps/exp3/net_demand.json')
  net.get_program().cr_solve()
  net.realize()
  print 'ttt after non-comp optimize', net.total_travel_time()
Пример #3
0
def exp_3_info():
  net = StateConstrainedComplacentNetwork.load('../networks/exps/exp3/net_demand.json')
  for cls in net.__class__.__mro__:
    print cls
  print 'ttt previous', net.total_travel_time()
  net.get_program().cr_print()
  net.get_program().cr_solve(quiet=False)
  for link in net.get_links():
    print link
    print link.v_dens.value
    print link.l
  net.realize()
  print 'ttt after complacence optimize', net.total_travel_time()
  for route in net.all_routes():
    print 'route', route
    print 'heur tt', net.route_tt_heuristic(route).value
    print 'actual tt', net.route_travel_time(route)
  net = StateConstrainedNetwork.load('../networks/exps/exp3/net_demand.json')
  net.get_program().cr_solve()
  net.realize()
  print 'ttt after non-comp optimize', net.total_travel_time()