Skip to main content

pulpo package for optimization in LCI databases

Project description

โ—ฆ Python-based User-defined Lifecycle Production Optimization!

โ—ฆ Developed with the software and tools below.

Jupyter Python Markdown

GitHub license git-last-commit GitHub commit activity GitHub top language

๐Ÿ“– Table of Contents


๐Ÿ“ 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.

  1. Clone the pulpo repository:
git clone https://github.com/flechtenberg/pulpo
  1. Change to the project directory:
cd pulpo
  1. 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:

  1. Fork the project repository. This creates a copy of the project on your account that you can modify without affecting the original project.
  2. Clone the forked repository to your local machine using a Git client like Git or GitHub Desktop.
  3. Create a new branch with a descriptive name (e.g., new-feature-branch or bugfix-issue-123).
git checkout -b new-feature-branch
  1. Make changes to the project's codebase.
  2. 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.'
  1. Push your changes to your forked repository on GitHub using the following command
git push origin new-feature-branch
  1. 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


โ†‘ Return

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

pulpo-dev-0.0.1.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

pulpo_dev-0.0.1-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

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

Hashes for pulpo-dev-0.0.1.tar.gz
Algorithm Hash digest
SHA256 33725d74c24696600988b9b9d52b7bb43dfbad36efec3a66ab44c11827f387e2
MD5 fdb21cb3ac6596ffdddfd278bcd3e81b
BLAKE2b-256 dcc392320ae5d811a7efb192eb0c5f4acb6bb62d5916c746b3efc34d52f28c0e

See more details on using hashes here.

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

Hashes for pulpo_dev-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 271ee8921401df5a4611f5727a769e997d49ce8f727237ddc5508a340dd8526a
MD5 0d574f71f327db6cc08b7f589ca945c9
BLAKE2b-256 ae8fdc381b5e04a593217d28e71e1fb885d79b6bc8baa0d0ca5db6a5173cf272

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page