Closed dannyopts closed 1 year ago
hey @dannyopts, this seems to be very much related but not fully solved (as far as I can see) by #162. Perhaps you could build up on this? The easiest approach would be to allow passing an env
keyword argument via the solver_options
, i.e. using something like this:
def run_gurobi(
model,
io_api=None,
problem_fn=None,
solution_fn=None,
log_fn=None,
warmstart_fn=None,
basis_fn=None,
keep_files=False,
**solver_options,
):
# ... (existing code)
with solver_options.get('env') or gurobipy.Env() as env:
# ... (existing code)
perhaps @tgi-climact has one more thought about this?
@FabianHofmann @dannyopts Sounds good to me !
solved by #162 (please reopen, if that is not correct)
I would like to run a gurobi job in an environment that I configure rather than the default environment.
Currently I dont believe there is a way to pass either configuration for the environment or an environment itself.
I have two reasons I want to do this.
For me I would be happy with either a new option grb_create_new_env, I dont really care about reusing envs, or a new option grb_env where I can pass the gurobi env I already created straight down.
Happy to implement this and raise a PR once an approach is agreed.
https://github.com/PyPSA/linopy/blob/8f8682bb50f94bee742aca655aadc38532787c89/linopy/solvers.py#L551C1-L551C1