opencobra / optlang

optlang - sympy based mathematical programming language
http://optlang.readthedocs.org/
Apache License 2.0
244 stars 51 forks source link

Enable Gurobi license parameters to be loaded through environment variables #237

Open jonrkarr opened 3 years ago

jonrkarr commented 3 years ago

The Gurobi API can be used to invoke Gurobi with license information passed through environment variables rather than license files. This would make it easier to deploy OptLang with Gurobi in containers (e.g., Docker, Singularity).

import gurobipy
params = {
    'LICENSEID': int(os.getenv('GRB_LICENSEID')),
    ...
}
env = gurobipy.Env(params=params)
model = gurobipy.Model(env=env)
EmanuelGoncalves commented 4 months ago

This would definitely be a great addition. Meanwhile, how can this be done?