Case Study: Nonlinear Systems (SNE Benchmarks)¶
PySNE ships with a curated suite of Systems of Nonlinear Equations (SNE) benchmarks in
pysne.problems.benchmarks_sne. Each problem is a standard test case from the root-finding
literature, defined with a known search space and a target number of solutions
(expected_roots), which makes them ideal for validating that the solver recovers all
roots — not just one.
Every problem here subclasses SNEProblem, so the objective is driven by an explicit set of
equations \(F(\mathbf{x}) = 0\) and solutions are filtered by residual tolerance
(\(1 - f(\mathbf{x}) < \epsilon\)) before duplicate roots are merged by clustering.
The three-phase pipeline
All SNE benchmarks are solved by the same pipeline — Iterative Clustering → SPO → Selection. See Algorithms for the full method.
Running the suite¶
Each problem is retrieved from a registry, instantiated, and passed to solve_system together
with its recommended parameters.
from pysne.problems.benchmarks_sne import get_problem_set
from pysne.solver import solve_system
# 1. Load the registry of benchmark problems (IDs 1–7)
problems = get_problem_set()
# 2. Instantiate a single problem, e.g. Problem 1
problem = problems[1]()
# 3. Pull its domain and tuned parameters
domain, params = problem.get_info()
expected = params["expected_roots"]
# 4. Solve for ALL roots inside the domain
result = solve_system(problem, params, verbose=True)
roots = result["roots"] # numpy array of solution vectors
clusters = result["clusters"] # candidate regions detected by clustering
print(f"{problem.name}")
print(f"Expected roots : {expected}")
print(f"Roots found : {len(roots)}")
To sweep every problem in one pass:
from pysne.problems.benchmarks_sne import get_problem_set
from pysne.solver import solve_system
for pid, factory in get_problem_set().items():
problem = factory()
_, params = problem.get_info()
result = solve_system(problem, params, verbose=False)
print(f"Problem {pid}: found {len(result['roots'])} / {params['expected_roots']} roots")
Reproducing the results
The solver prints each root together with its residual \(1 - f(\mathbf{x})\) when
verbose=True. Because these are stochastic global searches, the exact coordinates are
produced at runtime; the benchmark target is the count in the Expected roots column
below.
Benchmark roster¶
| ID | System | Vars | Search space | Expected roots |
|---|---|---|---|---|
| 1 | Exponential–trigonometric system | 2 | \([-10, 10]^2\) | 6 |
| 2 | Sine–exponential coupled system | 2 | \([-1, 3] \times [-17, 4]\) | 12 |
| 3 | Coupled exponential system | 6 | \([-5, 5]^6\) | 2 |
| 4 | Structural (thin-walled beam) system | 3 | \([-40, 40]^3\) | 6 |
| 5 | Symmetric linear + product constraint | 5 | \([-10, 10]^5\) | 3 |
| 6 | Combustion / unit-circle system | 8 | \([-1, 1]^8\) | 16 |
| 7 | Truncated Weierstrass equation | 1 | \([0, 5.05]\) | 9 |
Problem 1 — Exponential–trigonometric system¶
A classic two-variable system that mixes exponential and trigonometric terms, producing several well-separated roots across a wide domain.
- Search space: \(x_1, x_2 \in [-10, 10]\)
- Expected roots: 6
Problem 2 — Sine–exponential coupled system¶
A stiff coupled system over an asymmetric domain; the exponential term makes the residual landscape steep, so it is tuned with a larger cluster budget.
- Search space: \(x_1 \in [-1, 3]\), \(x_2 \in [-17, 4]\)
- Expected roots: 12
Problem 3 — Coupled exponential system (6D)¶
A six-dimensional system where variables are chained through products and exponentials, leaving only two valid roots inside the box.
- Search space: \(x_i \in [-5, 5]\) for \(i = 1, \dots, 6\)
- Expected roots: 2
Problem 4 — Structural (thin-walled beam) system¶
An engineering-flavoured system derived from cross-sectional area, moment-of-inertia, and torsion relations of a thin-walled beam.
- Search space: \(x_i \in [-40, 40]\) for \(i = 1, 2, 3\)
- Expected roots: 6
Problem 5 — Symmetric linear system + product constraint (5D)¶
Four near-symmetric linear equations coupled to a single nonlinear product constraint. The symmetry yields exactly three distinct real solutions.
- Search space: \(x_i \in [-10, 10]\) for \(i = 1, \dots, 5\)
- Expected roots: 3
Problem 6 — Combustion / unit-circle system (8D)¶
The most demanding case in the suite: an eight-variable system combining bilinear reaction terms with four unit-circle constraints, admitting sixteen roots.
- Search space: \(x_i \in [-1, 1]\) for \(i = 1, \dots, 8\)
- Expected roots: 16
Problem 7 — Truncated Weierstrass equation (1D)¶
A single-variable equation built from a truncated Weierstrass series (\(s = 1.1\), \(\lambda = 1.5\), \(N = 20\)). Although one-dimensional, its highly oscillatory nature packs nine roots into a short interval.
- Search space: \(x \in [0, 5.05]\)
- Expected roots: 9
Method & validation¶
For every problem above, PySNE follows the same procedure:
- Define the equations and the bounded search space via
get_info(). - Cluster the domain into candidate basins using iterative clustering.
- Optimise locally inside each cluster with SPO to drive residuals toward zero.
- Select valid roots by the residual criterion \(1 - F(\mathbf{x}) < \epsilon\) and merge duplicates within distance \(\delta\).
A run is considered successful when the number of recovered roots matches expected_roots
(PySNE's integration tests accept ≥ 80% recovery as a pass while tuning).