{ "info": { "author": "Nico Schl\u00f6mer", "author_email": "nico.schloemer@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Mathematics", "Topic :: Scientific/Engineering :: Physics" ], "description": "# optipy\n\n[![CircleCI](https://img.shields.io/circleci/project/github/nschloe/optipy/master.svg)](https://circleci.com/gh/nschloe/optipy)\n[![codecov](https://img.shields.io/codecov/c/github/nschloe/optipy.svg)](https://codecov.io/gh/nschloe/optipy)\n[![Codacy grade](https://img.shields.io/codacy/grade/2741eedd98a24ee0b65319c1f436f40e.svg)](https://app.codacy.com/app/nschloe/optipy/dashboard)\n[![PyPi Version](https://img.shields.io/pypi/v/optipy.svg)](https://pypi.org/project/optipy)\n[![GitHub stars](https://img.shields.io/github/stars/nschloe/optipy.svg?logo=github&label=Stars)](https://github.com/nschloe/optipy)\n\noptipy contains a generic optimization/minimization method. Its creation was\nmotivated by the absence of an implementation of Newton's method with a custom\nHessian solver in SciPy (see [this\nbug](https://github.com/scipy/scipy/issues/8756)).\n\n\nThe mandatory Rosenbrock example:\n```python\na = 1.0\nb = 100.0\n\ndef fun(x):\n return (a-x[0])**2 + b*(x[1] - x[0]**2)**2\n\ndef jac(x):\n return numpy.array([\n -2*(a-x[0]) - 4*b*(x[1] - x[0]**2) * x[0],\n 2*b*(x[1] - x[0]**2)\n ])\n\ndef hess_inv(x, grad):\n hess = numpy.array([\n [2 + 8*b*x[0]**2 - 4*b*(x[1] - x[0]**2), -4*b*x[0]],\n [-4*b*x[0], 2*b]\n ])\n return -numpy.linalg.solve(hess, grad)\n\nsol = optipy.minimize(\n fun=fun,\n x0=[-1.0, 3.5],\n jac=jac,\n get_search_direction=hess_inv,\n atol=1.0e-5\n )\n```\nThis is basically the exact Newton method. When setting `get_search_direction`\nto `lambda x, grad: -grad`, one gets the steepest descent method. For larger\ncomputations, one will typically replace this with a tailored solver, e.g., a\npreconditioned Krylov solver.\n\nThe return type is largely compatible with SciPy's generic return type,\n[OptmizeResult](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.OptimizeResult.html#scipy.optimize.OptimizeResult).\n\n\n### Installation\n\noptipy is [available from the Python Package\nIndex](https://pypi.org/project/optipy/), so simply do\n```\npip install -U optipy\n```\nto install or upgrade. Use `sudo -H` to install as root or the `--user` option\nof `pip` to install in `$HOME`.\n\n\n### Testing\n\nTo run the optipy unit tests, check out this repository and type\n```\npytest\n```\n\n### Distribution\nTo create a new release\n\n1. bump the `__version__` number,\n\n2. publish to PyPi and tag on GitHub:\n ```\n $ make publish\n ```\n\n### License\n\noptipy is published under the [MIT license](https://en.wikipedia.org/wiki/MIT_License).\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/nschloe/betterbib", "keywords": "", "license": "License :: OSI Approved :: MIT License", "maintainer": "", "maintainer_email": "", "name": "optipy", "package_url": "https://pypi.org/project/optipy/", "platform": "any", "project_url": "https://pypi.org/project/optipy/", "project_urls": { "Homepage": "https://github.com/nschloe/betterbib" }, "release_url": "https://pypi.org/project/optipy/0.1.0/", "requires_dist": [ "numpy", "scipy" ], "requires_python": "", "summary": "Numerical optimization/minimization", "version": "0.1.0" }, "last_serial": 3822500, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "375b444c4be299e3ff096eb7e8c2da98", "sha256": "fc669f7cb3b176235b3337b4d7e84b4173850f1f4fd72ccae419e2ada9bc5f2a" }, "downloads": -1, "filename": "optipy-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "375b444c4be299e3ff096eb7e8c2da98", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3880, "upload_time": "2018-04-30T23:37:16", "url": "https://files.pythonhosted.org/packages/69/fb/28b2d819cfe391bb4ec0a9068cadf3a7201291edb3af099f94e995970bcb/optipy-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f1d8678293eb62e9485c8def2eec5f0b", "sha256": "23dbc81822680868c473662d285df0df915036124c5e6d938a814927121e1e46" }, "downloads": -1, "filename": "optipy-0.1.0.tar.gz", "has_sig": false, "md5_digest": "f1d8678293eb62e9485c8def2eec5f0b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3907, "upload_time": "2018-04-30T23:37:17", "url": "https://files.pythonhosted.org/packages/45/32/c2ba66eefbb77681148edef8286570a9248a79bc5ad5c8883761b3b86b33/optipy-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "375b444c4be299e3ff096eb7e8c2da98", "sha256": "fc669f7cb3b176235b3337b4d7e84b4173850f1f4fd72ccae419e2ada9bc5f2a" }, "downloads": -1, "filename": "optipy-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "375b444c4be299e3ff096eb7e8c2da98", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3880, "upload_time": "2018-04-30T23:37:16", "url": "https://files.pythonhosted.org/packages/69/fb/28b2d819cfe391bb4ec0a9068cadf3a7201291edb3af099f94e995970bcb/optipy-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f1d8678293eb62e9485c8def2eec5f0b", "sha256": "23dbc81822680868c473662d285df0df915036124c5e6d938a814927121e1e46" }, "downloads": -1, "filename": "optipy-0.1.0.tar.gz", "has_sig": false, "md5_digest": "f1d8678293eb62e9485c8def2eec5f0b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3907, "upload_time": "2018-04-30T23:37:17", "url": "https://files.pythonhosted.org/packages/45/32/c2ba66eefbb77681148edef8286570a9248a79bc5ad5c8883761b3b86b33/optipy-0.1.0.tar.gz" } ] }