From 5eba494921c29db4476cf0069f801524ca47422b Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Tue, 8 Oct 2024 20:49:21 +1300 Subject: [PATCH 1/5] [docs] debug failure on v1.11 --- .github/workflows/documentation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index d6599e4ccdf..e8e1145d4b1 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@latest with: - version: '1.10' + version: '1' - name: Install dependencies shell: julia --color=yes --project=docs/ {0} run: | From 16ac20dda9ab31a88e48dcfb6179dd605c35acde Mon Sep 17 00:00:00 2001 From: odow Date: Wed, 9 Oct 2024 11:15:54 +1300 Subject: [PATCH 2/5] Fix ellipse_approx tutorial --- docs/src/tutorials/conic/ellipse_approx.jl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/src/tutorials/conic/ellipse_approx.jl b/docs/src/tutorials/conic/ellipse_approx.jl index e09b95a0abd..5b2ef3efc3e 100644 --- a/docs/src/tutorials/conic/ellipse_approx.jl +++ b/docs/src/tutorials/conic/ellipse_approx.jl @@ -94,7 +94,7 @@ plot = Plots.scatter( model = Model(SCS.Optimizer) ## We need to use a tighter tolerance for this example, otherwise the bounding ## ellipse won't actually be bounding... -set_attribute(model, "eps_rel", 1e-6) +set_attribute(model, "eps_rel", 1e-7) set_silent(model) m, n = size(S) @variable(model, z[1:n]) @@ -124,11 +124,13 @@ D = value.(Z) c = D \ value.(z) -# Finally, overlaying the solution in the plot we see the minimal volume approximating -# ellipsoid: +# We can check that each point lies inside the ellipsoid, by checking if the +# largest normalized radius is less than 1: + +largest_radius = maximum(map(x -> (x - c)' * D * (x - c), eachrow(S))) -Test.@test isapprox(D, [0.00707 -0.0102; -0.0102173 0.0175624]; atol = 1e-2) #src -Test.@test isapprox(c, [-3.24802, -1.842825]; atol = 1e-2) #src +# Finally, overlaying the solution in the plot we see the minimal volume +# approximating ellipsoid: P = sqrt(D) q = -P * c @@ -211,7 +213,7 @@ f = [1 - S[i, :]' * Z * S[i, :] + 2 * S[i, :]' * z - s for i in 1:m] @objective(model, Max, 1 * t + 0) optimize!(model) Test.@test is_solved_and_feasible(model) -Test.@test isapprox(D, value.(Z); atol = 1e-6) #src +Test.@test isapprox(D, value.(Z); atol = 1e-3) #src solve_time_1 = solve_time(model) # This formulation gives the much smaller graph: From 15c2c1e2cdfb88a7a7c694cf9101e07f5a4eef9f Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Wed, 9 Oct 2024 11:40:14 +1300 Subject: [PATCH 3/5] Update @force_nonlinear.jl --- src/macros/@force_nonlinear.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/macros/@force_nonlinear.jl b/src/macros/@force_nonlinear.jl index 5ea1dfde2a7..57b9e5534ca 100644 --- a/src/macros/@force_nonlinear.jl +++ b/src/macros/@force_nonlinear.jl @@ -84,10 +84,10 @@ julia> @expression(model, @force_nonlinear(x * 2.0 * (1 + x) * x)) x * 2.0 * (1 + x) * x julia> @allocated @expression(model, x * 2.0 * (1 + x) * x) -3200 +2640 julia> @allocated @expression(model, @force_nonlinear(x * 2.0 * (1 + x) * x)) -640 +672 ``` """ macro force_nonlinear(expr) From cd3656295d2b1d4ea94ccd3ed768d6092922ed3b Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Wed, 9 Oct 2024 16:49:37 +1300 Subject: [PATCH 4/5] Update tsp_lazy_constraints.jl --- docs/src/tutorials/algorithms/tsp_lazy_constraints.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/tutorials/algorithms/tsp_lazy_constraints.jl b/docs/src/tutorials/algorithms/tsp_lazy_constraints.jl index e1f616bf3d5..f6b6e43325a 100644 --- a/docs/src/tutorials/algorithms/tsp_lazy_constraints.jl +++ b/docs/src/tutorials/algorithms/tsp_lazy_constraints.jl @@ -116,7 +116,7 @@ import Plots # The vertices are assumed to be randomly distributed in the Euclidean space; # thus, the weight (distance) of each edge is defined as follows. -function generate_distance_matrix(n; random_seed = 1) +function generate_distance_matrix(n; random_seed = 1234) rng = Random.MersenneTwister(random_seed) X = 100 * rand(rng, n) Y = 100 * rand(rng, n) From 84a279fecc7bfb3984602cf48f5f2df5cd025696 Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Wed, 9 Oct 2024 17:26:09 +1300 Subject: [PATCH 5/5] Update tsp_lazy_constraints.jl --- docs/src/tutorials/algorithms/tsp_lazy_constraints.jl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/src/tutorials/algorithms/tsp_lazy_constraints.jl b/docs/src/tutorials/algorithms/tsp_lazy_constraints.jl index f6b6e43325a..82dd8871eea 100644 --- a/docs/src/tutorials/algorithms/tsp_lazy_constraints.jl +++ b/docs/src/tutorials/algorithms/tsp_lazy_constraints.jl @@ -116,7 +116,7 @@ import Plots # The vertices are assumed to be randomly distributed in the Euclidean space; # thus, the weight (distance) of each edge is defined as follows. -function generate_distance_matrix(n; random_seed = 1234) +function generate_distance_matrix(n; random_seed = 1) rng = Random.MersenneTwister(random_seed) X = 100 * rand(rng, n) Y = 100 * rand(rng, n) @@ -124,7 +124,7 @@ function generate_distance_matrix(n; random_seed = 1234) return X, Y, d end -n = 40 +n = 20 X, Y, d = generate_distance_matrix(n) # For the JuMP model, we first initialize the model object. Then, we create the @@ -252,7 +252,6 @@ function subtour_elimination_callback(cb_data) if !(1 < length(cycle) < n) return # Only add a constraint if there is a cycle end - println("Found cycle of length $(length(cycle))") S = [(i, j) for (i, j) in Iterators.product(cycle, cycle) if i < j] con = @build_constraint( sum(lazy_model[:x][i, j] for (i, j) in S) <= length(cycle) - 1,