예제 #1
0
파일: drawgraph.py 프로젝트: goncalor/IASD
def loadgraph():
	""" loads the graph from a file into memory """
	global graph

	filename = sys.argv[1]

	try:
		f = open(filename, 'r')
	except IOError:
		print("Failed to open '" + filename + "'.")
		exit()

	print('Creating graph... ', end='')
	graph = iofiles.newGraph(filename)
	print('Done.')

	f.close()	# close the file
예제 #2
0
파일: main.py 프로젝트: goncalor/IASD
# other modules
import argparse
import time
from pprint import pprint


parser = argparse.ArgumentParser(description='Solves "travel agent" problems.')
parser.add_argument('map', help='.map file defining the network')
parser.add_argument('requests', help='.cli file defining clients\' requests')
parser.add_argument('--no-heuristic', '-nh', action='store_true', help='use uninformed search')
args = parser.parse_args()

if __name__ == "__main__":

	print('Creating graph... ', end = '')
	graph = iofiles.newGraph(args.map)
	print('Done.')

	clients_list = iofiles.read_client_list(args.requests)

	sols = []

	print('Computing paths... ', end = '')

	# measure time
	start_time = time.time()

	for client in clients_list:

		# TODO remove copy, possibly
		cliGraph= graph.deepcopy()