Skip to content

Commit

Permalink
Merge pull request #166 from LarrySnyder/multiproduct
Browse files Browse the repository at this point in the history
Multiproduct
  • Loading branch information
LarrySnyder authored May 14, 2024
2 parents 07f135d + ec0cfa6 commit 2f2b0ab
Show file tree
Hide file tree
Showing 124 changed files with 15,176 additions and 35,160 deletions.
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version: 2
build:
os: ubuntu-20.04
tools:
python: "3.7"
python: "3.8"
# You can also specify other tool versions:
# nodejs: "16"
# rust: "1.55"
Expand Down
38 changes: 36 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,43 @@ All significant changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [1.0.0] -- 2024-05-13

### Introducing: Products
- |sp| now supports *products* in simulations. Products are implemented using the |class_product|
object.
- Products are "handled" by nodes. Most attributes (``stockout_cost``,
``inventory_policy``, etc.) may be specified either at the node level, the product
level, or the (node, product) level.
- Products are related to each other via a bill of materials (BOM), which specifies
the number of units of an upstream product (*raw material*) that are required to make
one unit of a downstream product (*finished goods*).
- For more information about creating and managing products, and simulating multi-product systems in |sp|, see the [supply_chain_product](https://stockpyl.readthedocs.io/en/multiproduct/api/datatypes/supply_chain_product.html module) or
see the [tutorial page for multi-product simulation](tutorial_multiproduct_sim_page).

(none so far)
### Added
- ``helpers.nearest_dict_value()`` function, to find key in a dictionary that's nearest to
a given number and return the corresponding value.
- ``loss_functions.standard_normal_loss_dict()`` function, to build a dictionary of loss-function values.
- Support for negative binomial demand distributions in ``DemandSource``.
- Functions to validate and parse nodes and products within a network or node. (Mostly used internally for simulation.)

### Changed
- Requires Python 3.8 or later.
- ``NodeStateVars.raw_material_inventory`` is now indexed by product, not by predecessor.
- ``NodeStateVars`` object is now in its own module, ``node_state_vars.py``, rather than in ``supply_chain_node.py``.
- ``supply_chain_network.network_from_edges()`` now only creates a ``DemandSource`` for sink nodes or if the
demand source parameters were provided specifically for that node in the input args.
- More compact text representation of ``SupplyChainNetwork`` and ``SupplyChainNode`` objects via ``__repr__()``.

### Fixed
- Bug in ``helpers.ensure_list_for_time_period()`` that caused it to handle numpy arrays improperly.
- Bug in ``demand_source.py`` that sometimes caused infinite recursion when some attributes were ``None``.
- Bug in ``sim_io.py`` that caused incorrect headers for a few state variables.

### Known Issues
- Echelon base-stock policies are not working reliably yet, at least for systems with multiple products. [#153](https://github.com/LarrySnyder/stockpyl/issues/153)
- Disruptions can only occur at node level, not product level. [#158](https://github.com/LarrySnyder/stockpyl/issues/158)

## [0.0.15] -- 2024-02-10

Expand Down
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/_build/doctrees/index.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/_build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: dcb8f591e3f2a6b0305969518a9bbbfa
config: 4e5bdc43b90f67f553e8e6fd3e958334
tags: 645f666f9bcd5a90fca523b33c5a78b7
6 changes: 3 additions & 3 deletions docs/_build/html/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ Chen-Zheng's (1994) reworking of it):
>>> # Optimize echelon base-stock levels.
>>> S_star, C_star = optimize_base_stock_levels(network=network)
>>> print(f"Optimal echelon base-stock levels = {S_star}")
Optimal echelon base-stock levels = {3: 44.1689463285519, 2: 34.93248526934437, 1: 25.69602421013684}
Optimal echelon base-stock levels = {3: 44.11999999999999, 2: 34.879999999999995, 1: 25.727999999999994}
>>> print(f"Optimal expected cost per period = {C_star}")
Optimal expected cost per period = 227.15328525645054
Optimal expected cost per period = 227.14074094530974

Stockpyl has extensive features for simulating multi-echelon inventory systems. Below, we simulate
the same serial system, obtaining an average cost per period that is similar to what the theoretical
Expand All @@ -125,7 +125,7 @@ model predicted above.
>>> T = 1000
>>> total_cost = simulation(network=network, num_periods=T, rand_seed=42)
>>> print(f"Average total cost per period = {total_cost/T}")
Average total cost per period = 226.16794575837224
Average total cost per period = 226.19159620574135


Stockpyl also implements Graves and Willems' (2000) dynamic programming algorithm for optimizing
Expand Down
2 changes: 1 addition & 1 deletion docs/_build/html/_static/documentation_options.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '0.1',
VERSION: '1.0',
LANGUAGE: 'en',
COLLAPSE_INDEX: false,
BUILDER: 'html',
Expand Down
Loading

0 comments on commit 2f2b0ab

Please sign in to comment.