Skip to content

Commit

Permalink
Support HiGHS v1.7.0 (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Mar 7, 2024
1 parent 0bd029b commit 7d888be
Show file tree
Hide file tree
Showing 3 changed files with 159 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[compat]
HiGHS_jll = "=1.5.1, =1.5.3, =1.6.0"
HiGHS_jll = "=1.5.1, =1.5.3, =1.6.0, =1.7.0"
MathOptInterface = "1.21"
PrecompileTools = "1"
SparseArrays = "1.6"
Expand Down
2 changes: 1 addition & 1 deletion gen/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ HiGHS_jll = "8fd58aa0-07eb-5a78-9b36-339c94fd15ea"

[compat]
Clang = "0.17"
HiGHS_jll = "1.6.0"
HiGHS_jll = "1.7.0"
168 changes: 157 additions & 11 deletions src/gen/libhighs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,30 @@ struct HighsCallbackDataOut
running_time::Cdouble
simplex_iteration_count::HighsInt
ipm_iteration_count::HighsInt
pdlp_iteration_count::HighsInt
objective_function_value::Cdouble
mip_node_count::Int64
mip_primal_bound::Cdouble
mip_dual_bound::Cdouble
mip_gap::Cdouble
mip_solution::Ptr{Cdouble}
cutpool_num_col::HighsInt
cutpool_num_cut::HighsInt
cutpool_num_nz::HighsInt
cutpool_start::Ptr{HighsInt}
cutpool_index::Ptr{HighsInt}
cutpool_value::Ptr{Cdouble}
cutpool_lower::Ptr{Cdouble}
cutpool_upper::Ptr{Cdouble}
end

struct HighsCallbackDataIn
user_interrupt::Cint
end

# typedef void ( * HighsCCallbackType ) ( int , const char * , const HighsCallbackDataOut * , HighsCallbackDataIn * , void * )
const HighsCCallbackType = Ptr{Cvoid}

"""
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)
Expand Down Expand Up @@ -271,6 +283,20 @@ function Highs_clearSolver(highs)
ccall((:Highs_clearSolver, libhighs), HighsInt, (Ptr{Cvoid},), highs)
end

"""
Highs_presolve(highs)
Presolve a model.
### Parameters
* `highs`: A pointer to the Highs instance.
### Returns
A `kHighsStatus` constant indicating whether the call succeeded.
"""
function Highs_presolve(highs)
ccall((:Highs_presolve, libhighs), HighsInt, (Ptr{Cvoid},), highs)
end

"""
Highs_run(highs)
Expand All @@ -285,6 +311,23 @@ function Highs_run(highs)
ccall((:Highs_run, libhighs), HighsInt, (Ptr{Cvoid},), highs)
end

"""
Highs_postsolve(highs, col_value, col_dual, row_dual)
Postsolve a model using a primal (and possibly dual) solution.
### Parameters
* `highs`: A pointer to the Highs instance.
* `col_value`: An array of length [num\\_col] with the column solution values.
* `col_dual`: An array of length [num\\_col] with the column dual values, or a null pointer if not known.
* `row_dual`: An array of length [num\\_row] with the row dual values, or a null pointer if not known.
### Returns
A `kHighsStatus` constant indicating whether the call succeeded.
"""
function Highs_postsolve(highs, col_value, col_dual, row_dual)
ccall((:Highs_postsolve, libhighs), HighsInt, (Ptr{Cvoid}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}), highs, col_value, col_dual, row_dual)
end

"""
Highs_writeSolution(highs, filename)
Expand All @@ -307,7 +350,7 @@ end
Write the solution information (including dual and basis status, if available) to a file in a human-readable format.
The method identical to [`Highs_writeSolution`](@ref), except that the printout is in a human-readiable format.
The method identical to [`Highs_writeSolution`](@ref), except that the printout is in a human-readable format.
### Parameters
* `highs`: A pointer to the Highs instance.
Expand Down Expand Up @@ -373,7 +416,7 @@ Pass a model to HiGHS in a single function call. This is faster than constructin
* `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.
* `q_index`: An array of length [q\\_num\\_nz] with indices of matrix entries. If the model is linear, pass NULL.
* `q_value`: An array of length [q\\_num\\_nz] with values of matrix entries. If the model is linear, pass NULL.
* `integrality`: An array of length [num\\_col] containing a `kHighsVarType` consatnt for each column.
* `integrality`: An array of length [num\\_col] containing a `kHighsVarType` constant for each column.
### Returns
A `kHighsStatus` constant indicating whether the call succeeded.
"""
Expand Down Expand Up @@ -991,9 +1034,9 @@ The arrays `solution_vector` and `solution_index` must have an allocated length
### Parameters
* `highs`: A pointer to the Highs instance.
* `rhs`: The right-hand side vector ``b``
* `solution_vector`: An array of length [num\\_row] in whcih to store the values of the non-zero elements.
* `solution_vector`: An array of length [num\\_row] in which to store the values of the non-zero elements.
* `solution_num_nz`: The number of non-zeros in the solution.
* `solution_index`: An array of length [num\\_row] in whcih to store the indices of the non-zero elements.
* `solution_index`: An array of length [num\\_row] in which to store the indices of the non-zero elements.
### Returns
A `kHighsStatus` constant indicating whether the call succeeded.
"""
Expand Down Expand Up @@ -1108,7 +1151,7 @@ Set the callback method to use for HiGHS
A `kHighsStatus` constant indicating whether the call succeeded.
"""
function Highs_setCallback(highs, user_callback, user_callback_data)
ccall((:Highs_setCallback, libhighs), HighsInt, (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}), highs, user_callback, user_callback_data)
ccall((:Highs_setCallback, libhighs), HighsInt, (Ptr{Cvoid}, HighsCCallbackType, Ptr{Cvoid}), highs, user_callback, user_callback_data)
end

"""
Expand Down Expand Up @@ -1384,6 +1427,20 @@ function Highs_changeColsIntegralityByMask(highs, mask, integrality)
ccall((:Highs_changeColsIntegralityByMask, libhighs), HighsInt, (Ptr{Cvoid}, Ptr{HighsInt}, Ptr{HighsInt}), highs, mask, integrality)
end

"""
Highs_clearIntegrality(highs)
Clear the integrality of all columns
### Parameters
* `highs`: A pointer to the Highs instance.
### Returns
A `kHighsStatus` constant indicating whether the call succeeded.
"""
function Highs_clearIntegrality(highs)
ccall((:Highs_clearIntegrality, libhighs), HighsInt, (Ptr{Cvoid},), highs)
end

"""
Highs_changeColCost(highs, col, cost)
Expand Down Expand Up @@ -1965,6 +2022,20 @@ function Highs_getInfinity(highs)
ccall((:Highs_getInfinity, libhighs), Cdouble, (Ptr{Cvoid},), highs)
end

"""
Highs_getSizeofHighsInt(highs)
Return the size of integers used by HiGHS.
### Parameters
* `highs`: A pointer to the Highs instance.
### Returns
The size of integers used by HiGHS.
"""
function Highs_getSizeofHighsInt(highs)
ccall((:Highs_getSizeofHighsInt, libhighs), HighsInt, (Ptr{Cvoid},), highs)
end

"""
Highs_getNumCol(highs)
Expand Down Expand Up @@ -2021,6 +2092,48 @@ function Highs_getHessianNumNz(highs)
ccall((:Highs_getHessianNumNz, libhighs), HighsInt, (Ptr{Cvoid},), highs)
end

"""
Highs_getPresolvedNumCol(highs)
Return the number of columns in the presolved model.
### Parameters
* `highs`: A pointer to the Highs instance.
### Returns
The number of columns in the presolved model.
"""
function Highs_getPresolvedNumCol(highs)
ccall((:Highs_getPresolvedNumCol, libhighs), HighsInt, (Ptr{Cvoid},), highs)
end

"""
Highs_getPresolvedNumRow(highs)
Return the number of rows in the presolved model.
### Parameters
* `highs`: A pointer to the Highs instance.
### Returns
The number of rows in the presolved model.
"""
function Highs_getPresolvedNumRow(highs)
ccall((:Highs_getPresolvedNumRow, libhighs), HighsInt, (Ptr{Cvoid},), highs)
end

"""
Highs_getPresolvedNumNz(highs)
Return the number of nonzeros in the constraint matrix of the presolved model.
### Parameters
* `highs`: A pointer to the Highs instance.
### Returns
The number of nonzeros in the constraint matrix of the presolved model.
"""
function Highs_getPresolvedNumNz(highs)
ccall((:Highs_getPresolvedNumNz, libhighs), HighsInt, (Ptr{Cvoid},), highs)
end

"""
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)
Expand All @@ -2037,6 +2150,38 @@ function Highs_getModel(highs, a_format, q_format, num_col, num_row, num_nz, hes
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)
end

"""
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)
Get the data from a HiGHS LP.
The input arguments have the same meaning (in a different order) to those used in [`Highs_passModel`](@ref).
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)
### Returns
A `kHighsStatus` constant indicating whether the call succeeded.
"""
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)
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)
end

"""
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)
Get the data from a HiGHS presolved LP.
The input arguments have the same meaning (in a different order) to those used in [`Highs_passModel`](@ref).
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)
### Returns
A `kHighsStatus` constant indicating whether the call succeeded.
"""
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)
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)
end

"""
Highs_crossover(highs, num_col, num_row, col_value, col_dual, row_dual)
Expand All @@ -2059,7 +2204,7 @@ end
"""
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)
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...
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...
For any values that are not required, pass NULL.
Expand Down Expand Up @@ -2222,13 +2367,13 @@ const CMAKE_BUILD_TYPE = "Release"

const CMAKE_INSTALL_PREFIX = "/workspace/destdir"

const HIGHS_GITHASH = "21da9b90e"
const HIGHS_GITHASH = "50670fd4c"

const HIGHS_COMPILATION_DATE = "1970-01-01"

const HIGHS_VERSION_MAJOR = 1

const HIGHS_VERSION_MINOR = 6
const HIGHS_VERSION_MINOR = 7

const HIGHS_VERSION_PATCH = 0

Expand Down Expand Up @@ -2297,6 +2442,7 @@ const kHighsBasisStatusNonbasic = HighsInt(4)
const kHighsCallbackLogging = HighsInt(0)
const kHighsCallbackSimplexInterrupt = HighsInt(1)
const kHighsCallbackIpmInterrupt = HighsInt(2)
const kHighsCallbackMipImprovingSolution = HighsInt(3)
const kHighsCallbackMipLogging = HighsInt(4)
const kHighsCallbackMipInterrupt = HighsInt(5)
const kHighsCallbackMipSolution = HighsInt(3)
const kHighsCallbackMipImprovingSolution = HighsInt(4)
const kHighsCallbackMipLogging = HighsInt(5)
const kHighsCallbackMipInterrupt = HighsInt(6)

0 comments on commit 7d888be

Please sign in to comment.