Example #1
0
def main():
    bordVariables = bord(5)  # return [carsList,width,exit]
    global WIDTH
    WIDTH = bordVariables[1]
    global EXIT
    EXIT = bordVariables[2]
    global CARS_LIST
    CARS_LIST = bordVariables[0]
    global CARS_LIST_LENGHT
    CARS_LIST_LENGHT = len(CARS_LIST.cars)
    # TEST dept first algorithme:
    global INITIAL_STATE
    INITIAL_STATE = CARS_LIST.getFirstState()
    global STATES_ARCHIVE
    STATES_ARCHIVE = StatesArchive()

    algorithm(INITIAL_STATE)

    print "Algorithm is done"
    path1 = SOLUTION_PATHS[-1]
    print len(SOLUTION_PATHS)
    # #print
    for solution in SOLUTION_PATHS:
        print len(solution)
    # print results
    # print "length solutions ", len(SOLUTIONS)
    # print SOLUTIONS
    # print SOLUTION_PATHS
    # print "START"
    # for i in range(0, 3100, 30):
    # 	print len(SOLUTION_PATHS[i])

    runSimulation(CARS_LIST.getVisualisationList(), path1, WIDTH, WIDTH,
                  0.5)  # slordig dubble WIDTH meegeven
Example #2
0
def main():

    # choose the bord to perform the algoritmh on (1-7)
    bordVariables = bord(1)

    # set global variables
    global WIDTH
    WIDTH = bordVariables[1]
    global EXIT
    EXIT = bordVariables[2]
    global CARS_LIST
    CARS_LIST = bordVariables[0]
    global CARS_LIST_LENGHT
    CARS_LIST_LENGHT = len(CARS_LIST.cars)
    global INITIAL_STATE
    INITIAL_STATE = CARS_LIST.getFirstState()
    global STATES_ARCHIVE
    STATES_ARCHIVE = StatesArchive()

    # run the A star algorithm
    algorithm(INITIAL_STATE)

    # print the results of the algorithm
    print "Algorithm is done"
    shortestPath = SOLUTION_PATHS[-1]

    # run the simulation of the shortest path
    runSimulation(CARS_LIST.getVisualisationList(), shortestPath, WIDTH, WIDTH,
                  0.5)
Example #3
0
def main():

	# choose the bord to perform the algoritmh on (1-7)
	bordVariables = bord(1)

	# set global variables
	global WIDTH; WIDTH = bordVariables[1]
	global EXIT; EXIT = bordVariables[2]
	global CARS_LIST; CARS_LIST = bordVariables[0]
	global INITIAL_STATE; INITIAL_STATE = CARS_LIST.getFirstState()
	global STATES_ARCHIVE; STATES_ARCHIVE = StatesArchive()

	# run the Depth First Search algorithm
	algorithm(INITIAL_STATE)

	# print the results of the algorithm
	print "Algorithm is done"
	shortestPath = SOLUTION_PATHS[-1]
	print "amount of solutions: ", len(SOLUTION_PATHS)
	listOfLengths = []
	for path in SOLUTION_PATHS:
		listOfLengths.append(len(path))
	print "shortest found length: ", min(listOfLengths)
	print "length of dicionary: ", len(STATES_ARCHIVE.states)

	# run the simulation of the shortest path
	runSimulation(CARS_LIST.getVisualisationList(), shortestPath, WIDTH, WIDTH, 0.5)
Example #4
0
def main():
	bordVariables = bord(3) # return [carsList,width,exit]
	global WIDTH; WIDTH = bordVariables[1]
	global EXIT; EXIT = bordVariables[2]
	global CARS_LIST; CARS_LIST = bordVariables[0]
	global CARS_LIST_LENGHT; CARS_LIST_LENGHT = len(CARS_LIST.cars)
	# TEST dept first algorithme:
	global INITIAL_STATE; INITIAL_STATE = CARS_LIST.getFirstState()
	global STATES_ARCHIVE; STATES_ARCHIVE = StatesArchive()
	global RED_CAR_INT; RED_CAR_INT = len(CARS_LIST.cars) - 1	
	algorithm(INITIAL_STATE)

	print "Algorithm is done"
	path1 = SOLUTION_PATHS[-1]
	print len(SOLUTION_PATHS)
	# #print
	for solution in SOLUTION_PATHS:
		print len(solution)
Example #5
0
def main():
    bordVariables = bord(1)  # return [carsList,width,exit]
    global WIDTH
    WIDTH = bordVariables[1]
    global EXIT
    EXIT = bordVariables[2]
    global CARS_LIST
    CARS_LIST = bordVariables[0]
    # TEST dept first algorithme:
    global INITIAL_STATE
    INITIAL_STATE = CARS_LIST.getFirstState()
    global STATES_ARCHIVE
    STATES_ARCHIVE = StatesArchive()
    statesGenerated = algorithm(INITIAL_STATE)

    print "Algorithm is done"
    path1 = SOLUTION_PATHS[-1]
    print "amount of solutions: ", len(SOLUTION_PATHS)
    listOfLengths = []
    for path in SOLUTION_PATHS:
        listOfLengths.append(len(path))
    print "shortest found length: ", min(listOfLengths)
    print "length of dicionary: ", len(STATES_ARCHIVE.states)
    print "amount of stated generated: ", statesGenerated
    #for solution in SOLUTION_PATHS:
    #	print len(solution)
    # print results
    # print "length solutions ", len(SOLUTIONS)
    # print SOLUTIONS
    # print SOLUTION_PATHS
    # print "START"
    # for i in range(0, 3100, 30):
    # 	print len(SOLUTION_PATHS[i])
    raw_input("please enter to continue")
    runSimulation(CARS_LIST.getVisualisationList(), path1, WIDTH, WIDTH,
                  0.5)  # slordig dubble WIDTH meegeven