Initial Commit

This commit is contained in:
KuMiShi
2026-01-12 18:46:32 +01:00
commit 83cf163939
6 changed files with 118 additions and 0 deletions

38
mopso.py Normal file
View File

@@ -0,0 +1,38 @@
from .particle import Particle
class MOPSO():
def __init__(self, n, t, w, c1, c2, a_max, surrogate=False):
# Constants
self.n = n # Number of particles
self.t = t # Number of iterations
self.w = w # Inertia (for exploration)
self.c1 = c1 # Individual trust
self.c2 = c2 # Social trust
self.a_max = a_max # Archive size
self.surrogate = surrogate # Using AI calculation
self.particles = [] # Particles of the simulation
# Fonctions objectifs
# Limites variables de decision
def iterate(self):
nb_iter = 0
if not self.surrogate:
while nb_iter < self.t:
nb_iter += 1
# Selection of a leader
# Updating velocity and positions
# Checking boundaries
# Evaluating particles
# Update the archive
# Checking for best positions
else:
while nb_iter < self.t:
nb_iter += 1
# Selection of a leader
# Updating velocity and positions
# Checking boundaries
# Evaluating particles
# Update the archive
# Checking for best positions