Esempio n. 1
0
def exp_1_nash():
  net = MinTTTComplacencyProblem.load('../../networks/exps/exp1/net_w_demand.json')
  left = net.link_by_name('left')
  right = net.link_by_name('right')
  left.flow = .75
  left.rho = left.fd.rho_cong(left.flow)
  right.flow = 1 - left.flow
  right.rho = right.fd.rho_ff(right.flow)
  source = net.link_by_name('source')
  sink = net.link_by_name('sink')
  source.flow = 1.0
  source.rho = source.fd.rho_ff(source.flow)
  sink.flow = 1.0
  sink.rho = source.fd.rho_ff(sink.flow)
  net.dump('../../networks/exps/exp1/net_nash.json')
Esempio n. 2
0
def exp_1_opt():
  """
show that you can add constraints on the fly, and that this increases the objective when you force large densities
  """
  net = MinTTTComplacencyProblem.load('../../networks/exps/exp1/net_w_demand.json')
  prog = net.get_program()
  prog.cr_print()
  prog.cr_solve()
  print 'obnjective', prog.cr_objective()
  left = net.link_by_name('left')
  prog.add_constraint(
    net.cr_geq(left.v_dens, left.fd.v * left.fd.q_max * 1.2)
  )
  prog.cr_print()
  prog.cr_solve()
  print 'obnjective', prog.cr_objective()
  for link in net.get_links():
    link.flow = link.v_flow.value
    link.rho = link.v_dens.value
  net.d3ize()
  print net.check_feasible()
Esempio n. 3
0
def exp_1_nash_feasible():
  net = MinTTTComplacencyProblem.load('../../networks/exps/exp1/net_nash.json')
  print 'is feasible: ', net.check_feasible()
  for route in net.all_routes():
    print 'route', route
    print route.travel_time()
  for link in net.get_links():
    print 'link', link
    print 'flow', link.flow
    print 'rho', link.rho
  print 'net tt', net.total_travel_time()
  program = net.get_program()
  left = net.link_by_name('left')
  program.add_constraint(net.cr_geq(left.v_dens,left.fd.rho_crit()*1.5))
  program.cr_print()
  program.cr_solve()
  net.realize()
  for link in net.get_links():
    print 'link', link
    print 'flow', link.flow
    print 'rho', link.rho
  print 'net tt', net.total_travel_time()