randomize execution
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
import random
|
||||
from concurrent.futures import ProcessPoolExecutor, as_completed
|
||||
from dataclasses import dataclass
|
||||
|
||||
@@ -87,7 +88,8 @@ def run_simulation(n_servers=2, lam=40):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with ProcessPoolExecutor(max_workers=os.cpu_count()) as executor:
|
||||
max_workers = max((os.cpu_count() or 0) - 1, 1)
|
||||
with ProcessPoolExecutor(max_workers=max_workers) as executor:
|
||||
n_servers = [n + 1 for n in range(10)]
|
||||
lam = [(n + 1) * 4 for n in range(10)]
|
||||
parameter_values = [
|
||||
@@ -98,7 +100,7 @@ if __name__ == "__main__":
|
||||
]
|
||||
futures = [
|
||||
executor.submit(run_simulation, **parameters)
|
||||
for parameters in parameter_values
|
||||
for parameters in random.sample(parameter_values, len(parameter_values))
|
||||
]
|
||||
|
||||
results = []
|
||||
|
||||
Reference in New Issue
Block a user