jump-dev / HiGHS.jl

A Julia interface to the HiGHS solver
https://highs.dev
MIT License
108 stars 15 forks source link

Add SnoopPrecompile directive #147

Closed odow closed 1 year ago

odow commented 1 year ago

x-ref https://github.com/jump-dev/MathOptInterface.jl/issues/2226

Before

julia> @time using JuMP, HiGHS
  7.294264 seconds (9.44 M allocations: 615.447 MiB, 3.88% gc time, 0.21% compilation time)

julia> @time @eval begin
           let
               model = Model(HiGHS.Optimizer)
               @variable(model, x >= 0)
               @variable(model, 0 <= y <= 3)
               @objective(model, Min, 12x + 20y)
               @constraint(model, c1, 6x + 8y >= 100)
               @constraint(model, c2, 7x + 12y >= 120)
               optimize!(model)
           end
       end;
Running HiGHS 1.4.0 [date: 1970-01-01, git hash: bcf6c0b22]
Copyright (c) 2022 ERGO-Code under MIT licence terms
Presolving model
2 rows, 2 cols, 4 nonzeros
2 rows, 2 cols, 4 nonzeros
Presolve : Reductions: rows 2(-0); columns 2(-0); elements 4(-0) - Not reduced
Problem not reduced by presolve: solving the LP
Using EKK dual simplex solver - serial
  Iteration        Objective     Infeasibilities num(sum)
          0     0.0000000000e+00 Pr: 2(220) 0s
          2     2.0500000000e+02 Pr: 0(0) 0s
Model   status      : Optimal
Simplex   iterations: 2
Objective value     :  2.0500000000e+02
HiGHS run time      :          0.00
  5.872492 seconds (7.41 M allocations: 1.216 GiB, 6.91% gc time, 99.80% compilation time)

After

julia> @time using JuMP, HiGHS
  7.860564 seconds (10.01 M allocations: 648.535 MiB, 3.45% gc time, 0.21% compilation time)

julia> @time @eval begin
           let
               model = Model(HiGHS.Optimizer)
               @variable(model, x >= 0)
               @variable(model, 0 <= y <= 3)
               @objective(model, Min, 12x + 20y)
               @constraint(model, c1, 6x + 8y >= 100)
               @constraint(model, c2, 7x + 12y >= 120)
               optimize!(model)
           end
       end;
Running HiGHS 1.4.0 [date: 1970-01-01, git hash: bcf6c0b22]
Copyright (c) 2022 ERGO-Code under MIT licence terms
Presolving model
2 rows, 2 cols, 4 nonzeros
2 rows, 2 cols, 4 nonzeros
Presolve : Reductions: rows 2(-0); columns 2(-0); elements 4(-0) - Not reduced
Problem not reduced by presolve: solving the LP
Using EKK dual simplex solver - serial
  Iteration        Objective     Infeasibilities num(sum)
          0     0.0000000000e+00 Pr: 2(220) 0s
          2     2.0500000000e+02 Pr: 0(0) 0s
Model   status      : Optimal
Simplex   iterations: 2
Objective value     :  2.0500000000e+02
HiGHS run time      :          0.00
  1.823514 seconds (1.49 M allocations: 844.821 MiB, 13.36% gc time, 99.44% compilation time)

The last part is due to an instability in Utilities.default_copy_to that I need to figure out how to resolve.

codecov[bot] commented 1 year ago

Codecov Report

Base: 84.85% // Head: 81.66% // Decreases project coverage by -3.19% :warning:

Coverage data is based on head (5af357c) compared to base (9ec05c3). Patch has no changes to coverable lines.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master jump-dev/JuMP.jl#147 +/- ## ========================================== - Coverage 84.85% 81.66% -3.19% ========================================== Files 3 3 Lines 1505 1505 ========================================== - Hits 1277 1229 -48 - Misses 228 276 +48 ``` | [Impacted Files](https://codecov.io/gh/jump-dev/HiGHS.jl/pull/147?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jump-dev) | Coverage Δ | | |---|---|---| | [src/HiGHS.jl](https://codecov.io/gh/jump-dev/HiGHS.jl/pull/147?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jump-dev#diff-c3JjL0hpR0hTLmps) | `100.00% <ø> (ø)` | | | [src/gen/libhighs.jl](https://codecov.io/gh/jump-dev/HiGHS.jl/pull/147?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jump-dev#diff-c3JjL2dlbi9saWJoaWdocy5qbA==) | `31.14% <0.00%> (-6.56%)` | :arrow_down: | | [src/MOI\_wrapper.jl](https://codecov.io/gh/jump-dev/HiGHS.jl/pull/147?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jump-dev#diff-c3JjL01PSV93cmFwcGVyLmps) | `91.41% <0.00%> (-2.55%)` | :arrow_down: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jump-dev). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jump-dev)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.