Hi,

I use the python interface to solve relatively small pure LP problems (< 5000 variables) and regulary see a memory leak when solving the problem. Note that I updated my installation with a patch that mentions a memory leak issue with MIP. Is there a parameter to set a max memory usage or abort the solve process to avoid this issue?

Many thanks,

Nicolas

Adding some colour. I create problems recursively but with high frequency (~3 per second). Each problem should erase the one I created but I suspect this is not the case in practice as the memory usage keeps increasing. Code sample:

in a recursive loop - the memory issue happens after a few hours of such recursion:

prob=reInitializeXPressProblem(nb_dogs, A_ub,b_ub):

res=solve(A_eq,b_eq,bounds,p)

A_ub, A_eq and bounds can be found here:

Free Python solver finds a solution - not XPress. Or do I misuse Python API?

#===================================================================

def reInitializeXPressProblem(nb_dogs, A_ub,b_ub):

'''

Pre-creates a new problem to speed up optimization problem

'''

x = np.array ([xp.var(lb=-xp.infinity,ub=xp.infinity, vartype=xp.continuous) for i in range(A_ub.shape[1])])

p=xp.problem('myProb')

p.addVariable( x )

p.addConstraint(np.dot(A_ub, x) <= b_ub)

p.setObjective(x[-1],sense=xp.minimize)

return {'problem':p,'x':x}

def solve_problem(A_eq,b_eq,bounds,p):

'''

p is an xpress problem

Call XPress to solve the problem. p, A_ub constraint and x must have been initiated before

'''

try:

x=p['x']

p['problem'].chgbounds (x, ['L']*len(x), bounds['lb'])

p['problem'].chgbounds (x, ['U']*len(x), bounds['ub'])

p['problem'].addConstraint (xp.Dot(A_eq,x) == b_eq)

p['problem'].solve()

sol=p['problem'].getSolution().copy()

status=p['problem'].getProbStatus()

del p

return {'solution':sol,'status':status}

except:

return{'solution':np.zeros[A_eq.shape[1]],'status':0}

#=============================================================

to create c and bounds:

obj=np.zeros((12*nb_dogs+10*nb_dogs*(nb_dogs-1)+1,1))

obj[12*nb_dogs+10*nb_dogs*(nb_dogs-1)][0]=1

c=np.ndarray.flatten(obj)

bounds=tuple(((0,100) for i in range(0,nb_dogs)))

bounds=bounds+tuple((0,0) for i in range(nb_dogs,8*nb_dogs+4*nb_dogs*(nb_dogs-1)))

bounds=bounds+tuple(((0,None) for _ in range(0,4*nb_dogs+6*nb_dogs*(nb_dogs-1))))

bounds=bounds+tuple((None,None)for _ in range(0,1))

'''converts list of tuples to vectors for XPress'''

lb=[]

ub=[]

for b in bounds:

if b[0]==None:

lb.append(-xp.infinity)

else:

lb.append(b[0])

if b[1]==None:

ub.append(xp.infinity)

else:

ub.append(b[1])

many thanks,

Nicolas