def testRunCompleteTour(self): # Testing the presentation istance #antSys = AntSystem("../jssp_instances/transparencia.txt") antSys = AntSystem("../jssp_instances/Car5.txt") #antSys = AntSystem("../jssp_instances/abz5.txt", roh = 0.9) antSys.runCompleteTour(100) print "final solutions" for i in range(len(antSys.antScheds)): print "i: ", antSys.antScheds[i].makespan, antSys.antScheds[i].jobSched print "\nBest solution" print antSys.bestSchedule.makespan, antSys.bestSchedule.jobSched return
# 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