In [1]:
using OPCSPs
step=5
max_nodes=30


Out[1]:
30

In [2]:
include("no_subtour.jl")


Out[2]:
create_mip_without_subtour (generic function with 1 method)

In [3]:
for (i,n) in enumerate(10:step:max_nodes)
    println("$n nodes")
    problem = gen_op(n_nodes=n, rng=MersenneTwister(n))
    @time solve_op(problem)
end


10 nodes
  1.608530 seconds (825.25 k allocations: 34.358 MB, 0.32% gc time)
15 nodes
  0.872766 seconds (5.96 k allocations: 480.391 KB)
20 nodes
  0.333525 seconds (8.48 k allocations: 786.656 KB)
25 nodes
  6.073737 seconds (12.65 k allocations: 1.177 MB)
30 nodes
  

In [6]:
m = nothing
problem = nothing
for (i,n) in enumerate(10:step:max_nodes)
    println("$n nodes")
    problem = gen_op(n_nodes=n, rng=MersenneTwister(n))
    m = create_mip_without_subtour(problem)
    @time solve(m)
end


10 nodes
  0.001714 seconds (152 allocations: 57.281 KB)
15 nodes
  0.002250 seconds (152 allocations: 103.594 KB)
20 nodes
  0.003516 seconds (152 allocations: 168.453 KB)
25 nodes
  0.005118 seconds (155 allocations: 252.578 KB)
30 nodes
  0.007334 seconds (166 allocations: 354.703 KB)

In [9]:
xopt = round(Int, getValue(m.varDict[:x]))
path = build_path(problem, xopt)


Out[9]:
4-element Array{Int64,1}:
  1
 11
 18
 30

In [10]:
distance(problem, path)


Out[10]:
0.594730123737896

In [18]:
getValue(m.varDict[:y])


Out[18]:
30-element Array{Float64,1}:
 1.0
 1.0
 1.0
 1.0
 1.0
 1.0
 1.0
 1.0
 1.0
 1.0
 1.0
 1.0
 1.0
 ⋮  
 1.0
 1.0
 1.0
 1.0
 1.0
 1.0
 1.0
 1.0
 1.0
 1.0
 1.0
 1.0

In [ ]:


In [ ]: