Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Nov 6, 2024
1 parent 6b9e00c commit f082bac
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/JuMP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1367,7 +1367,20 @@ PrecompileTools.@compile_workload begin
# at lowering time, not much of this would get precompiled without `@eval`
@eval begin
let
# We don't care about this particular optimizer, but it still
# exercises generic code paths that calls like
# Model(HiGHS.Optimizer) also need.
Model(
() -> MOI.Utilities.MockOptimizer(
MOI.Utilities.UniversalFallback(
MOI.Utilities.Model{Float64}(),
),
),
)
# Use an empty model to build, which is a common use-case, and
# doesn't bake in Utilities.MockOptimizer.
model = Model()
set_silent(model)
@variables(model, begin
x1 >= 0
0 <= x2 <= 1
Expand All @@ -1379,7 +1392,7 @@ PrecompileTools.@compile_workload begin
x8[i = 1:3; isodd(i)], (start = i)
end)
@expressions(model, begin
a, -1 + x1 + x2
a, 2 * x1 + 3 * x2
b, 1 + x1^2 + x2
nl_expr, sin(x1)
end)
Expand All @@ -1400,6 +1413,15 @@ PrecompileTools.@compile_workload begin
@objective(model, Min, x1)
@objective(model, Max, a)
@objective(model, Min, b)
set_optimizer(
model,
() -> MOI.Utilities.MockOptimizer(
MOI.Utilities.UniversalFallback(
MOI.Utilities.Model{Float64}(),
),
),
)
optimize!(model)
end
end
end
Expand Down

0 comments on commit f082bac

Please sign in to comment.