A Python wrapper around bensolve, for Vector Linear Programs (VLP) and multiple objective linear programs (MOLP)
Project description
BENPY
A Python wrapper for Bensolve v2.0.1.
Internally, we use a slightly modified version, available here, which is included in the bensolve-mod folder.
🚀 Getting Started
Prerequisites
benpy depends on GLPK (GNU Linear Programming Kit), which must be installed before installing benpy.
See the Installing GLPK section below for platform-specific installation instructions.
🛠 Installing benpy
Using pip (Recommended)
pip install benpy
From a Cloned Repository
git clone https://github.com/markobud/benpy.git
cd benpy
pip install .
Installing the Development Version
pip install git+https://github.com/markobud/benpy@development
📌 Running Examples
Example scripts are provided in the src/examples/ folder.
To run an example from the cloned benpy repository:
python src/examples/TestVLP.py
More examples are available in src/examples/bensolve_examples.py.
If you installed benpy using pip, you can locate the examples folder with the following:
import os
import benpy
example_dir = os.path.join(os.path.dirname(benpy.__file__), "examples")
print(f"Examples are located at: {example_dir}")
🏠 Built With
- setuptools – Used for building the package.
- bensolve-mod – A modified version of Bensolve included in this repository.
- PTable – Used for pretty-printing results.
🐛 Issues
benpy depends on bensolve for computations, so any issues in bensolve will also affect benpy.
Please refer to the original Bensolve software for more details.
📂 Versioning
We use Semantic Versioning (SemVer) for versioning.
For available versions, see the tags on this repository.
👨💻 Authors
- Marko Budinich – Initial work – Benpy Legacy Code
- Damien Vintache – Initial work – Benpy Legacy Code
📝 License
This project is licensed under the GNU GPLv3 License.
See the LICENSE.md file for details.
🎉 Acknowledgments
- Thanks to Damien Vintache for the initial package version.
- Special thanks to the Bensolve developers for their work.
📚 Annex: Installing GLPK
These installation methods have been tested by some users but may vary by system.
For official instructions, please refer to the GLPK documentation.
🐧 Linux (Debian/Ubuntu)
sudo apt update && sudo apt install -y glpk-utils libglpk-dev
# Set environment variables
export CFLAGS="-I/usr/include"
export LDFLAGS="-L/usr/lib"
export PATH="/usr/bin:$PATH"
# To make these changes permanent, add them to ~/.bashrc
echo 'export CFLAGS="-I/usr/include"' >> ~/.bashrc
echo 'export LDFLAGS="-L/usr/lib"' >> ~/.bashrc
echo 'export PATH="/usr/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
🍏 macOS (Homebrew)
brew install glpk
# Set environment variables (needed for compilation)
export CFLAGS="-I$(brew --prefix glpk)/include"
export LDFLAGS="-L$(brew --prefix glpk)/lib"
export PATH="$(brew --prefix glpk)/bin:$PATH"
# To make these changes permanent, add them to ~/.zshrc
echo 'export CFLAGS="-I$(brew --prefix glpk)/include"' >> ~/.zshrc
echo 'export LDFLAGS="-L$(brew --prefix glpk)/lib"' >> ~/.zshrc
echo 'export PATH="$(brew --prefix glpk)/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
🖥 Windows (MSYS2 / MinGW)
1⃣ Install MSYS2
- Download MSYS2: https://www.msys2.org
- Open the MSYS2 UCRT64 Terminal.
2⃣ Install GLPK
pacman -S mingw-w64-ucrt-x86_64-glpk
3⃣ Set Environment Variables
export CFLAGS="-I/mingw64/include"
export LDFLAGS="-L/mingw64/lib"
export PATH="/mingw64/bin:$PATH"
# To make these changes permanent, add them to ~/.bashrc
echo 'export CFLAGS="-I/mingw64/include"' >> ~/.bashrc
echo 'export LDFLAGS="-L/mingw64/lib"' >> ~/.bashrc
echo 'export PATH="/mingw64/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
🎯 Final Notes
- If you encounter any issues, refer to the GLPK official documentation: https://www.gnu.org/software/glpk/
- Ensure that
glpsol --versionoutputs a valid version after installation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file benpy-1.0.3.tar.gz.
File metadata
- Download URL: benpy-1.0.3.tar.gz
- Upload date:
- Size: 218.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0284ff31bd3fea2b64ca8bc50a275a390b0bf08eaade7518ff9ad4b0a7bea3a9
|
|
| MD5 |
d1e71338fafb0952f8bf68dc54189bb1
|
|
| BLAKE2b-256 |
eff0c070208054a0f94b7f92a8b91bc39b29355e7d2a4484d503f3722fdca72c
|