Ejemplo n.º 1
0
def exp_6():
  source = FlowLink(
    name = 'source',
    q_max=1.0,
    latency=MM1Latency(
      rho=1.0,
      mu=1.0
    )
  )
  sink = FlowLink(
    name = 'sink',
    q_max=1.0,
    latency=MM1Latency(
      rho=1.0,
      mu=1.0
    )
  )
  j = Junction([source], [sink])
  dem = ODDemand(
    source=source,
    sink=sink,
    flow=.5
  )
  net = MinTTTFlowLinkProblem()
  net.add_junction(j)
  net.demands.append(dem)
  net.dump('../networks/exps/exp6/net.json')
  net.get_program().cr_print()
  net.get_program().cr_solve(quiet=False)
Ejemplo n.º 2
0
def exp_5():
  net = MinTTTFlowLinkProblem()
  source = FlowLink(
    name='source',
    latency=AffineLatency(
      a=1.0,
      b=0.0
    ),
    q_max=1.0,
    flow=1.0
  )
  sink = FlowLink(
    name='sink',
    latency=AffineLatency(
      a=1.0,
      b=0.0
    ),
    q_max=1.0,
    flow=1.0
  )
  left = FlowLink(
    name='left',
    latency=AffineLatency(
      a=1.0,
      b=0.0
    ),
    q_max=1.0,
    flow=2.0/3
  )
  right = FlowLink(
    name='right',
    latency=AffineLatency(
      a=.5,
      b=.5
    ),
    q_max=1.0,
    flow=1.0/3
  )
  js = [
    Junction([source], [left,right]),
    Junction([left,right], [sink]),
    ]
  [net.add_junction(j) for j in js]
  left_demand = RouteDemand(
    flow=.1,
    route=net.route_by_names(['source','left','sink'])
  )
  right_demand = RouteDemand(
    flow=.1,
    route=net.route_by_names(['source','right','sink'])
  )
  od_demand = ODDemand(
    source=source,
    sink=sink,
    flow=.8
  )
  net.demands.extend([left_demand,right_demand,od_demand])
  print net.check_feasible()
  net.dump('../networks/exps/exp5/net_nash.json')