# YAPSS: Yet Another Pseudo-Spectral Solver
YAPSS is a Python package for numerically solving optimal control problems using
pseudospectral methods. Features include:
- Computational approach based on the GPOPS-II algorithm of
[Patterson and Rao (2014)](https://dl.acm.org/doi/pdf/10.1145/2558904)
- Support for multiple differentiation methods: automatic differentiation via the CasADi
package, user-defined derivatives, and central difference numerical differentiation for
problems not amenable to automatic differentiation.
- Choice of collocation method, including Legendre-Gauss (LG), Legendre-Gauss-Radau (LGR),
and Legendre-Gauss-Lobatto (LGL) options.
- Segmented mesh support, enabling mesh refinement in specific regions. (Automatic mesh
refinement is not yet available.)
- An API for defining optimal control problems designed to catch common errors
and provide helpful messages.
- Documentation covering installation, setup, and example usage.
- Examples available as both Python scripts and Jupyter notebooks.
## Quickstart
To get started, install YAPSS and verify the installation using pip:
```console
$ python -m venv yapss-env
$ source yapss-env/bin/activate
(yapss-env) $ pip install yapss
(yapss-env) $ python -m yapss.examples.isoperimetric
```
If the console output shows a small relative error and a Matplotlib window displays
a circle, the installation is successful!
For more detailed installation instructions, see the next section.
## Installation
YAPSS supports installation via Conda or pip. It requires Python 3.9 or later..
### Option 1: Using Conda
Create and activate a virtual environment, and install YAPSS:
```console
$ conda create -n yapss-env python=3.9
$ conda activate yapss-env
(yapss-env) $ conda install -c conda-forge yapss
```
If you encounter the following error during installation
```text
PackagesNotFoundError: The following packages are not available from current channels:
- yapss
```
then YAPSS is not yet available on conda-forge. In this case, install from source as follows:
```console
(yapss-env) $ conda install -c conda-forge numpy casadi scipy mpmath matplotlib cyipopt -y
(yapss-env) $ pip install git+https://github.com/stevenrhall/yapss.git@v0.1.0 --no-deps
```
The ``--no-deps`` flag is important — it prevents pip from reinstalling dependencies that
Conda has already installed, avoiding conflicts. You can delete the tag ``@v0.1.0`` to
install the latest version, or specify a different version tag.
### Option 2: Using Pip
Create and activate a virtual environment, then install YAPSS:
```console
$ python -m venv yapss-env
$ source yapss-env/bin/activate
(yapss-env) $ pip install yapss
```
To install from source:
```console
(yapss-env) $ pip install git+https://github.com/stevenrhall/yapss.git@v0.1.0
```
### Verify the Installation
To verify the installation, run the isoperimetric example:
```console
(yapss-env) $ python -m yapss.examples.isoperimetric
```
The result should be a matplotlib window with a plot of the optimal curve (a circle), and
console output that concludes with something similar to
```text
Maximum area = 0.07957747154594766 (Should be 1 / (4 pi) = 0.07957747154594767)
Relative error in solution = 1.743934249004316e-16
```
If the plot does not display, add `%matplotlib inline` in a Jupyter notebook or set the
backend with `matplotlib.use('Agg')` for headless environments.
The console output may differ slightly depending on machine precision. Minor deviations in
the final digits are normal, and the relative error should be on the order of machine
precision. If it is, the installation is correct.
Additional examples are available in
- the examples/notebooks directory
- the src/yapss/examples directory
- the Examples section of the documentation.
## License
YAPSS is licensed under the MIT License. See the LICENSE file for more information.
## Documentation
The [documentation](https://yapss.readthedocs.io/) is available on Read the Docs.
## Contributing
YAPSS is open source — contributions are not only welcome but encouraged. See
[CONTRIBUTING.md](https://github.com/stevenrhall/yapss/blob/main/CONTRIBUTING.md) for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "yapss",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "\"Steven R. Hall\" <steve@steven-hall.net>",
"keywords": "optimal control, optimization, pseudospectral methods",
"author": null,
"author_email": "\"Steven R. Hall\" <steve@steven-hall.net>",
"download_url": "https://files.pythonhosted.org/packages/6c/84/9c48284f4c63c571c709f1139aba2d723b9b6d04a6b0fbe3995c99264a49/yapss-0.1.0.tar.gz",
"platform": null,
"description": "# YAPSS: Yet Another Pseudo-Spectral Solver\n\nYAPSS is a Python package for numerically solving optimal control problems using\npseudospectral methods. Features include:\n\n- Computational approach based on the GPOPS-II algorithm of\n [Patterson and Rao (2014)](https://dl.acm.org/doi/pdf/10.1145/2558904)\n- Support for multiple differentiation methods: automatic differentiation via the CasADi\n package, user-defined derivatives, and central difference numerical differentiation for\n problems not amenable to automatic differentiation.\n- Choice of collocation method, including Legendre-Gauss (LG), Legendre-Gauss-Radau (LGR),\n and Legendre-Gauss-Lobatto (LGL) options.\n- Segmented mesh support, enabling mesh refinement in specific regions. (Automatic mesh\n refinement is not yet available.)\n- An API for defining optimal control problems designed to catch common errors\n and provide helpful messages.\n- Documentation covering installation, setup, and example usage.\n- Examples available as both Python scripts and Jupyter notebooks.\n\n## Quickstart\n\nTo get started, install YAPSS and verify the installation using pip:\n\n```console\n$ python -m venv yapss-env\n$ source yapss-env/bin/activate\n(yapss-env) $ pip install yapss\n(yapss-env) $ python -m yapss.examples.isoperimetric\n```\n\nIf the console output shows a small relative error and a Matplotlib window displays \na circle, the installation is successful!\n\nFor more detailed installation instructions, see the next section.\n\n## Installation\n\nYAPSS supports installation via Conda or pip. It requires Python 3.9 or later..\n\n### Option 1: Using Conda\n\nCreate and activate a virtual environment, and install YAPSS:\n\n```console\n$ conda create -n yapss-env python=3.9\n$ conda activate yapss-env\n(yapss-env) $ conda install -c conda-forge yapss\n```\n\nIf you encounter the following error during installation\n\n```text\nPackagesNotFoundError: The following packages are not available from current channels:\n - yapss\n```\n\nthen YAPSS is not yet available on conda-forge. In this case, install from source as follows:\n\n```console\n(yapss-env) $ conda install -c conda-forge numpy casadi scipy mpmath matplotlib cyipopt -y\n(yapss-env) $ pip install git+https://github.com/stevenrhall/yapss.git@v0.1.0 --no-deps\n```\n\nThe ``--no-deps`` flag is important \u2014 it prevents pip from reinstalling dependencies that\nConda has already installed, avoiding conflicts. You can delete the tag ``@v0.1.0`` to\ninstall the latest version, or specify a different version tag.\n\n### Option 2: Using Pip\n\nCreate and activate a virtual environment, then install YAPSS:\n\n```console\n$ python -m venv yapss-env\n$ source yapss-env/bin/activate\n(yapss-env) $ pip install yapss\n```\n\nTo install from source:\n\n```console\n(yapss-env) $ pip install git+https://github.com/stevenrhall/yapss.git@v0.1.0\n```\n\n### Verify the Installation\n\nTo verify the installation, run the isoperimetric example:\n\n```console\n(yapss-env) $ python -m yapss.examples.isoperimetric\n```\n\nThe result should be a matplotlib window with a plot of the optimal curve (a circle), and\nconsole output that concludes with something similar to\n\n```text\nMaximum area = 0.07957747154594766 (Should be 1 / (4 pi) = 0.07957747154594767)\nRelative error in solution = 1.743934249004316e-16\n```\n\nIf the plot does not display, add `%matplotlib inline` in a Jupyter notebook or set the \nbackend with `matplotlib.use('Agg')` for headless environments.\n\nThe console output may differ slightly depending on machine precision. Minor deviations in\nthe final digits are normal, and the relative error should be on the order of machine\nprecision. If it is, the installation is correct.\n\nAdditional examples are available in \n\n- the examples/notebooks directory\n- the src/yapss/examples directory\n- the Examples section of the documentation.\n\n## License\n\nYAPSS is licensed under the MIT License. See the LICENSE file for more information.\n\n## Documentation\n\nThe [documentation](https://yapss.readthedocs.io/) is available on Read the Docs.\n\n## Contributing\n\nYAPSS is open source \u2014 contributions are not only welcome but encouraged. See\n[CONTRIBUTING.md](https://github.com/stevenrhall/yapss/blob/main/CONTRIBUTING.md) for details.\n\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python package for solving optimal control problems using pseudospectral methods.",
"version": "0.1.0",
"project_urls": {
"Changelog": "https://github.com/stevenrhall/yapss/blob/main/CHANGELOG.md",
"Documentation": "https://yapss.readthedocs.io/",
"Issues": "https://github.com/stevenrhall/yapss/issues",
"Repository": "https://github.com/stevenrhall/yapss.git"
},
"split_keywords": [
"optimal control",
" optimization",
" pseudospectral methods"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ebab9c70d8c8757ff0f317754f182b34053ee655343332686a911263afa51cab",
"md5": "b3459accff016698d5b4671105758f46",
"sha256": "485c90d7b16cacbee9b024c650ecca52a8c05fbc1a198f6b6708e5220c4410ca"
},
"downloads": -1,
"filename": "yapss-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b3459accff016698d5b4671105758f46",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 99487,
"upload_time": "2024-12-29T03:47:16",
"upload_time_iso_8601": "2024-12-29T03:47:16.183715Z",
"url": "https://files.pythonhosted.org/packages/eb/ab/9c70d8c8757ff0f317754f182b34053ee655343332686a911263afa51cab/yapss-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6c849c48284f4c63c571c709f1139aba2d723b9b6d04a6b0fbe3995c99264a49",
"md5": "a27b8165e15cc73afc88e99025ba97f9",
"sha256": "ef084862f31dddd2c16e53ff60014768a64fb9e7266d75af5477dd3f1f44e405"
},
"downloads": -1,
"filename": "yapss-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "a27b8165e15cc73afc88e99025ba97f9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 7795614,
"upload_time": "2024-12-29T03:47:19",
"upload_time_iso_8601": "2024-12-29T03:47:19.135054Z",
"url": "https://files.pythonhosted.org/packages/6c/84/9c48284f4c63c571c709f1139aba2d723b9b6d04a6b0fbe3995c99264a49/yapss-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-29 03:47:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "stevenrhall",
"github_project": "yapss",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "yapss"
}