예제 #1
0
        if master_config.network_config['use_dual']:
            network = create_pseudo_dual(prelim_network)
            for id in trip_data:
                trip_data[id] = rm_misc.get_dual_path(trip_data[id])
            del prelim_network

    #extract ds coefficient bounding box
    ext_bound = None
    if master_config.choice_set_config[
            'method'] == 'doubly_stochastic' and master_config.choice_set_config[
                'ext_bound']:
        if master_config.choice_set_config['bound_from_file']:
            ext_bound, master_config.choice_set_config[
                'weights'], master_config.choice_set_config[
                    'ranges'] = rm_input.read_bound(
                        master_config.choice_set_config['bound_file'],
                        return_ranges=True)
            del_keys = []
            if master_config.choice_set_config['bound_file_override'] == True:
                master_config.choice_set_config['variables'] = ext_bound.keys()
            else:
                for key in ext_bound:
                    if key not in master_config.choice_set_config['variables']:
                        del_keys.append(key)
                for key in del_keys:
                    del ext_bound[key]
            print 'EXT_BOUND: ', ext_bound
        else:
            if master_config['n_processes'] > 1:
                ext_bound = ds.get_extreme_bounding_box_multithreaded(
                    network, master_config.choice_set_config,
예제 #2
0
	print "number of trips: ", len(trip_data.keys())
	
	#create pseudo_dual
	network=prelim_network
	if 'use_dual' in master_config.network_config:
		if master_config.network_config['use_dual']:
			network=create_pseudo_dual(prelim_network)
			for id in trip_data:
				trip_data[id]=rm_misc.get_dual_path(trip_data[id])
			del prelim_network
				
	#extract ds coefficient bounding box
	ext_bound=None
	if master_config.choice_set_config['method']=='doubly_stochastic' and master_config.choice_set_config['ext_bound']:
		if master_config.choice_set_config['bound_from_file']:
			ext_bound,master_config.choice_set_config['weights'],master_config.choice_set_config['ranges']=rm_input.read_bound(master_config.choice_set_config['bound_file'],return_ranges=True)
			del_keys=[]
			if master_config.choice_set_config['bound_file_override']==True:
				master_config.choice_set_config['variables']=ext_bound.keys()
			else:
				for key in ext_bound:
					if key not in master_config.choice_set_config['variables']:
						del_keys.append(key)
				for key in del_keys:
					del ext_bound[key]
			print 'EXT_BOUND: ', ext_bound
		else:
			if master_config['n_processes']>1:
				ext_bound=ds.get_extreme_bounding_box_multithreaded(network,master_config.choice_set_config,master_config['time_dependent_relation'],trip_times,trip_data,master_config['n_processes'])
			else:
				ext_bound=ds.get_extreme_bounding_box_random_sample(network,master_config.choice_set_config,master_config['time_dependent_relation'],trip_times,trip_data)
예제 #3
0
                master_config.network_config['exclude_group'][variable][1],
                False)
            prelim_network.remove_edges_from(exclude)

    #create pseudo_dual
    network = prelim_network
    if 'use_dual' in master_config.network_config:
        if master_config.network_config['use_dual']:
            network = create_pseudo_dual(prelim_network)
            network.make_centroid_gateways()
    print "Done."

    #read ds coefficient bounding box
    ext_bound, master_config.choice_set_config[
        'weights'], master_config.choice_set_config[
            'ranges'] = rm_input.read_bound(
                master_config.assign_config['bound_file'], return_ranges=True)
    del_keys = []
    if master_config.choice_set_config['bound_file_override'] == True:
        master_config.choice_set_config['variables'] = ext_bound.keys()
    else:
        for key in ext_bound:
            if key not in master_config.choice_set_config['variables']:
                del_keys.append(key)
        for key in del_keys:
            del ext_bound[key]

    #time-dependent variables not supported for assignment
    if master_config.choice_set_config['method'] == 'doubly_stochastic':
        for var in master_config.choice_set_config['variables']:
            if var in master_config['time_dependent_relation']:
                raise Exception, 'Time-dependent variables not supported for assignment'
예제 #4
0
		trip_data=rm_input.read_trip_data_from_matsim(master_config['travel_dir'])
	trip_times=rm_input.read_time(master_config['time_file'])
	
	#create pseudo_dual
	network=prelim_network
	if 'use_dual' in master_config.network_config:
		if master_config.network_config['use_dual']:
			network=create_pseudo_dual(prelim_network)
			for id in trip_data:
				trip_data[id]=rm_misc.get_dual_path(trip_data[id])
	
	#extract ds coefficient bounding box
	ext_bound=None
	if master_config.choice_set_config['method']=='doubly_stochastic' and master_config.choice_set_config['ext_bound']:
		if master_config.choice_set_config['bound_from_file']:
			ext_bound,master_config.choice_set_config['weights']=rm_input.read_bound(master_config.choice_set_config['bound_file'])
			del_keys=[]
			for key in ext_bound:
				if key not in master_config.choice_set_config['variables']:
					del_keys.append(key)
			for key in del_keys:
				del ext_bound[key]
		else:
			ext_bound=ds.get_extreme_bounding_box_random_sample(network,master_config.choice_set_config,master_config['time_dependent_relation'],trip_times,trip_data,master_config.choice_set_config['bound_percentile'])
	
	#set up time-dependent variables
	if master_config.choice_set_config['method']=='doubly_stochastic':
		for var in master_config['time_dependent_relation']:
			if var in master_config.choice_set_config['variables']:
				for rule in master_config['time_dependent_relation'][var]:
					master_config.choice_set_config['weights'][rule[1]]=master_config.choice_set_config['weights'][var]
예제 #5
0
    #create pseudo_dual
    network = prelim_network
    if 'use_dual' in master_config.network_config:
        if master_config.network_config['use_dual']:
            network = create_pseudo_dual(prelim_network)
            for id in trip_data:
                trip_data[id] = rm_misc.get_dual_path(trip_data[id])

    #extract ds coefficient bounding box
    ext_bound = None
    if master_config.choice_set_config[
            'method'] == 'doubly_stochastic' and master_config.choice_set_config[
                'ext_bound']:
        if master_config.choice_set_config['bound_from_file']:
            ext_bound, master_config.choice_set_config[
                'weights'] = rm_input.read_bound(
                    master_config.choice_set_config['bound_file'])
            del_keys = []
            for key in ext_bound:
                if key not in master_config.choice_set_config['variables']:
                    del_keys.append(key)
            for key in del_keys:
                del ext_bound[key]
        else:
            ext_bound = ds.get_extreme_bounding_box_random_sample(
                network, master_config.choice_set_config,
                master_config['time_dependent_relation'], trip_times,
                trip_data, master_config.choice_set_config['bound_percentile'])

    #set up time-dependent variables
    if master_config.choice_set_config['method'] == 'doubly_stochastic':
        for var in master_config['time_dependent_relation']: