Пример #1
0
 def __init__(self) :
     roadmap = ACC2014Square()
     
     super(ACC2014Distr,self).__init__(roadmap, 'length' )
     
     rategraph = nx.DiGraph()
     rategraph.add_edge( 'N', 'E', rate=1./5 )
     rategraph.add_edge( 'W', 'E', rate=1./5 )
     rategraph.add_edge( 'W', 'S', rate=3./5 )
     
     self._meancarry = roadcplx.carryMileageRate( roadmap, rategraph )
     self._meanfetch = roadcplx.fetchMileageRate( roadmap, rategraph )
     
     # for sampler
     weights = { (r1,r2) : data.get( 'rate' )
                for r1,r2, data in rategraph.edges_iter( data=True )
                }
     #weights[ ('N','E') ] = 1./5
     #weights[ ('W','E') ] = 1./5
     #weights[ ('W','S') ] = 3./5
     self.wset = roadprob.WeightedSet(weights)
Пример #2
0
 probe.horizon = 10000.
 
 complexity_computed = []
 complexity_estimated = []
 
 def showresults() :
     plt.scatter( complexity_computed, complexity_estimated )
     
 for t in range(1) :
     roadnet, rategraph = get_sim_setting( mu=2. )
     
     R = totalrate( rategraph )
     n_rategraph = scale_rates( rategraph, 1. / R )
     
     enroute_velocity = carryMileageRate( roadnet, n_rategraph )
     balance_velocity = fetchMileageRate( roadnet, n_rategraph )
     complexity = enroute_velocity + balance_velocity
     #complexity = moverscomplexity( roadnet, n_rategraph )
     
     
     for k in range(1) :
         numveh = np.random.randint(1,5+1)
         
         rate_predicted = convert_complexity_and_servicerate( complexity, numveh )
         simrates = scale_rates( n_rategraph, .99 * rate_predicted )
         
         probe.scenario( roadnet, simrates, numveh, 1. )
         
         probe.sim_init()
         probe.run_sim()
         rate_observed = probe.rate_observed()