This guide will help you install and set up the optigob package for development or use in your own projects.
- Python 3.12 or higher
- Poetry (recommended for development)
- (Optional) pip for standard installation
- (Optional) conda for environment management
You can install the latest release from PyPI:
pip install optigobOptiGob requires a solver to run optimizations. The recommended option is HiGHS, which you can install alongside optigob:
pip install "optigob[solvers]"Alternatively, install just optigob and choose your own Pyomo-compatible solver from the list provided below.
-
Clone the repository:
git clone https://github.com/colmduff/OptiGob.git cd OptiGob -
Install Poetry (if not already installed):
pip install poetry
-
Install dependencies and the project (local-path install):
poetry install
Poetry installs the project from your working directory (PEP 660 editable-style), so local code changes are reflected immediately without a separate
-eflag.To include the recommended HiGHS solver:
poetry install -E solvers
-
Run commands in the Poetry environment:
You have two options:
-
Use
poetry runprefix (recommended for single commands):poetry run pytest poetry run python tests/example.py
-
Or activate the Poetry shell (for multiple commands in one session):
poetry shell pytest python tests/example.py exit # to leave the Poetry shell when done
-
If you prefer conda for environment management:
conda create -n optigob python=3.12
conda activate optigob
pip install poetry
poetry installTo include the recommended HiGHS solver:
poetry install -E solversOptiGob requires a Pyomo-compatible solver to run optimizations. While HiGHS is
the recommended built-in option (install with pip install highspy or
poetry install --with solvers), you can use any solver supported by Pyomo.
To use a different solver, specify the solver_name parameter in your configuration:
from optigob import Optigob
from optigob.resource_manager.optigob_data_manager import OptiGobDataManager
data = {
# ... your scenario parameters ...
'solver_name': 'glpk' # Use GLPK instead of HiGHS
}
data_manager = OptiGobDataManager(data)
optigob = Optigob(data_manager)For a complete list of available Pyomo-compatible solvers, see the Pyomo documentation.
To use a specific solver, ensure it is installed in your environment, then
specify it via solver_name.
To update to the latest version from PyPI:
pip install --upgrade optigobOr, if using Poetry in development mode:
poetry update- If you encounter issues with dependencies, try updating Poetry and pip.
- For platform-specific issues, please check the GitHub Issues page.
If you have any questions or need help, please open an issue on GitHub or contact the maintainers.