Battery 18650 T3a Topology Surrogate Opt#
Source: examples/optimization/battery_18650_t3a_topology_surrogate_opt.py
Introduction#
Inspect the T3A topology surrogate battery optimization benchmark.
Technical Implementation#
This page is generated from the top-of-file module docstring and the example source code. The full script is included below for direct inspection.
1from __future__ import annotations
2
3import design_research_problems as derp
4from design_research_problems import MissingOptionalDependencyError
5
6COMMON_KEYS = (
7 "cell_count",
8 "connection_count",
9 "cost_usd",
10 "design_volume_mm3",
11 "max_temperature_c",
12 "voltage_v",
13 "capacity_ah",
14 "current_limit_a",
15 "min_clearance_mm",
16)
17
18
19def main() -> None:
20 try:
21 problem = derp.get_problem("battery_18650_t3a_topology_surrogate_opt")
22 initial = problem.generate_initial_solution(seed=3)
23 surrogate_components = problem.objective_components(initial)
24 surrogate_provenance = problem.evaluation_provenance(initial)
25 explicit_problem = type(problem)(
26 metadata=problem.metadata,
27 statement_markdown=problem.statement_markdown,
28 resource_bundle=problem.resource_bundle,
29 requirements=problem.requirements,
30 max_cell_count=problem.max_cell_count,
31 minimum_spacing_mm=problem.minimum_spacing_mm,
32 objective_weights=problem.objective_weights,
33 cooling_coefficient_w_per_m2k=problem.cooling_coefficient_w_per_m2k,
34 passive_cooling_w_per_k=problem.passive_cooling_w_per_k,
35 ambient_temperature_c=problem.ambient_temperature_c,
36 maximum_temperature_c=problem.maximum_temperature_c,
37 load_current_a=problem.load_current_a,
38 backend_config=problem.backend_config,
39 evaluation_mode="explicit_circuit",
40 imbalance_model=problem.imbalance_model.value,
41 )
42 explicit_components = explicit_problem.objective_components(initial)
43 explicit_provenance = explicit_problem.evaluation_provenance(initial)
44 print(problem.metadata.problem_id)
45 print("surrogate-mode", surrogate_provenance.evaluation_mode)
46 print("explicit-mode", explicit_provenance.evaluation_mode)
47 print("surrogate", " ".join(f"{key}={surrogate_components[key]:.3f}" for key in COMMON_KEYS))
48 print("explicit", " ".join(f"{key}={explicit_components[key]:.3f}" for key in COMMON_KEYS))
49 except MissingOptionalDependencyError as exc:
50 print(exc)
51
52
53if __name__ == "__main__":
54 main()
Expected Results#
Run Command
PYTHONPATH=src python3 examples/optimization/battery_18650_t3a_topology_surrogate_opt.py
Run the command shown below from repository root. Output should summarize the problem setup, a baseline solution, or diagnostic values relevant to this example.