Battery Fast Charge Dfn Anchor Opt#
Source: examples/optimization/battery_fast_charge_dfn_anchor_opt.py
Introduction#
Inspect the fast-charge DFN anchor battery 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 "charge_time_min",
8 "max_plating_mol_m3",
9 "max_temperature_c",
10 "energy_density_wh_per_l",
11 "success",
12)
13
14
15def main() -> None:
16 problem = derp.get_problem("battery_fast_charge_dfn_anchor_opt")
17 initial = problem.generate_initial_solution()
18 try:
19 components = problem.objective_components(initial)
20 result = problem.solve(maxiter=0)
21 except MissingOptionalDependencyError as exc:
22 print(exc)
23 return
24 print(problem.metadata.problem_id)
25 print("solver-role", problem.metadata.benchmark_card.solver_role)
26 print("metric-keys", ",".join(sorted(components)))
27 print("initial", " ".join(f"{key}={components[key]:.6g}" for key in COMMON_KEYS))
28 print("solve", result.message)
29
30
31if __name__ == "__main__":
32 main()
Expected Results#
Run Command
PYTHONPATH=src python3 examples/optimization/battery_fast_charge_dfn_anchor_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.