# Path: route_model/choice_set/link_elimination.py
# def le_generate(G,chosen,choice_set_config):
# 	
# 	master_set=link_elimination(G,chosen[0],chosen[-1],G.euclid,G.config['dist_var'],choice_set_config['master_size'])
# 	chosen_overlap=calc_chosen_overlap(G,chosen,master_set,choice_set_config)
# 	sample_set=random.sample(master_set,choice_set_config['consider_size'])
# 	result_set=[chosen]
# 	chosen_seen=False
# 	for path in sample_set:
# 		if chosen_seen==False:
# 			if path==result_set[0]:
# 				chosen_seen=True
# 				if not choice_set_config['allow_duplicates_of_chosen_route']:
# 					continue
# 		result_set.append(path)
# 	if chosen_seen==False and not choice_set_config['allow_duplicates_of_chosen_route']:
# 		result_set.pop()
# 	return (result_set,chosen_overlap)
# 
# Path: route_model/choice_set/ds_generate.py
# def ds_generate(G,chosen,choice_set_config,link_randomizer,ext_bound,time_dependent_relation=None,trip_time=None):
# 	
# 	if choice_set_config['allow_duplicates_of_chosen_route']:
# 		master_set=ds_generate_master(G,chosen,choice_set_config,link_randomizer,time_dependent_relation,trip_time,ext_bound)
# 		overlap=calc_chosen_overlap(G,chosen,master_set,choice_set_config)
# 		filtered_set=filter_master(G,None,master_set[1:],choice_set_config)
# 		return ([chosen]+filtered_set,overlap)
# 	else:
# 		return filter_master(G,chosen,ds_generate_master(G,chosen,choice_set_config,link_randomizer,time_dependent_relation,trip_time,ext_bound),choice_set_config)


import random
from route_model.choice_set.link_elimination import le_generate
from route_model.choice_set.ds_generate import ds_generate

def generate_choice_set(G,chosen,choice_set_config,link_randomizer=None,time_dependent_relation=None,trip_time=None,ext_bound=None):
	
	config=choice_set_config
	
	if config['method']=='link_elimination':
		return le_generate(G,chosen,config)
		
	if config['method']=='doubly_stochastic':

# Path: route_model/choice_set/link_elimination.py
# def le_generate(G,chosen,choice_set_config):
# 	
# 	master_set=link_elimination(G,chosen[0],chosen[-1],G.euclid,G.config['dist_var'],choice_set_config['master_size'])
# 	chosen_overlap=calc_chosen_overlap(G,chosen,master_set,choice_set_config)
# 	sample_set=random.sample(master_set,choice_set_config['consider_size'])
# 	result_set=[chosen]
# 	chosen_seen=False
# 	for path in sample_set:
# 		if chosen_seen==False:
# 			if path==result_set[0]:
# 				chosen_seen=True
# 				if not choice_set_config['allow_duplicates_of_chosen_route']:
# 					continue
# 		result_set.append(path)
# 	if chosen_seen==False and not choice_set_config['allow_duplicates_of_chosen_route']:
# 		result_set.pop()
# 	return (result_set,chosen_overlap)
# 
# Path: route_model/choice_set/ds_generate.py
# def ds_generate(G,chosen,choice_set_config,link_randomizer,ext_bound,time_dependent_relation=None,trip_time=None):
# 	
# 	if choice_set_config['allow_duplicates_of_chosen_route']:
# 		master_set=ds_generate_master(G,chosen,choice_set_config,link_randomizer,time_dependent_relation,trip_time,ext_bound)
# 		overlap=calc_chosen_overlap(G,chosen,master_set,choice_set_config)
# 		filtered_set=filter_master(G,None,master_set[1:],choice_set_config)
# 		return ([chosen]+filtered_set,overlap)
# 	else:
# 		return filter_master(G,chosen,ds_generate_master(G,chosen,choice_set_config,link_randomizer,time_dependent_relation,trip_time,ext_bound),choice_set_config)


# Path: route_model/choice_set/generate_choice_set.py
import random
from route_model.choice_set.link_elimination import le_generate
from route_model.choice_set.ds_generate import ds_generate


def generate_choice_set(G,chosen,choice_set_config,link_randomizer=None,time_dependent_relation=None,trip_time=None,ext_bound=None):
	
	config=choice_set_config
	
	if config['method']=='link_elimination':
		return le_generate(G,chosen,config)
		
	if config['method']=='doubly_stochastic':

		return ds_generate(G,chosen,config,link_randomizer,ext_bound,time_dependent_relation,trip_time)