ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 31 Oct 2015 09:04:11 +0100best_known_objective_bound()https://ask.sagemath.org/question/30366/best_known_objective_bound/ Hi,
I am using sage Version 6.5, Release Date: 2015-02-17. I have MILP problem and trying to solve it. However, I defined time limit and used try and except to get the best_known_objective_bound(). Unfortunately, I am getting AttributeError: 'sage.numerical.backends.glpk_backend.GLPKBackend' object has no attribute 'best_known_objective_bound'
I even tried the following simple example (posted here
http://doc.sagemath.org/html/en/reference/numerical/sage/numerical/backends/glpk_backend.html#sage.numerical.backends.glpk_backend.GLPKBackend.best_known_objective_bound). However, I am facing the same issue for the example as well.
sage: g = graphs.CubeGraph(9)
sage: p = MixedIntegerLinearProgram(solver="GLPK")
sage: p.solver_parameter("mip_gap_tolerance",100)
sage: b = p.new_variable(binary=True)
sage: p.set_objective(p.sum(b[v] for v in g))
sage: for v in g:
....: p.add_constraint(b[v]+p.sum(b[u] for u in g.neighbors(v)) <= 1)
sage: p.add_constraint(b[v] == 1) # Force an easy non-0 solution
sage: p.solve() # rel tol 100
1.0
sage: backend = p.get_backend()
sage: backend.best_known_objective_bound() # random
AttributeError: 'sage.numerical.backends.glpk_backend.GLPKBackend' object has no attribute 'best_known_objective_bound'
What I want is to get the best known optimum answer by time limit.
Anyone knows how should i get it?
Thanks a lot!
Cheers,
Aissan Sat, 31 Oct 2015 05:55:14 +0100https://ask.sagemath.org/question/30366/best_known_objective_bound/Answer by fidbc for <p>Hi, </p>
<p>I am using sage Version 6.5, Release Date: 2015-02-17. I have MILP problem and trying to solve it. However, I defined time limit and used try and except to get the best_known_objective_bound(). Unfortunately, I am getting AttributeError: 'sage.numerical.backends.glpk_backend.GLPKBackend' object has no attribute 'best_known_objective_bound'</p>
<p>I even tried the following simple example (posted here
<a href="http://doc.sagemath.org/html/en/reference/numerical/sage/numerical/backends/glpk_backend.html#sage.numerical.backends.glpk_backend.GLPKBackend.best_known_objective_bound">http://doc.sagemath.org/html/en/refer...</a>). However, I am facing the same issue for the example as well. </p>
<p>sage: g = graphs.CubeGraph(9)</p>
<p>sage: p = MixedIntegerLinearProgram(solver="GLPK")</p>
<p>sage: p.solver_parameter("mip_gap_tolerance",100)</p>
<p>sage: b = p.new_variable(binary=True)</p>
<p>sage: p.set_objective(p.sum(b[v] for v in g))</p>
<p>sage: for v in g:</p>
<p>....: p.add_constraint(b[v]+p.sum(b[u] for u in g.neighbors(v)) <= 1)</p>
<p>sage: p.add_constraint(b[v] == 1) # Force an easy non-0 solution</p>
<p>sage: p.solve() # rel tol 100</p>
<p>1.0</p>
<p>sage: backend = p.get_backend()</p>
<p>sage: backend.best_known_objective_bound() # random</p>
<p>AttributeError: 'sage.numerical.backends.glpk_backend.GLPKBackend' object has no attribute 'best_known_objective_bound'</p>
<p>What I want is to get the best known optimum answer by time limit.
Anyone knows how should i get it? </p>
<p>Thanks a lot!
Cheers,
Aissan </p>
https://ask.sagemath.org/question/30366/best_known_objective_bound/?answer=30367#post-id-30367This seems to be a feature that was added just [recently](http://trac.sagemath.org/ticket/19090).
Perhaps upgrading to sagemath v 6.9 will do the job.Sat, 31 Oct 2015 06:37:47 +0100https://ask.sagemath.org/question/30366/best_known_objective_bound/?answer=30367#post-id-30367Comment by Aissan Dalvandi for <p>This seems to be a feature that was added just <a href="http://trac.sagemath.org/ticket/19090">recently</a>. </p>
<p>Perhaps upgrading to sagemath v 6.9 will do the job.</p>
https://ask.sagemath.org/question/30366/best_known_objective_bound/?comment=30370#post-id-30370Yes :) you are right. Sorted :)
Many thanksSat, 31 Oct 2015 09:04:11 +0100https://ask.sagemath.org/question/30366/best_known_objective_bound/?comment=30370#post-id-30370