d0fus 2.7.1__tar.gz → 2.7.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {d0fus-2.7.1 → d0fus-2.7.2}/D0FUS_EXE/D0FUS_genetic.py +21 -5
  2. {d0fus-2.7.1 → d0fus-2.7.2}/PKG-INFO +1 -1
  3. {d0fus-2.7.1 → d0fus-2.7.2}/d0fus.egg-info/PKG-INFO +1 -1
  4. {d0fus-2.7.1 → d0fus-2.7.2}/pyproject.toml +1 -1
  5. {d0fus-2.7.1 → d0fus-2.7.2}/D0FUS.py +0 -0
  6. {d0fus-2.7.1 → d0fus-2.7.2}/D0FUS_BIB/D0FUS_cost_data.py +0 -0
  7. {d0fus-2.7.1 → d0fus-2.7.2}/D0FUS_BIB/D0FUS_cost_functions.py +0 -0
  8. {d0fus-2.7.1 → d0fus-2.7.2}/D0FUS_BIB/D0FUS_figures.py +0 -0
  9. {d0fus-2.7.1 → d0fus-2.7.2}/D0FUS_BIB/D0FUS_import.py +0 -0
  10. {d0fus-2.7.1 → d0fus-2.7.2}/D0FUS_BIB/D0FUS_machine_presets.py +0 -0
  11. {d0fus-2.7.1 → d0fus-2.7.2}/D0FUS_BIB/D0FUS_parameterization.py +0 -0
  12. {d0fus-2.7.1 → d0fus-2.7.2}/D0FUS_BIB/D0FUS_physical_functions.py +0 -0
  13. {d0fus-2.7.1 → d0fus-2.7.2}/D0FUS_BIB/D0FUS_radial_build_functions.py +0 -0
  14. {d0fus-2.7.1 → d0fus-2.7.2}/D0FUS_EXE/D0FUS_popcon.py +0 -0
  15. {d0fus-2.7.1 → d0fus-2.7.2}/D0FUS_EXE/D0FUS_run.py +0 -0
  16. {d0fus-2.7.1 → d0fus-2.7.2}/D0FUS_EXE/D0FUS_scan.py +0 -0
  17. {d0fus-2.7.1 → d0fus-2.7.2}/D0FUS_EXE/D0FUS_uncertainty.py +0 -0
  18. {d0fus-2.7.1 → d0fus-2.7.2}/LICENSE +0 -0
  19. {d0fus-2.7.1 → d0fus-2.7.2}/README.md +0 -0
  20. {d0fus-2.7.1 → d0fus-2.7.2}/d0fus.egg-info/SOURCES.txt +0 -0
  21. {d0fus-2.7.1 → d0fus-2.7.2}/d0fus.egg-info/dependency_links.txt +0 -0
  22. {d0fus-2.7.1 → d0fus-2.7.2}/d0fus.egg-info/entry_points.txt +0 -0
  23. {d0fus-2.7.1 → d0fus-2.7.2}/d0fus.egg-info/requires.txt +0 -0
  24. {d0fus-2.7.1 → d0fus-2.7.2}/d0fus.egg-info/top_level.txt +0 -0
  25. {d0fus-2.7.1 → d0fus-2.7.2}/setup.cfg +0 -0
@@ -1433,17 +1433,31 @@ def run_genetic_algorithm(pop_size, n_generations, cxpb, mutpb,
1433
1433
  pop = toolbox.population(n=pop_size)
1434
1434
  hof = tools.HallOfFame(10)
1435
1435
 
1436
- # Statistics
1436
+ # Statistics.
1437
+ # Fitness values fall into three regimes: feasible designs carry the
1438
+ # objective value, infeasible ones are mapped into the band
1439
+ # [floor, PENALTY_VALUE) by compute_feasibility_fitness, and structurally
1440
+ # invalid ones return PENALTY_VALUE. Population statistics must describe
1441
+ # feasible designs only, so the cut is the band floor, not
1442
+ # PENALTY_VALUE / 2. The floor is deck-overridable, so it is resolved here
1443
+ # exactly as in evaluate_individual.
1444
+ _floor_stats = _opt_float(static_inputs.get('infeasible_floor'))
1445
+ if _floor_stats is None:
1446
+ _floor_stats = DEFAULT_INFEASIBLE_FLOOR
1447
+
1448
+ def _feasible(values):
1449
+ return [v[0] for v in values if v[0] < _floor_stats]
1450
+
1437
1451
  def safe_mean(values):
1438
- valid = [v[0] for v in values if v[0] < PENALTY_VALUE / 2]
1452
+ valid = _feasible(values)
1439
1453
  return np.mean(valid) if valid else float('nan')
1440
1454
 
1441
1455
  def safe_std(values):
1442
- valid = [v[0] for v in values if v[0] < PENALTY_VALUE / 2]
1456
+ valid = _feasible(values)
1443
1457
  return np.std(valid) if len(valid) > 1 else float('nan')
1444
1458
 
1445
1459
  def count_valid(values):
1446
- return sum(1 for v in values if v[0] < PENALTY_VALUE / 2)
1460
+ return len(_feasible(values))
1447
1461
 
1448
1462
  stats = tools.Statistics(lambda ind: ind.fitness.values)
1449
1463
  stats.register("min", lambda x: min(v[0] for v in x))
@@ -1498,7 +1512,9 @@ def run_genetic_algorithm(pop_size, n_generations, cxpb, mutpb,
1498
1512
  _append_to_cloud(ind, 0)
1499
1513
 
1500
1514
  # ── Diagnostic: abort early if entire initial population is invalid ───
1501
- n_init_valid = sum(1 for f in fitnesses if f[0] < PENALTY_VALUE / 2)
1515
+ # Same feasibility cut as the population statistics above: a design sitting
1516
+ # in the infeasible band is not a valid starting point.
1517
+ n_init_valid = sum(1 for f in fitnesses if f[0] < _floor_stats)
1502
1518
  if n_init_valid == 0:
1503
1519
  print(f"\n *** WARNING: 0 / {pop_size} initial designs are valid! ***")
1504
1520
  print(f" The parameter ranges likely produce unphysical configurations")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: d0fus
3
- Version: 2.7.1
3
+ Version: 2.7.2
4
4
  Summary: Design 0-dimensional for Fusion Systems - Tokamak power plant design and optimization tool
5
5
  Author-email: Timothé Auclair <timothe.auclair@gmail.com>
6
6
  Maintainer-email: Timothé Auclair <timothe.auclair@gmail.com>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: d0fus
3
- Version: 2.7.1
3
+ Version: 2.7.2
4
4
  Summary: Design 0-dimensional for Fusion Systems - Tokamak power plant design and optimization tool
5
5
  Author-email: Timothé Auclair <timothe.auclair@gmail.com>
6
6
  Maintainer-email: Timothé Auclair <timothe.auclair@gmail.com>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "d0fus"
7
- version = "2.7.1"
7
+ version = "2.7.2"
8
8
  description = "Design 0-dimensional for Fusion Systems - Tokamak power plant design and optimization tool"
9
9
  readme = "README.md"
10
10
  license = {text = "CeCILL-C"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes