Skip to content

Commit d63a223

Browse files
authored
Add support for HiGHS_jll@1.15 (#343)
1 parent b882c45 commit d63a223

7 files changed

Lines changed: 48 additions & 49 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
1212
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1313

1414
[compat]
15-
HiGHS_jll = "=1.14.0"
15+
HiGHS_jll = "=1.15.0"
1616
LinearAlgebra = "1"
1717
MathOptIIS = "0.2"
1818
MathOptInterface = "1.34"

gen/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ HiGHS_jll = "8fd58aa0-07eb-5a78-9b36-339c94fd15ea"
44

55
[compat]
66
Clang = "0.19"
7-
HiGHS_jll = "1.14"
7+
HiGHS_jll = "1.15"

src/gen/libhighs.jl

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,22 @@ function Highs_clearSolver(highs)
300300
ccall((:Highs_clearSolver, libhighs), HighsInt, (Ptr{Cvoid},), highs)
301301
end
302302

303+
"""
304+
Highs_releaseMemory(highs)
305+
306+
Release all retained memory back to the allocator.
307+
308+
Clears all solver state and shrinks internal vectors to free unused capacity. Useful in long-running services that reuse a Highs instance across multiple solves to prevent unbounded RSS growth from heap fragmentation.
309+
310+
# Arguments
311+
* `highs`: A pointer to the Highs instance.
312+
# Returns
313+
A `kHighsStatus` constant indicating whether the call succeeded.
314+
"""
315+
function Highs_releaseMemory(highs)
316+
ccall((:Highs_releaseMemory, libhighs), HighsInt, (Ptr{Cvoid},), highs)
317+
end
318+
303319
"""
304320
Highs_presolve(highs)
305321
@@ -2710,13 +2726,11 @@ const HighsUInt = Cuint
27102726

27112727
const CMAKE_BUILD_TYPE = "Release"
27122728

2713-
const BLAS_LIBRARIES = "blastrampoline"
2714-
2715-
const HIGHS_GITHASH = "7df0786de3"
2729+
const HIGHS_GITHASH = "8396001901"
27162730

27172731
const HIGHS_VERSION_MAJOR = 1
27182732

2719-
const HIGHS_VERSION_MINOR = 14
2733+
const HIGHS_VERSION_MINOR = 15
27202734

27212735
const HIGHS_VERSION_PATCH = 0
27222736

test/test_c_wrapper.jl

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ module TestCHighs
88
using HiGHS
99
using Test
1010

11+
function runtests()
12+
is_test(name) = startswith("$name", "test_")
13+
@testset "$name" for name in filter(is_test, names(@__MODULE__; all = true))
14+
getfield(@__MODULE__, name)()
15+
end
16+
end
17+
1118
function small_test_model()
1219
cc = [1.0, -2.0]
1320
cl = [0.0, 0.0]
@@ -26,24 +33,20 @@ function test_Direct_C_call()
2633
n_col = convert(Cint, size(colcost, 1))
2734
n_row = convert(Cint, size(rowlower, 1))
2835
n_nz = convert(Cint, size(aindex, 1))
29-
3036
colcost = convert(Array{Cdouble}, colcost)
3137
collower = convert(Array{Cdouble}, collower)
3238
colupper = convert(Array{Cdouble}, colupper)
33-
3439
rowlower = convert(Array{Cdouble}, rowlower)
3540
rowupper = convert(Array{Cdouble}, rowupper)
3641
matstart = convert(Array{Cint}, astart)
3742
matindex = convert(Array{Cint}, aindex)
3843
matvalue = convert(Array{Cdouble}, avalue)
39-
4044
colvalue, coldual =
4145
(Array{Cdouble,1}(undef, n_col), Array{Cdouble,1}(undef, n_col))
4246
rowvalue, rowdual =
4347
(Array{Cdouble,1}(undef, n_row), Array{Cdouble,1}(undef, n_row))
4448
colbasisstatus, rowbasisstatus =
4549
(Array{Cint,1}(undef, n_col), Array{Cint,1}(undef, n_row))
46-
4750
modelstatus = Ref{Cint}(42)
4851
status = HiGHS.Highs_lpCall(
4952
n_col,
@@ -70,33 +73,22 @@ function test_Direct_C_call()
7073
)
7174
@test status == 0
7275
@test modelstatus[] == HiGHS.kHighsModelStatusOptimal
76+
return
7377
end
7478

7579
function test_create()
7680
ptr = Highs_create()
7781
@test ptr != C_NULL
78-
7982
objective = Highs_getObjectiveValue(ptr)
8083
@test objective == 0.0
81-
8284
# model status, the second parameter is
8385
# bool scaled_model
8486
modelstatus = Highs_getModelStatus(ptr)
8587
@test modelstatus[] == 0 # uninitialized LP
86-
87-
return Highs_destroy(ptr)
88-
end
89-
90-
function runtests()
91-
for name in names(@__MODULE__; all = true)
92-
if startswith(string(name), "test_")
93-
@testset "$(name)" begin
94-
getfield(@__MODULE__, name)()
95-
end
96-
end
97-
end
88+
Highs_destroy(ptr)
89+
return
9890
end
9991

100-
end
92+
end # TestCHighs
10193

10294
TestCHighs.runtests()

test/test_moi_wrapper.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,9 @@ import HiGHS
1111
import MathOptInterface as MOI
1212

1313
function runtests()
14-
for name in names(@__MODULE__; all = true)
15-
if startswith("$name", "test_")
16-
@testset "$name" begin
17-
getfield(@__MODULE__, name)()
18-
end
19-
end
14+
is_test(name) = startswith("$name", "test_")
15+
@testset "$name" for name in filter(is_test, names(@__MODULE__; all = true))
16+
getfield(@__MODULE__, name)()
2017
end
2118
return
2219
end
@@ -50,6 +47,7 @@ function test_MOI_variable_count_and_empty()
5047
@test MOI.get(model, MOI.NumberOfVariables()) == 2
5148
MOI.empty!(model)
5249
@test MOI.get(model, MOI.NumberOfVariables()) == 0
50+
return
5351
end
5452

5553
function test_HiGHS_custom_options()
@@ -221,6 +219,7 @@ function test_SimplexIterations_BarrierIterations()
221219
# Not == 0 because HiGHS will use Simplex to clean-up occasionally
222220
@test MOI.get(model, MOI.SimplexIterations()) >= 0
223221
@test MOI.get(model, MOI.BarrierIterations()) > 0
222+
return
224223
end
225224

226225
function test_NodeCount()
@@ -311,6 +310,7 @@ function test_option_type()
311310
T = HiGHS._type_for_highs_option(k)
312311
@test x isa T
313312
end
313+
return
314314
end
315315

316316
function test_quadratic_sets_objective()
@@ -1346,6 +1346,6 @@ function test_relax_integrality_integer()
13461346
return
13471347
end
13481348

1349-
end # module
1349+
end # TestMOIHighs
13501350

13511351
TestMOIHighs.runtests()

test/test_runtests.jl

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,22 @@ import HiGHS
1111
import MathOptInterface as MOI
1212

1313
function runtests()
14-
for name in names(@__MODULE__; all = true)
15-
if startswith("$name", "test_")
16-
@testset "$name" begin
17-
getfield(@__MODULE__, name)()
18-
end
19-
end
14+
is_test(name) = startswith("$name", "test_")
15+
@testset "$name" for name in filter(is_test, names(@__MODULE__; all = true))
16+
getfield(@__MODULE__, name)()
2017
end
2118
return
2219
end
2320

2421
function test_runtests()
2522
model = MOI.Bridges.full_bridge_optimizer(HiGHS.Optimizer(), Float64)
2623
MOI.set(model, MOI.Silent(), true)
27-
# Turn presolve off so that we generate infeasibility certificates. This is
28-
# a temporary work-around until we fix this upstream in HiGHS.
29-
MOI.set(model, MOI.RawOptimizerAttribute("presolve"), "off")
24+
MOI.set(model, MOI.RawOptimizerAttribute("parallel"), "on")
3025
# Slightly loosen tolerances, particularly for QP tests
3126
MOI.Test.runtests(model, MOI.Test.Config(; atol = 1e-7))
3227
return
3328
end
3429

35-
end # module
30+
end # TestRunTests
3631

3732
TestRunTests.runtests()

test/test_runtests_cache.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,9 @@ import HiGHS
1111
import MathOptInterface as MOI
1212

1313
function runtests()
14-
for name in names(@__MODULE__; all = true)
15-
if startswith("$name", "test_")
16-
@testset "$name" begin
17-
getfield(@__MODULE__, name)()
18-
end
19-
end
14+
is_test(name) = startswith("$name", "test_")
15+
@testset "$name" for name in filter(is_test, names(@__MODULE__; all = true))
16+
getfield(@__MODULE__, name)()
2017
end
2118
return
2219
end
@@ -30,11 +27,12 @@ function test_runtests_cache()
3027
Float64,
3128
)
3229
MOI.set(model, MOI.Silent(), true)
30+
MOI.set(model, MOI.RawOptimizerAttribute("parallel"), "on")
3331
# Slightly loosen tolerances, particularly for QP tests
3432
MOI.Test.runtests(model, MOI.Test.Config(; atol = 1e-7))
3533
return
3634
end
3735

38-
end # module
36+
end # TestRunTestsCache
3937

4038
TestRunTestsCache.runtests()

0 commit comments

Comments
 (0)