Metadata-Version: 2.4
Name: pysolver_view
Version: 0.8.2
Summary: Python package for nonlinear equation solving and constrained optimization, with convergence monitoring and numerical diagnostics.
License: MIT
License-File: LICENSE.md
Author: Roberto Agromayor
Requires-Python: >=3.10,<3.14
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Provides-Extra: jax
Provides-Extra: pounce
Provides-Extra: thermodynamics
Requires-Dist: CoolProp (>=6.6,<8) ; extra == "thermodynamics"
Requires-Dist: PyYAML (>=6.0.2,<7.0.0)
Requires-Dist: cycler (>=0.12.1,<0.13.0)
Requires-Dist: jax (>=0.5.3,<0.6.0) ; extra == "jax"
Requires-Dist: matplotlib (>=3.10.1,<4.0.0)
Requires-Dist: numpy (>=2.2.4,<3.0.0)
Requires-Dist: openpyxl (>=3.1.5,<4.0.0)
Requires-Dist: pandas (>=2.2.3,<3.0.0)
Requires-Dist: pounce-solver (==0.13.0) ; extra == "pounce"
Requires-Dist: scipy (==1.17.1) ; python_version >= "3.11" and python_version < "3.14"
Requires-Dist: scipy (>=1.15.2,<2.0.0) ; python_version == "3.10"
Requires-Dist: toml (>=0.10.2,<0.11.0)
Project-URL: Documentation, https://turbo-sim.github.io/pysolver_view/
Project-URL: Repository, https://github.com/turbo-sim/pysolver_view
Description-Content-Type: text/markdown


# PySolverView

Python package for nonlinear equation solving and constrained optimization, with convergence monitoring and numerical diagnostics.

## Features

- Print and visualize convergence history
- Print final optimization reports at a chosen width, preserving full names:
  `solver.print_optimization_report(width=120)` (default 80 characters).
- Streamlined problem definition (object-oriented)
- Improved function and gradient evaluation to avoid unnecesary model evaluations
- Controlled Levenberg-Marquardt, Powell hybrid, Newton-Raphson, and Gauss-Newton
  through `NonlinearSystemSolver(library="pysolver")`; native SciPy remains the default

The [root solver guide](docs/development/root_solvers.md)
explains options, scaling, callbacks, and result accounting. Run the single
[four-solver demo](demos/demo_eqn_solving/demo_custom_root_solvers.py) to compare
accepted convergence histories. Benchmark suites and timing studies remain under
[development studies](docs/development/README.md).

Custom roots enable Jacobian-based numerical scaling by default; disable it
with `options={"jacobian_scaling": False}`. User-defined physical step scales
and limits retain their meaning. The
[radiative heat demo](demos/demo_eqn_solving/README.md) compares controlled and
large-step runs on a 1000-variable collocation problem.

## Documentation

Install the checkout before running tests or demos; the package lives under
`src/pysolver_view/`:

```bash
python -m pip install -e .
# Optional physical benchmark models:
python -m pip install -e '.[thermodynamics]'
# Optional Pounce interior-point and active-set SQP NLP solvers:
python -m pip install -e '.[pounce]'
```

Install development dependencies with `poetry install --with dev --extras jax`. Add the
`thermodynamics` extra to run the optional CoolProp model checks as well.
Custom SLSQP requires SciPy 1.17.1, which is selected automatically on Python
3.11 and newer. Python 3.10 retains its existing SciPy dependency range for
native methods and custom roots; the full test suite needs Python 3.11 or newer.

Pounce 0.13.0 is pinned in the optional `pounce` extra. Install it with
`poetry install --extras pounce`, then select
`OptimizationSolver(problem, library="pounce", method="ipm")` or `method="sqp"`.
The backend uses the same combined problem and derivative contracts as SLSQP.
Problems defining `hessians(x)` also enable exact Lagrangian Hessians, with
optional shared sparsity from `hessian_sparsity()`. Physical coordinate scaling,
component ordering and evaluation counts are handled by the adapter. See the
[Hessian contract](docs/source/tutorial_optimization.md#exact-component-hessians).
Pounce does not expose the custom SLSQP first-step fraction controls.
For sufficient user-KKT termination, pass `extra_options={"stop_on_kkt": True,
"feasibility_tol": 1e-6, "optimality_tol": 1e-4}`. A native exit also ends the
solve; the actual returned point is verified before reporting success. See the
[Pounce controls and bound handling](docs/source/tutorial_optimization.md#pounce-interior-point-and-active-set-sqp).
The [native and wrapper comparisons](development/pounce_solvers/README.md) reproduce a
24-variable constrained NLP study with independent feasibility and KKT audits.

```bash
poetry run python tests/run_tests.py
# Run just one of the configured suites:
poetry run python tests/run_tests.py --suite package
poetry run python tests/run_tests.py --suite studies
poetry run python docs/build_docs.py --no-autobuild
```

Documentation is authored in Markdown under `docs/source/`; the builder generates
the API reference and writes HTML to `docs/_build/html/`. Omit `--no-autobuild`
for a live preview. See the [documentation build guide](docs/README.md) for
the source structure, authoring conventions, and additional build options.

Control test paths and default pytest options in
[`tests/run_tests.py`](tests/run_tests.py). By default it runs the complete
`tests/` tree, including study checks and Pounce exact-Hessian contracts. Legacy
numerical-Hessian helper validation remains excluded from the agreed migration
scope. Both existing CI test jobs call this same script.

The [source-layout migration guide](docs/source/source_layout.md) documents
canonical imports, compatibility exports, optional dependencies and the explicit
JAX configuration API. The package name, distribution name and version remain unchanged.

Please refer to the [`documentation`](https://turbo-sim.github.io/pysolver_view/index.html) for:
- Installation instructions
- Tutorials showing how to use the code
- Complete documentation of all functions and classes in PySolverView


## Version bumping

Version bumps use `bump-my-version`, configured in
[.bumpversion.toml](.bumpversion.toml). Install the development tools with
`poetry install --with dev`, then commit your work before bumping:

```bash
# Preview the next patch version without modifying files.
poetry run bump-my-version bump --dry-run --verbose patch

# Choose one increment: patch, minor, or major.
poetry run bump-my-version bump patch

# Push the version commit and release tag from main.
git push origin main --follow-tags
```

The tool updates `pyproject.toml`, `src/pysolver_view/__init__.py`,
and its own current-version setting. `docs/conf.py` reads the package version
automatically. It creates a version commit and an annotated `vX.Y.Z` tag;
pushing the tag triggers the release workflow.
A real bump requires a clean working tree.

## Other info
- Pygmo and pygmo-plugin-nonfree should be installed with Conda

<!-- research-software-metadata:start -->
## Development and citation

Roberto Agromayor is the main developer of PySolverView.

Citation metadata is provided in [CITATION.cff](CITATION.cff). For version-specific reproducibility, also record the release or commit used.
<!-- research-software-metadata:end -->

