You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
workspace()
using JuMP
using Cbc
using Graphs
petersen = simple_petersen_graph()
function max_independent_set(g::SimpleGraph)
m = Model(solver=CbcSolver())
@variable(m, b[v in vertices(g)], Bin)
@constraint(m , nonadjacency[e in edges(g)], b[source(e)] + b[target(e)] <= 1)
@objective(m, Max, sum{b[v] , v in vertices(g)})
solve(m)
@show typeof(1:10)
@show typeof(vertices(g))
@show typeof(b)
end
max_independent_set(petersen)
Notice that 1:10 and vertices(g) are exactly the same (and have the same type) in my case, except on the symbolic level which, in my opinion, is causing the issue here.
I think that for the current version, it would be worth mentioning somewhere in the doc that if you use, for indices, a unit range as a "literal" the variables will be stored in an array but if you use a unit range not as a "literal" the variables will be stored in a dictionary; since this can have an impact on the performance, especially for callbacks...
The text was updated successfully, but these errors were encountered:
FIRST_INPUT
FIRST_OUTPUT:
MODIFYING_INPUT
Instead of
@variable(m, b[v in vertices(g)], Bin)
I write
@variable(m, b[v in 1:10], Bin)
SECOND_OUTPUT
Notice that
1:10
andvertices(g)
are exactly the same (and have the same type) in my case, except on the symbolic level which, in my opinion, is causing the issue here.I think that for the current version, it would be worth mentioning somewhere in the doc that if you use, for indices, a unit range as a "literal" the variables will be stored in an array but if you use a unit range not as a "literal" the variables will be stored in a dictionary; since this can have an impact on the performance, especially for callbacks...
The text was updated successfully, but these errors were encountered: