Ask Your Question
0

solver_parameter('timelimit') doesnt work

asked 2015-11-03 07:47:45 +0200

updated 2015-11-04 04:00:47 +0200

Hi,

I have an MILP problem and trying to solve it with Sage, GLPK solver. As I want to terminate the problem before getting the optimum answer, I am using the p.solver_parameter("timelimit", 60). I have also used

    try:
        p.solve() 
    except MIPSolverException:
        b = p.get_backend()
        print('best known opjective bound', b.best_known_objective_bound())

However, the solver doesn't stop!!! It keeps runing. I guess the time limit part doesn't work. Its interesting that the p.solver_parameter("time limit") its affected, as I am printing its value before passing the p.solve(). I have also tried p.solver_parameter( backend.glp_simplex_or_intopt, backend.glp_intopt_only) and printed the p.solver_parameter("time limit_intopt"). It's printing 60000 which is right. I have no idea why it keeps running.

Could anyone help me with this issue?

Thanks in advance,

Cheers, Aissan

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2015-11-06 06:47:16 +0200

Its working but its based on computation time, NOT execution time. However, still not sure about the relation between these two!

edit flag offensive delete link more
0

answered 2015-11-03 16:08:50 +0200

Nathann gravatar image

Could you show us a minimal working example of what you do? If you tell me that you set the time limit and that the time limit is not respect, then it is a bug.

edit flag offensive delete link more

Comments

I am actually printing the timelimit and it affected. However, it keeps running unless I manually interrupt it.

Here is my code:

p = MixedIntegerLinearProgram(maximization=False, solver = "GLPK")

p.solver_parameter( "timelimit", 60)

Z =    p.new_variable ( binary= True)

#### defining all the variables and constrains here #####

p.set_objective(   p.sum(COSTPenalty * (1-Z[k])   for k in   Requests.keys()))

b= p.get_backend()

print (p.solver_parameter( 'timelimit'))

try :

    p.solve() 

    return (p.get_objective_value() )

except MIPSolverException:

    b= p.get_backend()

    print ('the best known objective bound is ',b.best_known_objective_bound())

    return b.best_known_objective_bound()

Thanks a lot!

Aissan Dalvandi gravatar imageAissan Dalvandi ( 2015-11-04 03:49:27 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-11-03 07:47:45 +0200

Seen: 339 times

Last updated: Nov 06 '15