Small correction on particle.evaluate

This commit is contained in:
KuMiShi
2026-01-17 15:35:06 +01:00
parent 1dcd04cf85
commit 4fc51c0d7c
2 changed files with 6 additions and 15 deletions

View File

@@ -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

View File

@@ -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])