Skip to main content

Python-based User-defined Lifecycle Production Optimization

Jupyter Python Markdown

License Last Commit Commit Activity

PyPI - Version GitHub Stars


📍 Overview

PULPO is a Python package for Life Cycle Optimization (LCO) based on life cycle inventories. It is designed to serve as a platform for optimization tasks of varying complexity.

The package builds on top of the Brightway LCA framework and the Pyomo optimization modeling framework.


✨ Capabilities

Applying optimization is recommended when the system of study has (1) many degrees of freedom that would otherwise prompt the manual assessment of a large number of scenarios, or (2) any of the following capabilities is relevant to the goal and scope of the study:

  • Specify technology and regional choices throughout the entire supply chain (fore- and background), such as the production technology of electricity or the origin of metal resources. Consistently accounting for background changes in large-scale decisions can be significant.
  • Specify constraints on any activity in the life cycle inventories, interpreted as tangible limitations such as raw material availability, production capacity, or environmental regulations.
  • Optimize for or constrain any impact category for which characterization factors are available.
  • Specify supply values instead of final demands, which is relevant when only production volumes are known (e.g. here).
  • Optimize under uncertainty: import the declared distributions of the inventory and characterization factors, compute the impact's mean and variance in closed form, and solve chance-constrained programs (jointly over the impact and uncertain capacities) to obtain the Pareto front over reliability levels. Decompose the variance exactly, screen the parameters that declare no uncertainty, and validate every solution out of sample. As of now, uncertainty in the LCA data is considered only in the biosphere flows and the characterization factors; technosphere exchanges are treated as deterministic.
  • Solve in reduced space with solve(formulation='reduced'): the same LP over the choice alternatives only, exact and much smaller on large databases.

Features recently completed:

  • ℹ️ Optimization under uncertainty [chance-constraints, Monte Carlo]
  • ℹ️ Time-dependent optimization [time-indexed formulation with inter-timestep storage/carry-over]
  • ℹ️ Development of a GUI for simple optimization tasks Link
  • ℹ️ Enable PULPO to work on both bw2 and bw25 projects
  • ℹ️ Thorough documentation hosted on flechtenberg.github.io/pulpo/
  • ℹ️ Goal-programming objective (average transgression of soft impact limits)
  • ℹ️ Exact chance-constrained optimization (second-order cone, joint risk budgets, exact bound quantiles)
  • ℹ️ Numerical scaling of the LP for unaggregated ecoinvent backgrounds
  • ℹ️ Reduced-space solves, and an exact, validated uncertainty method

Features currently under development:

  • ℹ️ Integration of economic and social indicators in the optimization problem formulation

Feature requests are more than welcome!


🔧 Installation

PULPO is available on PyPI. Depending on the version of Brightway you want to work with, install either the bw2 or bw25 variant:

pip install "pulpo-dev[bw2]"

or

pip install "pulpo-dev[bw25]"

🍎 macOS and Linux on ARM

The PARDISO solver is not available on these platforms. For fast reduced solves, install scikit-umfpack from conda-forge before PULPO:

conda install -c conda-forge scikit-umfpack
pip install "pulpo-dev[bw25]"

Without it, PULPO falls back to SciPy's solver: same results, but much slower on large databases. See the installation guide.

The uncertainty features need no extra packages; the uncertainty extra is kept as an empty alias, so pip install "pulpo-dev[bw25,uncertainty]" still works. To run the example notebooks, add the notebooks extra (JupyterLab, matplotlib, seaborn): pip install "pulpo-dev[bw25,notebooks]".

🤖 Running PULPO

PULPO is organized into three optimizer classes, one per module, each covering a different use case with its own reference notebook:

  • pulpo.pulpo.PulpoOptimizer — the core LCO framework: technology/region choices, constraints, single- and multi-objective optimization (including goal programming), and supply-driven optimization. Start with the PULPO showcase notebook, a complete walkthrough built around a methanol production case.
  • pulpo.pulpo_time.PulpoOptimizerTime — the time-indexed extension: per-timestep demands and limits, impact budgets aggregated across the horizon, and inter-timestep storage/carry-over. See the time-dependent toy notebook for hourly and daily battery-dispatch examples.
  • pulpo.pulpo_unc.PulpoOptimizerUnc — the uncertainty extension (a thin layer over pulpo.utils.uncertainty): import declared distributions, add expert knowledge, and solve chance-constrained programs in reduced space. See the uncertainty toy notebook.

The rice husk example extends the rice case of Kätelhön et al. (2016). All four notebooks run on bundled databases with open-source solvers; the documentation shows them with their results.

There is also a workshop repository (here) created for the Brightcon 2024 conference, with guided notebooks and exercises.

⚡ Reduced-space solves

solve(formulation='reduced') solves the same LP over the choice alternatives only. With the technosphere matrix square and invertible, every scaling vector that meets the balances is s = s0 + S v, with one variable v_k per alternative, so the problem over v is the problem over s: exact, for every static constraint type, and small however large the database (one column per alternative, one row per constraint that is not a balance). The solution is written back onto the instance, so extract_results() and the rest read it as before. The time-dependent model supports formulation='full' only.

The chance-constrained problems of pulpo.utils.uncertainty are always solved this way. Solvers:

Problem Default Alternative
deterministic LP (full or reduced) HiGHS Gurobi (and GAMS/NEOS for full)
chance-constrained cone Clarabel Gurobi

HiGHS and Clarabel are installed with PULPO and need no licence. Gurobi is used with solver_name='gurobi' when gurobipy is installed; the size-limited licence that ships with pip install gurobipy is for non-production use (see Gurobi's licence terms) and covers problems of up to 2,000 variables and 2,000 linear constraints, or 200 variables once quadratic terms are present. That fits most reduced problems, since they have one column per alternative.

🧪 Tests

The test suite runs with pytest against dedicated virtual environments for the modern (bw25) and legacy (bw2) Brightway stacks. See the testing README for setup instructions and the exact commands.


What's new in 2.0.0?

  • Reduced-space solves — solve(formulation='reduced'), see above.
  • One uncertainty method — pulpo.utils.uncertainty replaces the 1.x generations (uncertainty in the biosphere flows and characterization factors only, as before; technosphere exchanges are deterministic): declared distributions only (undeclared parameters stay deterministic and are screened, not gap-filled), closed-form moments, a joint chance-constrained front over the impact and uncertain capacities solved in reduced space with Clarabel, an exact variance decomposition, and out-of-sample validation. The uncertainty notebook runs it on the bundled demo database without ecoinvent or a commercial solver. The 1.x uncertainty API is removed (see the changelog).
  • Defaults unchanged — formulation='full' and instantiate(scale=False). Current development considers formulation='reduced' and scale=True (from 1.8.0) superior; a future release may switch the defaults.

See the changelog for the full details and earlier releases.


🤝 Contributing

Contributions are very welcome. To request a feature or report a bug, please open an Issue. If you are confident in your coding skills, feel free to implement your suggestions and send a Pull Request.


📄 License

This project is licensed under the ℹ️ BSD 3-Clause License. See the LICENSE file for additional info.
Copyright (c) 2024-2026, Fabian Lechtenberg. All rights reserved.


👏 Acknowledgments

We would like to express our gratitude to the authors and contributors of the following packages that PULPO builds upon:

We also acknowledge the pioneering ideas and contributions from the following works:

The development of PULPO culminated in the following publication, which details the approach and outlines its implementation:

Fabian Lechtenberg, Robert Istrate, Victor Tulus, Antonio Espuña, Moisès Graells, and Gonzalo Guillén‐Gosálbez.
“PULPO: A Framework for Efficient Integration of Life Cycle Inventory Models into Life Cycle Product Optimization.”
Journal of Industrial Ecology, October 10, 2024.
https://doi.org/10.1111/jiec.13561

Please cite this article if PULPO is used to produce results for a publication or project.


Authors


↑ Return

Metadata

Release files for pulpo-dev 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pulpo-dev 2.0.0
File Size Uploaded
pulpo_dev-2.0.0.tar.gz 184.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pulpo-dev 2.0.0
File Interpreter ABI Platform
pulpo_dev-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 312.7 kB

Release files / pulpo_dev-2.0.0.tar.gz

Download URL pulpo_dev-2.0.0.tar.gz
Size 184.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7353f023fb6943717bcc74edc2b05ceb6035df8e2bed9cfb153b37b31b807932
BLAKE2b-256 checksum
How to use checksums
ee8eb8e3f324b951dd2b7751ac3419117037e0a71baa790e79460718dcffd43a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / pulpo_dev-2.0.0-py3-none-any.whl

Download URL pulpo_dev-2.0.0-py3-none-any.whl
Size 127.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31ff8b856c00882a0d8908dbba10ab0d7f2b35f9868a8e3222beb4e6e5cc185f
BLAKE2b-256 checksum
How to use checksums
555bb5c65104193709e078e325474dbe6dd3885b53641cb10aa82d8236413181
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page