Skip to content

Commit 7d888be

Browse files
authored
Support HiGHS v1.7.0 (#205)
1 parent 0bd029b commit 7d888be

File tree

3 files changed

+159
-13
lines changed

3 files changed

+159
-13
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
99
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1010

1111
[compat]
12-
HiGHS_jll = "=1.5.1, =1.5.3, =1.6.0"
12+
HiGHS_jll = "=1.5.1, =1.5.3, =1.6.0, =1.7.0"
1313
MathOptInterface = "1.21"
1414
PrecompileTools = "1"
1515
SparseArrays = "1.6"

gen/Project.toml

+1-1
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.17"
7-
HiGHS_jll = "1.6.0"
7+
HiGHS_jll = "1.7.0"

src/gen/libhighs.jl

+157-11
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,30 @@ struct HighsCallbackDataOut
1313
running_time::Cdouble
1414
simplex_iteration_count::HighsInt
1515
ipm_iteration_count::HighsInt
16+
pdlp_iteration_count::HighsInt
1617
objective_function_value::Cdouble
1718
mip_node_count::Int64
1819
mip_primal_bound::Cdouble
1920
mip_dual_bound::Cdouble
2021
mip_gap::Cdouble
2122
mip_solution::Ptr{Cdouble}
23+
cutpool_num_col::HighsInt
24+
cutpool_num_cut::HighsInt
25+
cutpool_num_nz::HighsInt
26+
cutpool_start::Ptr{HighsInt}
27+
cutpool_index::Ptr{HighsInt}
28+
cutpool_value::Ptr{Cdouble}
29+
cutpool_lower::Ptr{Cdouble}
30+
cutpool_upper::Ptr{Cdouble}
2231
end
2332

2433
struct HighsCallbackDataIn
2534
user_interrupt::Cint
2635
end
2736

37+
# typedef void ( * HighsCCallbackType ) ( int , const char * , const HighsCallbackDataOut * , HighsCallbackDataIn * , void * )
38+
const HighsCCallbackType = Ptr{Cvoid}
39+
2840
"""
2941
Highs_lpCall(num_col, num_row, num_nz, a_format, sense, offset, col_cost, col_lower, col_upper, row_lower, row_upper, a_start, a_index, a_value, col_value, col_dual, row_value, row_dual, col_basis_status, row_basis_status, model_status)
3042
@@ -271,6 +283,20 @@ function Highs_clearSolver(highs)
271283
ccall((:Highs_clearSolver, libhighs), HighsInt, (Ptr{Cvoid},), highs)
272284
end
273285

286+
"""
287+
Highs_presolve(highs)
288+
289+
Presolve a model.
290+
291+
### Parameters
292+
* `highs`: A pointer to the Highs instance.
293+
### Returns
294+
A `kHighsStatus` constant indicating whether the call succeeded.
295+
"""
296+
function Highs_presolve(highs)
297+
ccall((:Highs_presolve, libhighs), HighsInt, (Ptr{Cvoid},), highs)
298+
end
299+
274300
"""
275301
Highs_run(highs)
276302
@@ -285,6 +311,23 @@ function Highs_run(highs)
285311
ccall((:Highs_run, libhighs), HighsInt, (Ptr{Cvoid},), highs)
286312
end
287313

314+
"""
315+
Highs_postsolve(highs, col_value, col_dual, row_dual)
316+
317+
Postsolve a model using a primal (and possibly dual) solution.
318+
319+
### Parameters
320+
* `highs`: A pointer to the Highs instance.
321+
* `col_value`: An array of length [num\\_col] with the column solution values.
322+
* `col_dual`: An array of length [num\\_col] with the column dual values, or a null pointer if not known.
323+
* `row_dual`: An array of length [num\\_row] with the row dual values, or a null pointer if not known.
324+
### Returns
325+
A `kHighsStatus` constant indicating whether the call succeeded.
326+
"""
327+
function Highs_postsolve(highs, col_value, col_dual, row_dual)
328+
ccall((:Highs_postsolve, libhighs), HighsInt, (Ptr{Cvoid}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}), highs, col_value, col_dual, row_dual)
329+
end
330+
288331
"""
289332
Highs_writeSolution(highs, filename)
290333
@@ -307,7 +350,7 @@ end
307350
308351
Write the solution information (including dual and basis status, if available) to a file in a human-readable format.
309352
310-
The method identical to [`Highs_writeSolution`](@ref), except that the printout is in a human-readiable format.
353+
The method identical to [`Highs_writeSolution`](@ref), except that the printout is in a human-readable format.
311354
312355
### Parameters
313356
* `highs`: A pointer to the Highs instance.
@@ -373,7 +416,7 @@ Pass a model to HiGHS in a single function call. This is faster than constructin
373416
* `q_start`: The Hessian matrix is provided in the same format as the constraint matrix, using `q_start`, `q_index`, and `q_value` in the place of `a_start`, `a_index`, and `a_value`. If the model is linear, pass NULL.
374417
* `q_index`: An array of length [q\\_num\\_nz] with indices of matrix entries. If the model is linear, pass NULL.
375418
* `q_value`: An array of length [q\\_num\\_nz] with values of matrix entries. If the model is linear, pass NULL.
376-
* `integrality`: An array of length [num\\_col] containing a `kHighsVarType` consatnt for each column.
419+
* `integrality`: An array of length [num\\_col] containing a `kHighsVarType` constant for each column.
377420
### Returns
378421
A `kHighsStatus` constant indicating whether the call succeeded.
379422
"""
@@ -991,9 +1034,9 @@ The arrays `solution_vector` and `solution_index` must have an allocated length
9911034
### Parameters
9921035
* `highs`: A pointer to the Highs instance.
9931036
* `rhs`: The right-hand side vector ``b``
994-
* `solution_vector`: An array of length [num\\_row] in whcih to store the values of the non-zero elements.
1037+
* `solution_vector`: An array of length [num\\_row] in which to store the values of the non-zero elements.
9951038
* `solution_num_nz`: The number of non-zeros in the solution.
996-
* `solution_index`: An array of length [num\\_row] in whcih to store the indices of the non-zero elements.
1039+
* `solution_index`: An array of length [num\\_row] in which to store the indices of the non-zero elements.
9971040
### Returns
9981041
A `kHighsStatus` constant indicating whether the call succeeded.
9991042
"""
@@ -1108,7 +1151,7 @@ Set the callback method to use for HiGHS
11081151
A `kHighsStatus` constant indicating whether the call succeeded.
11091152
"""
11101153
function Highs_setCallback(highs, user_callback, user_callback_data)
1111-
ccall((:Highs_setCallback, libhighs), HighsInt, (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}), highs, user_callback, user_callback_data)
1154+
ccall((:Highs_setCallback, libhighs), HighsInt, (Ptr{Cvoid}, HighsCCallbackType, Ptr{Cvoid}), highs, user_callback, user_callback_data)
11121155
end
11131156

11141157
"""
@@ -1384,6 +1427,20 @@ function Highs_changeColsIntegralityByMask(highs, mask, integrality)
13841427
ccall((:Highs_changeColsIntegralityByMask, libhighs), HighsInt, (Ptr{Cvoid}, Ptr{HighsInt}, Ptr{HighsInt}), highs, mask, integrality)
13851428
end
13861429

1430+
"""
1431+
Highs_clearIntegrality(highs)
1432+
1433+
Clear the integrality of all columns
1434+
1435+
### Parameters
1436+
* `highs`: A pointer to the Highs instance.
1437+
### Returns
1438+
A `kHighsStatus` constant indicating whether the call succeeded.
1439+
"""
1440+
function Highs_clearIntegrality(highs)
1441+
ccall((:Highs_clearIntegrality, libhighs), HighsInt, (Ptr{Cvoid},), highs)
1442+
end
1443+
13871444
"""
13881445
Highs_changeColCost(highs, col, cost)
13891446
@@ -1965,6 +2022,20 @@ function Highs_getInfinity(highs)
19652022
ccall((:Highs_getInfinity, libhighs), Cdouble, (Ptr{Cvoid},), highs)
19662023
end
19672024

2025+
"""
2026+
Highs_getSizeofHighsInt(highs)
2027+
2028+
Return the size of integers used by HiGHS.
2029+
2030+
### Parameters
2031+
* `highs`: A pointer to the Highs instance.
2032+
### Returns
2033+
The size of integers used by HiGHS.
2034+
"""
2035+
function Highs_getSizeofHighsInt(highs)
2036+
ccall((:Highs_getSizeofHighsInt, libhighs), HighsInt, (Ptr{Cvoid},), highs)
2037+
end
2038+
19682039
"""
19692040
Highs_getNumCol(highs)
19702041
@@ -2021,6 +2092,48 @@ function Highs_getHessianNumNz(highs)
20212092
ccall((:Highs_getHessianNumNz, libhighs), HighsInt, (Ptr{Cvoid},), highs)
20222093
end
20232094

2095+
"""
2096+
Highs_getPresolvedNumCol(highs)
2097+
2098+
Return the number of columns in the presolved model.
2099+
2100+
### Parameters
2101+
* `highs`: A pointer to the Highs instance.
2102+
### Returns
2103+
The number of columns in the presolved model.
2104+
"""
2105+
function Highs_getPresolvedNumCol(highs)
2106+
ccall((:Highs_getPresolvedNumCol, libhighs), HighsInt, (Ptr{Cvoid},), highs)
2107+
end
2108+
2109+
"""
2110+
Highs_getPresolvedNumRow(highs)
2111+
2112+
Return the number of rows in the presolved model.
2113+
2114+
### Parameters
2115+
* `highs`: A pointer to the Highs instance.
2116+
### Returns
2117+
The number of rows in the presolved model.
2118+
"""
2119+
function Highs_getPresolvedNumRow(highs)
2120+
ccall((:Highs_getPresolvedNumRow, libhighs), HighsInt, (Ptr{Cvoid},), highs)
2121+
end
2122+
2123+
"""
2124+
Highs_getPresolvedNumNz(highs)
2125+
2126+
Return the number of nonzeros in the constraint matrix of the presolved model.
2127+
2128+
### Parameters
2129+
* `highs`: A pointer to the Highs instance.
2130+
### Returns
2131+
The number of nonzeros in the constraint matrix of the presolved model.
2132+
"""
2133+
function Highs_getPresolvedNumNz(highs)
2134+
ccall((:Highs_getPresolvedNumNz, libhighs), HighsInt, (Ptr{Cvoid},), highs)
2135+
end
2136+
20242137
"""
20252138
Highs_getModel(highs, a_format, q_format, num_col, num_row, num_nz, hessian_num_nz, sense, offset, col_cost, col_lower, col_upper, row_lower, row_upper, a_start, a_index, a_value, q_start, q_index, q_value, integrality)
20262139
@@ -2037,6 +2150,38 @@ function Highs_getModel(highs, a_format, q_format, num_col, num_row, num_nz, hes
20372150
ccall((:Highs_getModel, libhighs), HighsInt, (Ptr{Cvoid}, HighsInt, HighsInt, Ptr{HighsInt}, Ptr{HighsInt}, Ptr{HighsInt}, Ptr{HighsInt}, Ptr{HighsInt}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{HighsInt}, Ptr{HighsInt}, Ptr{Cdouble}, Ptr{HighsInt}, Ptr{HighsInt}, Ptr{Cdouble}, Ptr{HighsInt}), highs, a_format, q_format, num_col, num_row, num_nz, hessian_num_nz, sense, offset, col_cost, col_lower, col_upper, row_lower, row_upper, a_start, a_index, a_value, q_start, q_index, q_value, integrality)
20382151
end
20392152

2153+
"""
2154+
Highs_getLp(highs, a_format, num_col, num_row, num_nz, sense, offset, col_cost, col_lower, col_upper, row_lower, row_upper, a_start, a_index, a_value, integrality)
2155+
2156+
Get the data from a HiGHS LP.
2157+
2158+
The input arguments have the same meaning (in a different order) to those used in [`Highs_passModel`](@ref).
2159+
2160+
Note that all arrays must be pre-allocated to the correct size before calling [`Highs_getModel`](@ref). Use the following query methods to check the appropriate size: - [`Highs_getNumCol`](@ref) - [`Highs_getNumRow`](@ref) - [`Highs_getNumNz`](@ref)
2161+
2162+
### Returns
2163+
A `kHighsStatus` constant indicating whether the call succeeded.
2164+
"""
2165+
function Highs_getLp(highs, a_format, num_col, num_row, num_nz, sense, offset, col_cost, col_lower, col_upper, row_lower, row_upper, a_start, a_index, a_value, integrality)
2166+
ccall((:Highs_getLp, libhighs), HighsInt, (Ptr{Cvoid}, HighsInt, Ptr{HighsInt}, Ptr{HighsInt}, Ptr{HighsInt}, Ptr{HighsInt}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{HighsInt}, Ptr{HighsInt}, Ptr{Cdouble}, Ptr{HighsInt}), highs, a_format, num_col, num_row, num_nz, sense, offset, col_cost, col_lower, col_upper, row_lower, row_upper, a_start, a_index, a_value, integrality)
2167+
end
2168+
2169+
"""
2170+
Highs_getPresolvedLp(highs, a_format, num_col, num_row, num_nz, sense, offset, col_cost, col_lower, col_upper, row_lower, row_upper, a_start, a_index, a_value, integrality)
2171+
2172+
Get the data from a HiGHS presolved LP.
2173+
2174+
The input arguments have the same meaning (in a different order) to those used in [`Highs_passModel`](@ref).
2175+
2176+
Note that all arrays must be pre-allocated to the correct size before calling [`Highs_getModel`](@ref). Use the following query methods to check the appropriate size: - [`Highs_getPresolvedNumCol`](@ref) - [`Highs_getPresolvedNumRow`](@ref) - [`Highs_getPresolvedNumNz`](@ref)
2177+
2178+
### Returns
2179+
A `kHighsStatus` constant indicating whether the call succeeded.
2180+
"""
2181+
function Highs_getPresolvedLp(highs, a_format, num_col, num_row, num_nz, sense, offset, col_cost, col_lower, col_upper, row_lower, row_upper, a_start, a_index, a_value, integrality)
2182+
ccall((:Highs_getPresolvedLp, libhighs), HighsInt, (Ptr{Cvoid}, HighsInt, Ptr{HighsInt}, Ptr{HighsInt}, Ptr{HighsInt}, Ptr{HighsInt}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{HighsInt}, Ptr{HighsInt}, Ptr{Cdouble}, Ptr{HighsInt}), highs, a_format, num_col, num_row, num_nz, sense, offset, col_cost, col_lower, col_upper, row_lower, row_upper, a_start, a_index, a_value, integrality)
2183+
end
2184+
20402185
"""
20412186
Highs_crossover(highs, num_col, num_row, col_value, col_dual, row_dual)
20422187
@@ -2059,7 +2204,7 @@ end
20592204
"""
20602205
Highs_getRanging(highs, col_cost_up_value, col_cost_up_objective, col_cost_up_in_var, col_cost_up_ou_var, col_cost_dn_value, col_cost_dn_objective, col_cost_dn_in_var, col_cost_dn_ou_var, col_bound_up_value, col_bound_up_objective, col_bound_up_in_var, col_bound_up_ou_var, col_bound_dn_value, col_bound_dn_objective, col_bound_dn_in_var, col_bound_dn_ou_var, row_bound_up_value, row_bound_up_objective, row_bound_up_in_var, row_bound_up_ou_var, row_bound_dn_value, row_bound_dn_objective, row_bound_dn_in_var, row_bound_dn_ou_var)
20612206
2062-
Compute the ranging information for all costs and bounds. For nonbasic variables the ranging informaiton is relative to the active bound. For basic variables the ranging information relates to...
2207+
Compute the ranging information for all costs and bounds. For nonbasic variables the ranging information is relative to the active bound. For basic variables the ranging information relates to...
20632208
20642209
For any values that are not required, pass NULL.
20652210
@@ -2222,13 +2367,13 @@ const CMAKE_BUILD_TYPE = "Release"
22222367

22232368
const CMAKE_INSTALL_PREFIX = "/workspace/destdir"
22242369

2225-
const HIGHS_GITHASH = "21da9b90e"
2370+
const HIGHS_GITHASH = "50670fd4c"
22262371

22272372
const HIGHS_COMPILATION_DATE = "1970-01-01"
22282373

22292374
const HIGHS_VERSION_MAJOR = 1
22302375

2231-
const HIGHS_VERSION_MINOR = 6
2376+
const HIGHS_VERSION_MINOR = 7
22322377

22332378
const HIGHS_VERSION_PATCH = 0
22342379

@@ -2297,6 +2442,7 @@ const kHighsBasisStatusNonbasic = HighsInt(4)
22972442
const kHighsCallbackLogging = HighsInt(0)
22982443
const kHighsCallbackSimplexInterrupt = HighsInt(1)
22992444
const kHighsCallbackIpmInterrupt = HighsInt(2)
2300-
const kHighsCallbackMipImprovingSolution = HighsInt(3)
2301-
const kHighsCallbackMipLogging = HighsInt(4)
2302-
const kHighsCallbackMipInterrupt = HighsInt(5)
2445+
const kHighsCallbackMipSolution = HighsInt(3)
2446+
const kHighsCallbackMipImprovingSolution = HighsInt(4)
2447+
const kHighsCallbackMipLogging = HighsInt(5)
2448+
const kHighsCallbackMipInterrupt = HighsInt(6)

0 commit comments

Comments
 (0)