Examples and Validation¶
This chapter lists runnable entry points that exercise the three method families.
All example scripts live in the examples/ directory at the repository root
(except the benchmark runners, which live in benchmarks/).
Recommended Example Sequence¶
examples/Rosenbrock.py— SDP hierarchy on a classic benchmark.examples/GPExample.py— geometric relaxation flow via GP.examples/SONCExample.pyandexamples/SONCExample33.py— SONC circuit-polynomial relaxations.
API Quick Reference¶
Script |
Primary classes |
Solver dependency |
|---|---|---|
|
|
CVXPY/CLARABEL (default) or CVXOPT |
|
|
GP solver backend |
|
|
GP solver backend |
|
|
GP solver backend |
SDP Example¶
Run from the repository root with the virtual environment activated:
source .venv/bin/activate
python examples/Rosenbrock.py
Expected behavior:
Initializes an
SDPRelaxationsobject with semigroup-algebra expressions.Solves an SDP lower-bound problem via the selected solver (CLARABEL by default).
Prints solver summary, objective values, and timing information.
Geometric Programming Example¶
Run:
python examples/GPExample.py
Expected behavior:
Builds an
OptimizationProblemfrom semigroup-algebra expressions.Constructs a
GPRelaxationsmodel with transformation matrix \(H\).Prints transformation matrix information and GP solution details.
SONC Examples¶
Run:
python examples/SONCExample.py
python examples/SONCExample33.py
Expected behavior:
Builds constrained SONC models from semigroup-algebra expressions.
Prints a certified lower bound when the solver succeeds.
Reports runtime and solver status if GP solving is unavailable in the current environment.
Example 3.3 Traceability¶
The script examples/SONCExample33.py is aligned with the Section 3.3 benchmark
used in the repository and is paired with checks in tests/test_sonc_section3.py.
Benchmark Gallery System¶
Irene includes a gallery-based benchmark runner for systematic comparison across relaxation families:
benchmarks/gallery.yaml— YAML configuration defining problem sets, parameters, and solver options.benchmarks/run_gallery.py— Entry point that loads the gallery config and runs all configured benchmarks.
Run:
python benchmarks/run_gallery.py
This exercises SDP, GP, SONC, and SOSONC relaxations on a curated set of problems
and writes structured results to benchmarks/results/.
Backend Comparison Benchmark¶
The cross-backend benchmark (SymEngine vs SymPy) has been archived to
benchmarks/archive/ since the rewrite branch was merged into master.
The gallery runner remains the primary benchmark entry point:
python benchmarks/run_gallery.py
Additional Examples¶
The following scripts exercise mean polynomial forms, separating polynomials, and other specialized relaxation techniques:
examples/pqforms.py— Power-mean form certificates for nonnegativity.examples/SOSONCSchickSeparating.py— Schick’s SOS+SONC separating example.examples/Rosenbrock.py,examples/Giunta.py,examples/Parsopoulos.py— Classic benchmark problems.examples/McCormick.py— McCormick relaxation on non-convex objective.
Regression Validation¶
Run the test suite from the repository root with the virtual environment activated:
source .venv/bin/activate
python -m pytest Irene/tests/ tests/ -q
This is the recommended consistency check after modifying optimization modules or documentation examples. Individual test files can be run separately, e.g.:
python -m pytest tests/test_sosonc.py -v