forked from KuMiShi/Optim_Metaheuristique
Small correction on particle.evaluate
This commit is contained in:
2
mopso.py
2
mopso.py
@@ -44,7 +44,7 @@ class MOPSO():
|
||||
self.particles[i].updating_socs(self.socs, self.capacities)
|
||||
|
||||
# Evaluating particles
|
||||
self.particles[i].evaluate(self.f_weights, self.prices, self.socs, self.socs_req, self.times)
|
||||
self.particles[i].evaluate(self.prices, self.socs, self.socs_req, self.times)
|
||||
self.particles[i].update_best()
|
||||
|
||||
# Update the archive
|
||||
|
||||
19
particle.py
19
particle.py
@@ -95,21 +95,12 @@ class Particle():
|
||||
f3 = self.f3()
|
||||
|
||||
# Keeping in memory evaluation of each objective for domination evaluation
|
||||
memory = []
|
||||
memory.append(f1)
|
||||
memory.append(f2)
|
||||
memory.append(f3)
|
||||
f_current = []
|
||||
f_current.append(f1)
|
||||
f_current.append(f2)
|
||||
f_current.append(f3)
|
||||
|
||||
# Global weigthed evaluation of the position
|
||||
f = (f1 * f_weights[0]) + (f2 * f_weights[1]) + (f3 * f_weights[2])
|
||||
|
||||
# Best position check
|
||||
if f < self.eval:
|
||||
self.p_best = self.x
|
||||
|
||||
# Updating the previous evaluation
|
||||
self.f_memory = memory
|
||||
self.f_current = f
|
||||
self.f_current = f_current
|
||||
|
||||
def update_best(self):
|
||||
current_better = (self.f_current[0] >= self.f_best[0]) and (self.f_current[1] >= self.f_best[1]) and (self.f_current[2] >= self.f_best[2])
|
||||
|
||||
Reference in New Issue
Block a user