Pill Problem

Source: examples/optimization/pill_problem.py

Introduction

Inspect a feasible seeded start and solve the pill optimization problem.

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 vector and the SciPy SLSQP baseline solution."""
 8    problem = derp.get_problem("pill_capsule_min_area")
 9    initial = problem.generate_initial_solution(seed=7)
10    print(initial.shape)
11    result = problem.solve(seed=3)
12    print(result.message)
13    print(bool(result.success), round(float(result.fun), 8))
14
15
16if __name__ == "__main__":
17    main()

Expected Results

Run Command

PYTHONPATH=src python3 examples/optimization/pill_problem.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.