This commit is contained in:
martin 2024-01-25 20:52:27 +01:00
parent 3195a4e955
commit 144fbdf574
4 changed files with 18 additions and 5 deletions

View File

@ -1,2 +1,2 @@
*
*.txt
!.gitignore

2
chl/data/computation/log/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

2
chl/data/computation/pulp/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

View File

@ -5,6 +5,10 @@ PROJECT_PATH = '/home/md/Work/ligalytics/leagues_stable/'
# PROJECT_PATH = '/home/django/leagues/'
import os, sys
import json
from numpyencoder import NumpyEncoder
sys.path.insert(0, PROJECT_PATH)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "leagues.settings")
os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"] = "true"
@ -1029,11 +1033,9 @@ class Draw_Simulator:
blockings, breaks = self.create_schedule(sol_dict, n)
tmp_stats[n] = {
'conflicts': conflicts,
'infeasible': infeasible,
@ -1046,6 +1048,10 @@ class Draw_Simulator:
'blockings':blockings,
'breaks':breaks,
}
with open(f'json/{self.opponent_func.__name__}_{n}.json', 'w') as f:
json.dump(tmp_stats, f, cls=NumpyEncoder)
nInfeasible = sum(s['infeasible'] for s in tmp_stats.values()) > 0
nComputation = sum(s['total_computations'] for s in tmp_stats.values())
@ -1127,6 +1133,9 @@ class Draw_Simulator:
'breaks':breaks,
}
return stats