Skip to content

Instantly share code, notes, and snippets.

View amineremache's full-sized avatar

Amine Remache amineremache

View GitHub Profile
@amineremache
amineremache / bee.py
Last active January 9, 2019 13:51
The Q-localSearch implementation for Bee Swarm Optimization algorithm
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()
@amineremache
amineremache / bee.py
Last active January 9, 2019 13:50
The local search implementation for Bee Swarm Optimization algorithm
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
@amineremache
amineremache / swarm.py
Last active January 9, 2019 13:48
Bee Swarm Optimization for feature selection
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("********************************************************")