def Run(self): if self.sysconfig == None: QMessageBox.critical(self, "An error occurred", "System configuration must be defined") return Module.conf = self.sysconfig if self.constraints == None: QMessageBox.critical(self, "An error occurred", "Constraints must be defined") return System.constraints = self.constraints if self.algconfig == None and self.ui.algorithm.currentIndex() < 2: QMessageBox.critical(self, "An error occurred", "Algorithm configuration must be defined") return Algorithm.algconf = self.algconfig if Algorithm.algconf == None: Algorithm.algconf = AlgConfig() algidx = self.ui.algorithm.currentIndex() if algidx == 0: algorithm = GA() elif algidx == 1: algorithm = HGA() elif algidx == 2: algorithm = GA_optimistic() elif algidx == 3: algorithm = GA_optimistic_left() elif algidx == 4: algorithm = GA_Moore() elif algidx == 5: algorithm = HGA_Moore() Algorithm.result_filename = self.ui.result_filename.text() for i in range(self.ui.execNum.value()): if algorithm.algconf.metamodel: algorithm.algconf.metamodel.Clear() algorithm.Run() self.best = algorithm.currentSolution algorithm.PrintStats() try: os.remove("sch" + str(os.getpid()) + ".xml") os.remove("res" + str(os.getpid()) + ".xml") except: pass