Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] debug failure on v1.11 #3843

Merged
merged 5 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
3 changes: 1 addition & 2 deletions docs/src/tutorials/algorithms/tsp_lazy_constraints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function generate_distance_matrix(n; random_seed = 1)
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
Expand Down Expand Up @@ -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,
Expand Down
14 changes: 8 additions & 6 deletions docs/src/tutorials/conic/ellipse_approx.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/macros/@force_nonlinear.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading