Exemplo n.º 1
0
# Options
for o, a in opts:
	if o == "-n":
		iterations = int(a)
	elif o == "-Q":
		q = float(a)
	elif o == "-a":
		aX = float(a)
	elif o == "-v":
		verbose = True
	else:
		printUsage()
		sys.exit(2)

# Running Ant System Heuristic
antSys = AntSystem(jsspFile, Q=q, antX=aX)

antSys.runCompleteTour(iterations)

if verbose:
	print "--- TRAIL MATRIX ---"
	antSys.printTrailMatrix()
	print "\nGreedy: ", antSys.greedy
	print "\n--- FINAL SOLUTIONS ---"
	for i in range(len(antSys.antScheds)):
		print antSys.antScheds[i].makespan, antSys.antScheds[i].jobSched
	print "\nBest solution built:"
	print antSys.bestSchedule.makespan, antSys.bestSchedule.jobSched
else:
	print antSys.bestSchedule.makespan, antSys.bestSchedule.jobSched