pulpo package for optimization in LCI databases
Project description
โฆ Python-based User-defined Lifecycle Production Optimization!
โฆ Developed with the software and tools below.
๐ Table of Contents
- ๐ Overview
- ๐ Repository Structure
- โ๏ธ Modules
- ๐ Getting Started
- ๐ฃ Roadmap
- ๐ค Contributing
- ๐ License
- ๐ Acknowledgments
๐ Overview
The project, "pulpo," is a life cycle assessment (LCA) optimization tool that aims to import, optimize, solve, retrieve, save, and summarize LCA results. It provides functionalities for data import from the Ecoinvent database, conversion of inputs into a dictionary for the optimization model, definition and solving of the optimization model using the pyomo package, and saving and summarizing of the model results. The tool's value lies in streamlining LCA processes, enabling optimization and analysis of environmental impacts, and facilitating the decision-making process for sustainable solutions.
๐ Repository Structure
โโโ pulpo/
โโโ .gitattributes
โโโ .gitconfig
โโโ .gitignore
โโโ desktop.ini
โโโ LICENSE
โโโ notebooks/
โ โโโ hydrogen_showcase.ipynb
โโโ pulpo/
โ โโโ __init__.py
โ โโโ pulpo.py
โ โโโ utils/
โโโ README.md
โโโ setup.cfg
โโโ tests/
โโโ __init__.py
โโโ test_functions.py
โ๏ธ Modules
Root
File | Summary |
---|---|
.gitconfig | This code fragment configures a git filter to clean Jupyter Notebook files in the.gitconfig file. It uses the Jupyter nbconvert command to remove the output cells and smudge to display the file's contents. |
pulpo.py | The code implements a PulpoOptimizer class that provides functionalities for data import, optimization, solving, retrieval, saving and summarizing results related to life cycle assessments. It uses modules like optimizer, bw_parser, converter, and saver for different operations. |
bw_parser.py | The code in bw_parser.py provides functions for importing, saving, and retrieving life cycle inventory (LCI) data from the Ecoinvent database using the Brightway2 library. It includes functions for importing data, checking if data needs to be reloaded, performing LCA calculations, saving LCI data to files, and reading LCI data from files. Additionally, it provides functions for retrieving activities and environmental flows from the database based on specified criteria. The main function demonstrates the usage of these functions. |
converter.py | The code in pulpo\utils\converter.py combines various inputs into a dictionary for an optimization model. It converts sparse matrices to dictionaries, modifies the technosphere matrix, creates sets, specifies demand, limits, and supply, assigns weights, and assembles the final data dictionary for the model. This function serves as a crucial step in preparing the inputs for the optimization process. |
optimizer.py | The code defines an optimization model using the pyomo package. It includes sets, parameters, variables, constraints, and an objective function. The model is created and solved using different solvers. |
saver.py | The code provides two main functionalities:1. save_results: Saves the results of a Pyomo model to an Excel file, including raw results, metadata, and constraints.2. summarize_results: Prints a summary of the model results, including demand, impacts, choices, and constraints. |
๐ Getting Started
๐ง Installation
Soon PULPO will be installable via
pip install pulpo
But for the time being, please get the repo by cloning. It is highly recommended to create a new and separate conda environment for PULPO. The requirements.txt comes from the current stable release and will be updated with each release. A long-term task is to reduce the requirements.txt to a minimum, stating only the important packages.
- Clone the pulpo repository:
git clone https://github.com/flechtenberg/pulpo
- Change to the project directory:
cd pulpo
- Install the dependencies:
pip install -r requirements.txt
๐ค Running pulpo
Find example notebooks for a hydrogen case and an electricity case here.
๐งช Tests
Calling from the package folder:
python -m unittest discover -s tests
๐ฃ Roadmap
- [ ]
โน๏ธ Task 1: Implement integer cuts to allow a fast calculation of a ranked list of best options
- [ ]
โน๏ธ Task 2: Implement functionality to treat uncertainty in the optimization problem (robust)
- [ ]
โน๏ธ ... Requests are welcome.
๐ค Contributing
Contributions are always welcome! Please follow these steps:
- Fork the project repository. This creates a copy of the project on your account that you can modify without affecting the original project.
- Clone the forked repository to your local machine using a Git client like Git or GitHub Desktop.
- Create a new branch with a descriptive name (e.g.,
new-feature-branch
orbugfix-issue-123
).
git checkout -b new-feature-branch
- Make changes to the project's codebase.
- Commit your changes to your local branch with a clear commit message that explains the changes you've made.
git commit -m 'Implemented new feature.'
- Push your changes to your forked repository on GitHub using the following command
git push origin new-feature-branch
- Create a new pull request to the original project repository. In the pull request, describe the changes you've made and why they're necessary. The project maintainers will review your changes and provide feedback or merge them into the main branch.
๐ License
This project is licensed under the โน๏ธ BSD 3-Clause
License. See the LICENSE file for additional info.
Copyright (c) 2023, Fabian Lechtenberg. All rights reserved.
๐ Acknowledgments
We would like to acknowledge the authors and contributors of these main packages that pulpo is based on:
Authors
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pulpo-dev-0.0.1.tar.gz
.
File metadata
- Download URL: pulpo-dev-0.0.1.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33725d74c24696600988b9b9d52b7bb43dfbad36efec3a66ab44c11827f387e2 |
|
MD5 | fdb21cb3ac6596ffdddfd278bcd3e81b |
|
BLAKE2b-256 | dcc392320ae5d811a7efb192eb0c5f4acb6bb62d5916c746b3efc34d52f28c0e |
File details
Details for the file pulpo_dev-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: pulpo_dev-0.0.1-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 271ee8921401df5a4611f5727a769e997d49ce8f727237ddc5508a340dd8526a |
|
MD5 | 0d574f71f327db6cc08b7f589ca945c9 |
|
BLAKE2b-256 | ae8fdc381b5e04a593217d28e71e1fb885d79b6bc8baa0d0ca5db6a5173cf272 |