Utility Functions

relucent.get_env(num_threads: int | None = None) Env

Get a cached Gurobi environment.

Creates and caches a Gurobi environment with logging disabled. This avoids the overhead of creating multiple environments. For more control over the environment, create and pass one directly to functions that need it.

If num_threads is provided, the environment’s Threads parameter is set accordingly on first creation. Subsequent calls ignore num_threads and return the cached environment.

Parameters:

num_threads – Optional limit on the number of threads Gurobi may use. If None, Gurobi uses its default threading behavior.

Returns:

A Gurobi environment with logging disabled.

Return type:

gurobipy.Env

relucent.set_seeds(seed: int) None

Set all RNG seeds to a given value.

Parameters:

seed – Integer seed value.