Main Modifications

This commit is contained in:
KuMiShi
2026-01-18 12:27:51 +01:00
parent 05298908e5
commit 698d1ff7dd
7 changed files with 93 additions and 18 deletions

View File

@@ -3,7 +3,7 @@ from .particle import Particle
import copy
class MOPSO():
def __init__(self, f_weights:list, A_max:float, price_mean:float, price_std:float, capacities:list, n:int, t:int, w:float, c1:float, c2:float, archive_size:int=10, nb_vehicles:int=10, delta_t:int=60, nb_of_ticks:int=72, x_min=-100, x_max=100, v_alpha=0.1, surrogate=False):
def __init__(self, A_max:float, price_mean:float, price_std:float, capacities:list, n:int, t:int, w:float, c1:float, c2:float, archive_size:int=10, nb_vehicles:int=10, delta_t:int=60, nb_of_ticks:int=72, x_min=-100, x_max=100, v_alpha=0.1, surrogate=False):
# Constants
self.n = n # Number of particles
self.t = t # Number of simulation iterations
@@ -11,7 +11,6 @@ class MOPSO():
self.c1 = c1 # Individual trust
self.c2 = c2 # Social trust
self.archive_size = archive_size # Archive size
self.f_weights = f_weights # Weigths for aggregation of all function objective
self.surrogate = surrogate # Using AI calculation
@@ -71,7 +70,7 @@ class MOPSO():
# Checking for best positions
# Generation of arriving and leaving times for every vehicle
def generate_times(self, nb_vehicles, nb_of_ticks, delta_t):
def generate_times(self, nb_vehicles, nb_of_ticks):
times = []
for _ in range(nb_vehicles):
# Minumun, we have one tick of charging/discharging during simulation