This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def ql_localSearch(self): | |
| for step in range(10): | |
| state = self.solution.copy() | |
| next_state, action, self.reward = self.data.ql.step(self.data,state) | |
| self.fitness = self.data.ql.get_q_value(self.data,state,action)[0] | |
| self.data.ql.learn(self.data,state,action,self.reward,next_state) | |
| self.solution = next_state.copy() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def localSearch(self): | |
| best=self.fitness | |
| #done=False | |
| lista=[j for j, n in enumerate(self.solution) if n == 1] | |
| indice =lista[0] | |
| for itr in range(self.locIterations): | |
| while(True): | |
| pos=-1 | |
| oldFitness=self.fitness |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def bso(self): | |
| i=0 | |
| while(i<self.maxIterations): | |
| #print("refSol is : ",self.refSolution.solution) | |
| #print(self.refSolution.solution) | |
| self.tabou.append(self.refSolution) | |
| #print("Iteration N° : ",i) | |
| self.searchArea() | |
| print("********************************************************") |