diff --git a/.gitignore b/.gitignore index 499e5e5..b432291 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /Manifest.toml /docs/build/ /docs/site/ +/dev diff --git a/.travis.yml b/.travis.yml index 4d793e7..22ad5ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,10 +3,15 @@ language: julia os: - linux - osx + - windows julia: - 1.0 + - 1.1 - 1.2 - nightly +branches: # build master branch + PRs + only: + - master matrix: allow_failures: - julia: nightly diff --git a/Project.toml b/Project.toml index 238f17c..eab5c8e 100644 --- a/Project.toml +++ b/Project.toml @@ -5,10 +5,16 @@ version = "0.3.2" [deps] JuMP = "4076af6c-e467-56ae-b986-b466b2749572" +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee" UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228" -Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" -LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" + +[compat] +julia = "1" +UnicodePlots = "1" +MathOptInterface = "0.8" +JuMP = "0.19" [extras] GLPK = "60bf3e95-4087-53dc-ae20-288a0d20c6a6" diff --git a/src/TravelingSalesmanExact.jl b/src/TravelingSalesmanExact.jl index cb12463..dd1e869 100644 --- a/src/TravelingSalesmanExact.jl +++ b/src/TravelingSalesmanExact.jl @@ -244,7 +244,7 @@ function _get_optimal_tour(cost::AbstractMatrix, with_optimizer, symmetric, verb if verbose @info "Optimization finished; adaptively disallowed $tot_cycles cycles." @info "Final path has length $(objective_value(model))." - @info "Final problem has $(length(model.variable_to_zero_one)) binary variables, $(num_constraints(model, GenericAffExpr{Float64,VariableRef}, MOI.LessThan{Float64})) inequality constraints, and $(num_constraints(model, GenericAffExpr{Float64,VariableRef}, MOI.EqualTo{Float64})) equality constraints." + @info "Final problem has $(num_constraints(model, VariableRef, MOI.ZeroOne)) binary variables, $(num_constraints(model, GenericAffExpr{Float64,VariableRef}, MOI.LessThan{Float64})) inequality constraints, and $(num_constraints(model, GenericAffExpr{Float64,VariableRef}, MOI.EqualTo{Float64})) equality constraints." end return find_cycle(value.(tour_matrix)), objective_value(model) end @@ -270,4 +270,4 @@ function simple_parse_tsp(filename; verbose = true) return cities end -end # module \ No newline at end of file +end # module diff --git a/test/runtests.jl b/test/runtests.jl index a08d84a..5883c98 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -35,14 +35,6 @@ function test_tour(input, opt = TravelingSalesmanExact.get_default_optimizer(); return t, c end -@testset "att48.tsp" begin - cities = simple_parse_tsp(joinpath(@__DIR__, "att48.tsp")) - sym_tour, sym_cost = test_tour(cities; distance = TravelingSalesmanExact.ATT, verbose = true) - @test sym_cost ≈ 10628 - - asym_tour, asym_cost = test_tour(cities; distance = TravelingSalesmanExact.ATT, symmetric = false) - @test asym_cost ≈ 10628 -end @testset "Small random asymmetric" begin # chosen via rand(5,5) @@ -91,4 +83,13 @@ end TravelingSalesmanExact.reset_default_optimizer!() @test_throws ArgumentError test_tour(cost) set_default_optimizer!(with_optimizer(GLPK.Optimizer)) -end \ No newline at end of file +end + +@testset "att48.tsp" begin + cities = simple_parse_tsp(joinpath(@__DIR__, "att48.tsp")) + sym_tour, sym_cost = test_tour(cities; distance = TravelingSalesmanExact.ATT, verbose = true) + @test sym_cost ≈ 10628 + + asym_tour, asym_cost = test_tour(cities; distance = TravelingSalesmanExact.ATT, symmetric = false) + @test asym_cost ≈ 10628 +end