Skip to main content

Gyozas

Gyozas logo

CI PyPI Python License: MIT codecov

A pure-Python reinforcement learning library for combinatorial optimization, built on top of PySCIPOpt and Gymnasium.

Gyozas provides a modular RL environment that lets you train agents to make decisions inside SCIP's branch-and-bound solver -- variable selection (branching) and node selection -- with pluggable rewards, observations, and problem instance generators.

Features

  • Gymnasium-style API -- reset() / step() / render() interface
  • Branching & node selection dynamics -- control variable branching or node selection decisions
  • Bipartite graph observations -- LP-based features following Gasse et al. (NeurIPS 2019)
  • Multiple reward functions -- node count, solving time, LP iterations, primal/dual integrals
  • Built-in instance generators -- set cover, independent set, combinatorial auction, capacitated facility location
  • Branch-and-bound tree visualization

Prerequisites

Gyozas requires the SCIP solver (version 8+). But latest version should be installed when PySCIPOpt is installed automatically with Gyozas dependencies

Installation

pip install gyozas

Or install from source:

pip install .

You can install extra packages for enhanced visualization of branch and bound tree state using

pip install "gyozas[viz]"

Quick Start

import gyozas

# Create an instance generator
instances = gyozas.SetCoverGenerator(n_rows=100, n_cols=200)

# Create the RL environment
env = gyozas.Environment(
    instance_generator=instances,
    observation_function=gyozas.NodeBipartite(),
    reward_function=gyozas.NNodes(),
)

# Run one episode
obs, action_set, reward, done, info = env.reset()
while not done:
    action = action_set[0]  # pick first available action
    obs, action_set, reward, done, info = env.step(action)

env.close()

Coming from Ecole?

Gyozas is a drop-in replacement for Ecole with a near-identical API:

Ecole Gyozas
Install C++ build, CMake, custom SCIP pip install gyozas
Language C++ core + Python bindings Pure Python
Maintained Last release 2023 Active
Python 3.7--3.10 3.10+
Custom components Subclass C++ base classes Any object with reset()/extract()
Node selection Not supported NodeSelectionDynamics
Gymnasium wrapper Not included GymnasiumWrapper for SB3/CleanRL

See the full migration guide for detailed API mapping.

Components

Dynamics

  • BranchingDynamics -- control variable selection in branching (default)
  • NodeSelectionDynamics -- control which node to explore next
  • ConfiguringDynamics -- single-step algorithm configuration (set SCIP params, then solve)
  • PrimalSearchDynamics -- LP-probing primal heuristic; agent provides partial variable assignments
  • ExtraBranchingActions -- sentinel actions (SKIP, CUT_OFF, REDUCE_DOMAIN) for branching

Rewards

  • NNodes -- change in number of explored nodes
  • SolvingTime -- wall-clock time per step
  • LPIterations -- change in LP iterations
  • DualIntegral / PrimalIntegral / PrimalDualIntegral -- bound integrals
  • Done -- binary completion status
  • ArithmeticMixin -- compose rewards with Python operators: -NNodes() * 0.5 + SolvingTime().cumsum()

Observations

  • NodeBipartite / NodeBipartiteEcole -- pure-Python bipartite graph with configurable features
  • NodeBipartiteSCIP -- thin wrapper around PySCIPOpt's built-in C implementation
  • Pseudocosts -- per-variable pseudocost scores accumulated across branching history
  • StrongBranchingScores -- full and partial strong-branching scores via LP probing

Instance Generators

  • SetCoverGenerator -- random set cover problems
  • IndependentSetGenerator -- random independent set problems
  • CombinatorialAuctionGenerator -- random combinatorial auction problems
  • CapacitatedFacilityLocationGenerator -- random facility location problems
  • FileGenerator -- load instances from files on disk

Instance Modifiers

Modifiers wrap any generator and post-process the model before it reaches the environment:

  • EmbedObjective -- embed the objective function as a variable + equality constraint
  • SetParameters -- apply arbitrary SCIP parameters
  • SetNoCuts / SetNoHeuristics / SetNoDisplay / SetDFSNodeSelection / SetBFSNodeSelection -- convenience presets

Gymnasium Wrapper

GymnasiumWrapper exposes any Environment as a standard Gymnasium environment, compatible with Stable-Baselines3, CleanRL, and other RL frameworks.

Tests

uv sync
uv run pytest

Contributors

Name Affiliation GitHub
Olivier JUAN EDF Lab @olivierjuan
Paul STRANG EDF Lab · CNAM · ISAE @abfariah

License

MIT

Metadata

Release files for gyozas 1.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 gyozas 1.0.0
File Size Uploaded Provenance
gyozas-1.0.0.tar.gz 837.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for gyozas 1.0.0
File Interpreter ABI Platform
gyozas-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 892.1 kB

Release files / gyozas-1.0.0.tar.gz

Download URL gyozas-1.0.0.tar.gz
Size 837.7 kB
Tags Source
SHA-256 checksum
How to use checksums
20be30396438ddbb020e656bfe256d1ec7720a5c7346872f86cda258e85559bb
BLAKE2b-256 checksum
How to use checksums
d381ea75b6d19231499ad30e89bf149d0bc1cffe643854ee3634b89e0f80808c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / gyozas-1.0.0-py3-none-any.whl

Download URL gyozas-1.0.0-py3-none-any.whl
Size 54.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
59e40948a77f39017b06d860fc892087fb914b7635b8e31801599b44664fadf3
BLAKE2b-256 checksum
How to use checksums
b546225cfe6cd105ef2653398507017f7e3bd62038a59698d34330e9c2367c5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for gyozas 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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