mirror of
https://github.com/tgorordo/titanic.caltech.edu.git
synced 2026-06-05 14:52:15 -07:00
tidy
This commit is contained in:
parent
98da744bf0
commit
0cee74ff54
3 changed files with 6 additions and 19 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1 +1,4 @@
|
||||||
index.html
|
index.html
|
||||||
|
LAVegas.osm
|
||||||
|
traveling-tommys.html
|
||||||
|
traveling-tommys.pdf
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -190,7 +190,7 @@ LightOSM.total_path_weight(::LightOSM.OSMGraph{U, T, W}, ::Nothing) where {U, T,
|
||||||
|
|
||||||
# ╔═╡ a868a31f-2cc7-4283-b0e6-27c50f43a3be
|
# ╔═╡ a868a31f-2cc7-4283-b0e6-27c50f43a3be
|
||||||
d = let nodes = map(l -> nearest_node(g, l)[1], collect.(df[!,:latlon]))
|
d = let nodes = map(l -> nearest_node(g, l)[1], collect.(df[!,:latlon]))
|
||||||
[ total_path_weight(g, shortest_path(g, a, b)) for a=nodes, b=nodes]
|
[total_path_weight(g, shortest_path(g, a, b)) for a=nodes, b=nodes]
|
||||||
end
|
end
|
||||||
|
|
||||||
# ╔═╡ 63333464-4a87-4b14-9507-57cbcdd3d734
|
# ╔═╡ 63333464-4a87-4b14-9507-57cbcdd3d734
|
||||||
|
|
@ -202,7 +202,8 @@ function build_tsp_model(m)
|
||||||
model = Model(GLPK.Optimizer)
|
model = Model(GLPK.Optimizer)
|
||||||
@variable(model, x[1:n, 1:n], Bin, Symmetric)
|
@variable(model, x[1:n, 1:n], Bin, Symmetric)
|
||||||
@objective(model, Min, sum(m .* x) / 2)
|
@objective(model, Min, sum(m .* x) / 2)
|
||||||
@constraint(model, [i in 1:n], sum(x[i, :]) == 2)
|
@constraint(model, [i in 1:n], sum(x[i, [j for j in 1:n if j != i]]) == 1)
|
||||||
|
@constraint(model, [j in 1:n], sum(x[[i for i in 1:n if i != j], j]) == 1)
|
||||||
@constraint(model, [i in 1:n], x[i, i] == 0.)
|
@constraint(model, [i in 1:n], x[i, i] == 0.)
|
||||||
return model
|
return model
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue