plend
Plend is a library for performing least cost formulation with Python. Plend uses PuLP to solve formula constraint problems.
Installation
$ pip install git+https://github.com/bherbruck/plend
or
$ pip install plend
Examples
from plend import Formula, Ingredient, Nutrient
from plend.presets.poultry import *
# initialize formula
starter = Formula(name='Starter', batch_size=100)
# add ingredient constraints from poultry presets
starter.add_ingredient(corn, minimum=1)
starter.add_ingredient(soybean_meal)
starter.add_ingredient(oil, maximum=5)
starter.add_ingredient(limestone)
starter.add_ingredient(meat_meal, maximum=10)
# add nutrient constraints from poultry presets
starter.add_nutrient(energy, minimum=3000)
starter.add_nutrient(protein, minimum=20)
starter.add_nutrient(fiber)
starter.add_nutrient(calcium, minimum=4, maximum=5)
# optimize the formula
starter.optimize()
# output the formula to a csv
print(starter.to_csv())
outputs:
| library_name | formula_name | formula_code | formula_cost | formula_status | item_type | item_name | item_code | item_amount | item_minimum | item_maximum |
|---|---|---|---|---|---|---|---|---|---|---|
| default | Starter | 67.16379819 | Optimal | ingredient | Corn | 54.882934 | 1 | |||
| default | Starter | 67.16379819 | Optimal | ingredient | Soybean Meal | 22.674542 | 0 | |||
| default | Starter | 67.16379819 | Optimal | ingredient | Oil | 4.1552541 | 0 | 5 | ||
| default | Starter | 67.16379819 | Optimal | ingredient | Limestone | 8.2872701 | 0 | |||
| default | Starter | 67.16379819 | Optimal | ingredient | Meat Meal | 10.0 | 0 | 10 | ||
| default | Starter | 67.16379819 | Optimal | nutrient | Energy | 3000.0000038 | 3000 | |||
| default | Starter | 67.16379819 | Optimal | nutrient | Protein | 20.00000021 | 20 | |||
| default | Starter | 67.16379819 | Optimal | nutrient | Fiber | 2.05230961 | 0 | |||
| default | Starter | 67.16379819 | Optimal | nutrient | Calcium | 4.0000000154 | 4 | 5 |
Metadata
Release files for plend 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| plend-0.1.4.tar.gz | 7.9 kB | Without provenance | Details for plend-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| plend-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for plend-0.1.4-py3-none-any.whl |
Total release size: 16.3 kB
Release files / plend-0.1.4.tar.gz
| Download URL | plend-0.1.4.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a8189b435918c129908ed7ea17868bb01011f68662be9654da75394d8c534410
|
|
BLAKE2b-256 checksum How to use checksums |
a850674e04a2215eb3525918e9a339995c0cfbf08d11388942ed2444548d4969
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3
|
Release files / plend-0.1.4-py3-none-any.whl
| Download URL | plend-0.1.4-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
628052e8af4599b0abb86347a02a96c8c972634a2d7c619110a0868070c9815f
|
|
BLAKE2b-256 checksum How to use checksums |
272a77b5a4a6c4e5bcdf2a89a574de1c22f3dd55023cdb127d376e145b613ba5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3
|
Security for plend 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.