Ide Treadle Pump
Source: examples/optimization/ide_treadle_pump.py
Introduction
Inspect the packaged IDE-style treadle pump 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
4
5
6def main() -> None:
7 """Print a seeded start and the solved design."""
8 problem = derp.get_problem("treadle_pump_ide_material_min")
9 initial = problem.generate_initial_solution(seed=1)
10 initial_components = problem.objective_components(initial)
11 initial_violation = problem.max_constraint_violation(initial)
12 result = problem.solve()
13 solved_components = problem.objective_components(result.x)
14 solved_violation = problem.max_constraint_violation(result.x)
15
16 print("IDE-style treadle pump packaged benchmark")
17 print(problem.metadata.title)
18 print(
19 "initial",
20 f"flow_lps={initial_components['flow_rate_lps']:.3f}",
21 f"lift_m={initial_components['lift_height_m']:.3f}",
22 f"material_m3={initial_components['material_volume_m3']:.6f}",
23 f"violation={initial_violation:.3g}",
24 )
25 print("solve", result.message)
26 print(
27 "solved",
28 f"flow_lps={solved_components['flow_rate_lps']:.3f}",
29 f"lift_m={solved_components['lift_height_m']:.3f}",
30 f"material_m3={solved_components['material_volume_m3']:.6f}",
31 f"violation={solved_violation:.3g}",
32 )
33
34
35if __name__ == "__main__":
36 main()
Expected Results
Run Command
PYTHONPATH=src python3 examples/optimization/ide_treadle_pump.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.