1

How to set time limit for The integer linear programming(ILP) function in CVXOPT? suppose this is my solver:

status,solution = glpk.ilp(W, G.T, h,B=set(range(len(W))))

2 Answers 2

3

Try the following:

from cvxopt import solvers
solvers.options['glpk'] = {'tm_lim' : 1000}  # time-limit of 1s (glpk expects [ms])
status,solution = glpk.ilp(W, G.T, h,B=set(range(len(W))))

Passing solver-options (within cvxopt) is described in the docs here.

The available options of glpk are described in it's manual here

Edit: As mentioned in the comments, tm_lim is the variable to set, not tm lim!

Sign up to request clarification or add additional context in comments.

3 Comments

@Panda You are right! Sorry. Copy-paste from pdf's kills underscores for me :-)
but for me it didn't work :) but below code worked: glpk.options['tm_lim'] =OPT_TIME
That's because you use some other importing-style.
1

The solution from Sascha's answer didn't work for me, which might be due to import styles. However, you can also just pass an options dictionary in the function call, i.e.

glpk.ilp(W, G.T, h,B=set(range(len(W))), options={'tm_lim': 1000})

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.