I would like to allocate a large memory for a model created using Python API. When I try to set MemLimit
parameter, I do receive an error.
import gurobipy as gp
from gurobipy import GRB
my_model = gp.Model('myModel')
my_model.setParam('MemLimit', 1e+11)
gurobipy.GurobiError: Unable to modify parameter MemLimit after environment started
Could soemone show how to create an empty enviroment, set the memory parameter and then connect that with the model please?
There are two default behaviors that prevent you from setting the MemLimit parameter in the the Gurobi Python API (gurobipy):
There are two alternate ways to handle this:
MemLimit 1e11
import gurobipy as gp
from gurobipy import GRB
e = gp.Env("gurobi.log", params={'MemLimit': 1e11})
my_model = gp.Model('myModel', env=e)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.