Stockpyl
========
![PyPI](https://img.shields.io/pypi/v/stockpyl)
[![Documentation Status](https://readthedocs.org/projects/stockpyl/badge/?version=latest)](https://stockpyl.readthedocs.io/en/latest/?badge=latest)
![Coverage](https://raw.githubusercontent.com/LarrySnyder/stockpyl/master/coverage_badge.svg)
![GitHub](https://img.shields.io/github/license/LarrySnyder/stockpyl)
![GitHub issues](https://img.shields.io/github/issues/LarrySnyder/stockpyl)
![Twitter Follow](https://img.shields.io/twitter/follow/LarrySnyder610?style=flat)
Stockpyl is a Python package for inventory optimization. It implements
classical single-node inventory models like the economic order quantity (EOQ), newsvendor,
and Wagner-Whitin problems. It also contains algorithms for multi-echelon inventory optimization
(MEIO) under both stochastic-service model (SSM) and guaranteed-service model (GSM) assumptions.
Most of the models and algorithms implemented in Stockpyl are discussed in the textbook
*Fundamentals of Supply Chain Theory* (*FoSCT*) by Snyder and Shen, Wiley, 2019, 2nd ed. Most of them
are much older; see *FoSCT* for references to original sources.
For a tutorial, see Snyder, L. V., "[Stockpyl: A Python Package for Inventory Optimization and Simulation](https://pubsonline.informs.org/doi/10.1287/educ.2023.0256)," in: Bish, E. K. and H. Balasubramanian, INFORMS TutORials in Operations Research, 156–197, 2023. The associated Jupyter notebooks are at [`notebooks/`](https://github.com/LarrySnyder/stockpyl/blob/c41103ca2055138f8f9844d29b3ab8ac67c847d5/notebooks).
For lots of details, [read the docs](http://stockpyl.readthedocs.io/).
Some Examples
-------------
Solve the newsvendor problem with a holding (overage) cost of 2, a stockout (underage) cost of 18, and
demands that are normally distributed with a mean of 120 and a standard deviation of 10:
```python
>>> from stockpyl.newsvendor import newsvendor_normal
>>> S, cost = newsvendor_normal(holding_cost=2, stockout_cost=18, demand_mean=120, demand_sd=10)
>>> S
132.815515655446
>>> cost
35.09966638649737
```
Use Chen and Zheng's (1994) algorithm (based on Clark and Scarf (1960)) to optimize a 3-node serial system under
the stochastic-service model (SSM):
```python
>>> from stockpyl.ssm_serial import optimize_base_stock_levels
>>> S_star, C_star = optimize_base_stock_levels(
... num_nodes=3,
... echelon_holding_cost=[4, 3, 1],
... lead_time=[1, 1, 2],
... stockout_cost=40,
... demand_mean=10,
... demand_standard_deviation=2
... )
>>> S_star
{1: 12.764978727246302, 2: 23.49686681508743, 3: 46.28013742779933}
>>> C_star
86.02533221942987
```
Simulate the same system using the optimal base-stock levels:
Optimize committed service times (CSTs) for a tree network under the guaranteed-service model (GSM)
using Graves and Willems' (2000) dynamic programming algorithm:
```python
>>> from stockpyl.gsm_tree import optimize_committed_service_times
>>> from stockpyl.instances import load_instance
>>> # Load a named instance, Example 6.5 from FoSCT.
>>> tree = load_instance("example_6_5")
>>> opt_cst, opt_cost = optimize_committed_service_times(tree)
>>> opt_cst
{1: 0, 3: 0, 2: 0, 4: 1}
>>> opt_cost
8.277916867529369
```
Resources
---------
* [PyPI](https://pypi.org/project/stockpyl/)
* [Documentation](http://stockpyl.readthedocs.io/)
* [Issue tracking](https://github.com/LarrySnyder/stockpyl/issues)
Feedback
--------
If you have feedback or encounter problems, please report them on the Stockpyl GitHub
[Issues Page](https://github.com/LarrySnyder/stockpyl/issues). (If you are not comfortable
using GitHub for this purpose, feel free to e-mail me. My contact info is on [my webpage](https://coral.ise.lehigh.edu/larry/).)
License
-------
Stockpyl is open-source and released under the [GPLv3 License](https://choosealicense.com/licenses/gpl-3.0/).
Citation
--------
If you'd like to cite the Stockpyl package, you can use the following BibTeX entry:
```bibtex
@misc{stockpyl,
title={Stockpyl},
author={Snyder, Lawrence V.},
year={2023},
url={https://github.com/LarrySnyder/stockpyl}
}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/LarrySnyder/stockpyl",
"name": "stockpyl",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "inventory, optimization",
"author": "Larry Snyder",
"author_email": "larry.snyder@lehigh.edu",
"download_url": "https://files.pythonhosted.org/packages/3d/e6/c257964cd944f411781e59b147d2189e3b6eeba7a6bd8a15fda52bada87b/stockpyl-1.0.1.tar.gz",
"platform": null,
"description": "Stockpyl\n========\n\n![PyPI](https://img.shields.io/pypi/v/stockpyl)\n[![Documentation Status](https://readthedocs.org/projects/stockpyl/badge/?version=latest)](https://stockpyl.readthedocs.io/en/latest/?badge=latest)\n![Coverage](https://raw.githubusercontent.com/LarrySnyder/stockpyl/master/coverage_badge.svg)\n![GitHub](https://img.shields.io/github/license/LarrySnyder/stockpyl)\n![GitHub issues](https://img.shields.io/github/issues/LarrySnyder/stockpyl)\n![Twitter Follow](https://img.shields.io/twitter/follow/LarrySnyder610?style=flat)\n\nStockpyl is a Python package for inventory optimization. It implements\nclassical single-node inventory models like the economic order quantity (EOQ), newsvendor,\nand Wagner-Whitin problems. It also contains algorithms for multi-echelon inventory optimization\n(MEIO) under both stochastic-service model (SSM) and guaranteed-service model (GSM) assumptions. \n\nMost of the models and algorithms implemented in Stockpyl are discussed in the textbook\n*Fundamentals of Supply Chain Theory* (*FoSCT*) by Snyder and Shen, Wiley, 2019, 2nd ed. Most of them\nare much older; see *FoSCT* for references to original sources. \n\nFor a tutorial, see Snyder, L. V., \"[Stockpyl: A Python Package for Inventory Optimization and Simulation](https://pubsonline.informs.org/doi/10.1287/educ.2023.0256),\" in: Bish, E. K. and H. Balasubramanian, INFORMS TutORials in Operations Research, 156\u2013197, 2023. The associated Jupyter notebooks are at [`notebooks/`](https://github.com/LarrySnyder/stockpyl/blob/c41103ca2055138f8f9844d29b3ab8ac67c847d5/notebooks).\n\nFor lots of details, [read the docs](http://stockpyl.readthedocs.io/).\n\nSome Examples\n-------------\n\nSolve the newsvendor problem with a holding (overage) cost of 2, a stockout (underage) cost of 18, and \ndemands that are normally distributed with a mean of 120 and a standard deviation of 10:\n\n```python\n>>> from stockpyl.newsvendor import newsvendor_normal\n>>> S, cost = newsvendor_normal(holding_cost=2, stockout_cost=18, demand_mean=120, demand_sd=10)\n>>> S\n132.815515655446\n>>> cost\n35.09966638649737\n```\n\nUse Chen and Zheng's (1994) algorithm (based on Clark and Scarf (1960)) to optimize a 3-node serial system under\nthe stochastic-service model (SSM):\n\n```python\n>>> from stockpyl.ssm_serial import optimize_base_stock_levels\n>>> S_star, C_star = optimize_base_stock_levels(\n... num_nodes=3,\n... echelon_holding_cost=[4, 3, 1],\n... lead_time=[1, 1, 2],\n... stockout_cost=40,\n... demand_mean=10,\n... demand_standard_deviation=2\n... )\n>>> S_star\n{1: 12.764978727246302, 2: 23.49686681508743, 3: 46.28013742779933}\n>>> C_star\n86.02533221942987\n```\n\nSimulate the same system using the optimal base-stock levels:\n\n\n\nOptimize committed service times (CSTs) for a tree network under the guaranteed-service model (GSM) \nusing Graves and Willems' (2000) dynamic programming algorithm:\n\n```python\n>>> from stockpyl.gsm_tree import optimize_committed_service_times\n>>> from stockpyl.instances import load_instance\n>>> # Load a named instance, Example 6.5 from FoSCT.\n>>> tree = load_instance(\"example_6_5\")\n>>> opt_cst, opt_cost = optimize_committed_service_times(tree)\n>>> opt_cst\n{1: 0, 3: 0, 2: 0, 4: 1}\n>>> opt_cost\n8.277916867529369\n```\n\n\n\nResources\n---------\n\n* [PyPI](https://pypi.org/project/stockpyl/)\n* [Documentation](http://stockpyl.readthedocs.io/)\n* [Issue tracking](https://github.com/LarrySnyder/stockpyl/issues)\n\nFeedback\n--------\n\nIf you have feedback or encounter problems, please report them on the Stockpyl GitHub\n[Issues Page](https://github.com/LarrySnyder/stockpyl/issues). (If you are not comfortable\nusing GitHub for this purpose, feel free to e-mail me. My contact info is on [my webpage](https://coral.ise.lehigh.edu/larry/).)\n\nLicense\n-------\n\nStockpyl is open-source and released under the [GPLv3 License](https://choosealicense.com/licenses/gpl-3.0/).\n\nCitation\n--------\n\nIf you'd like to cite the Stockpyl package, you can use the following BibTeX entry:\n\n```bibtex\n@misc{stockpyl,\n title={Stockpyl},\n author={Snyder, Lawrence V.},\n year={2023},\n url={https://github.com/LarrySnyder/stockpyl}\n}\n```\n\n",
"bugtrack_url": null,
"license": "GNU General Public License v3 (GPLv3)",
"summary": "A Python package for inventory optimization and simulation",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/LarrySnyder/stockpyl"
},
"split_keywords": [
"inventory",
" optimization"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "44c55dd264599cdacd60d44c631000ecded91f42d45e8ca42cd39b76c328562a",
"md5": "3b56f275529aebb856f7abfcb3d03512",
"sha256": "293b95f0a5c992d1a7f0007e7f2948042a3a409d9b5b935a86065dca7f58461c"
},
"downloads": -1,
"filename": "stockpyl-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3b56f275529aebb856f7abfcb3d03512",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 188545,
"upload_time": "2024-11-01T17:48:47",
"upload_time_iso_8601": "2024-11-01T17:48:47.838423Z",
"url": "https://files.pythonhosted.org/packages/44/c5/5dd264599cdacd60d44c631000ecded91f42d45e8ca42cd39b76c328562a/stockpyl-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3de6c257964cd944f411781e59b147d2189e3b6eeba7a6bd8a15fda52bada87b",
"md5": "cd8290878f1a6a8b6452bd3f86e417c7",
"sha256": "74f35d328a5deb55abd756ba0e97ac11e117809037bc7a87c5dd1aa3e9aba8e0"
},
"downloads": -1,
"filename": "stockpyl-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "cd8290878f1a6a8b6452bd3f86e417c7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 261411,
"upload_time": "2024-11-01T17:48:49",
"upload_time_iso_8601": "2024-11-01T17:48:49.537581Z",
"url": "https://files.pythonhosted.org/packages/3d/e6/c257964cd944f411781e59b147d2189e3b6eeba7a6bd8a15fda52bada87b/stockpyl-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-01 17:48:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "LarrySnyder",
"github_project": "stockpyl",
"travis_ci": false,
"coveralls": true,
"github_actions": false,
"requirements": [
{
"name": "build",
"specs": [
[
"==",
"0.0.2"
]
]
},
{
"name": "jsonpickle",
"specs": [
[
"==",
"1.5.0"
]
]
},
{
"name": "matplotlib",
"specs": [
[
"==",
"2.0"
]
]
},
{
"name": "networkx",
"specs": [
[
"==",
"2.0"
]
]
},
{
"name": "numpy",
"specs": [
[
"==",
"1.23.5"
]
]
},
{
"name": "scipy",
"specs": [
[
"==",
"1.10.0"
]
]
},
{
"name": "setuptools",
"specs": [
[
"==",
"70.0"
]
]
},
{
"name": "sphinx",
"specs": [
[
"==",
"4.5.0"
]
]
},
{
"name": "sphinx_rtd_theme",
"specs": [
[
"==",
"1.0.0"
]
]
},
{
"name": "sphinx_toolbox",
"specs": [
[
"==",
"3.1.2"
]
]
},
{
"name": "tabulate",
"specs": [
[
"==",
"0.8.7"
]
]
},
{
"name": "tqdm",
"specs": [
[
"==",
"4.1.0"
]
]
}
],
"lcname": "stockpyl"
}