From fbf94b5d78a0bb2cf9351141442b123326d6c5e6 Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Fri, 3 Jan 2025 12:47:52 +1300 Subject: [PATCH] Add support for HiGHS@1.9.0 (#261) --- Project.toml | 2 +- gen/Project.toml | 2 +- src/gen/libhighs.jl | 78 ++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 75 insertions(+), 7 deletions(-) diff --git a/Project.toml b/Project.toml index db7aa57..09e57fc 100644 --- a/Project.toml +++ b/Project.toml @@ -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, =1.7.0, =1.7.1, =1.7.2, =1.8.0, =1.8.1" +HiGHS_jll = "=1.5.1, =1.5.3, =1.6.0, =1.7.0, =1.7.1, =1.7.2, =1.8.0, =1.8.1, =1.9.0" MathOptInterface = "1.34" PrecompileTools = "1" SparseArrays = "1.6" diff --git a/gen/Project.toml b/gen/Project.toml index 15c17a4..783e3db 100644 --- a/gen/Project.toml +++ b/gen/Project.toml @@ -4,4 +4,4 @@ HiGHS_jll = "8fd58aa0-07eb-5a78-9b36-339c94fd15ea" [compat] Clang = "0.17" -HiGHS_jll = "1.7.0" +HiGHS_jll = "1.9.0" diff --git a/src/gen/libhighs.jl b/src/gen/libhighs.jl index 37edecb..1edf23f 100644 --- a/src/gen/libhighs.jl +++ b/src/gen/libhighs.jl @@ -453,6 +453,60 @@ function Highs_passHessian(highs, dim, num_nz, format, start, index, value) ccall((:Highs_passHessian, libhighs), HighsInt, (Ptr{Cvoid}, HighsInt, HighsInt, HighsInt, Ptr{HighsInt}, Ptr{HighsInt}, Ptr{Cdouble}), highs, dim, num_nz, format, start, index, value) end +""" + Highs_passLinearObjectives(highs, num_linear_objective, weight, offset, coefficients, abs_tolerance, rel_tolerance, priority) + +Passes multiple linear objective data to HiGHS, clearing any such data already in HiGHS + +### Parameters +* `highs`: A pointer to the Highs instance. +* `weight`: A pointer to the weights of the linear objective, with its positive/negative sign determining whether it is minimized or maximized during lexicographic optimization +* `offset`: A pointer to the objective offsets +* `coefficients`: A pointer to the objective coefficients +* `abs_tolerance`: A pointer to the absolute tolerances used when constructing objective constraints during lexicographic optimization +* `rel_tolerance`: A pointer to the relative tolerances used when constructing objective constraints during lexicographic optimization +* `priority`: A pointer to the priorities of the objectives during lexicographic optimization +### Returns +A `kHighsStatus` constant indicating whether the call succeeded. +""" +function Highs_passLinearObjectives(highs, num_linear_objective, weight, offset, coefficients, abs_tolerance, rel_tolerance, priority) + ccall((:Highs_passLinearObjectives, libhighs), HighsInt, (Ptr{Cvoid}, HighsInt, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{HighsInt}), highs, num_linear_objective, weight, offset, coefficients, abs_tolerance, rel_tolerance, priority) +end + +""" + Highs_addLinearObjective(highs, weight, offset, coefficients, abs_tolerance, rel_tolerance, priority) + +Adds linear objective data to HiGHS + +### Parameters +* `highs`: A pointer to the Highs instance. +* `weight`: The weight of the linear objective, with its positive/negative sign determining whether it is minimized or maximized during lexicographic optimization +* `offset`: The objective offset +* `coefficients`: A pointer to the objective coefficients +* `abs_tolerance`: The absolute tolerance used when constructing an objective constraint during lexicographic optimization +* `rel_tolerance`: The relative tolerance used when constructing an objective constraint during lexicographic optimization +* `priority`: The priority of this objective during lexicographic optimization +### Returns +A `kHighsStatus` constant indicating whether the call succeeded. +""" +function Highs_addLinearObjective(highs, weight, offset, coefficients, abs_tolerance, rel_tolerance, priority) + ccall((:Highs_addLinearObjective, libhighs), HighsInt, (Ptr{Cvoid}, Cdouble, Cdouble, Ptr{Cdouble}, Cdouble, Cdouble, HighsInt), highs, weight, offset, coefficients, abs_tolerance, rel_tolerance, priority) +end + +""" + Highs_clearLinearObjectives(highs) + +Clears any multiple linear objective data in HiGHS + +### Parameters +* `highs`: A pointer to the Highs instance. +### Returns +A `kHighsStatus` constant indicating whether the call succeeded. +""" +function Highs_clearLinearObjectives(highs) + ccall((:Highs_clearLinearObjectives, libhighs), HighsInt, (Ptr{Cvoid},), highs) +end + """ Highs_passRowName(highs, row, name) @@ -916,11 +970,11 @@ end """ Highs_getDualRay(highs, has_dual_ray, dual_ray_value) -Get an unbounded dual ray that is a certificate of primal infeasibility. +Indicates whether a dual ray that is a certificate of primal infeasibility currently exists, and (at the expense of solving an LP) gets it if it does not and dual\\_ray\\_value is not nullptr. ### Parameters * `highs`: A pointer to the Highs instance. -* `has_dual_ray`: A pointer to an int to store 1 if the dual ray exists. +* `has_dual_ray`: A pointer to an int to store 1 if a dual ray currently exists. * `dual_ray_value`: An array of length [num\\_row] filled with the unbounded ray. ### Returns A `kHighsStatus` constant indicating whether the call succeeded. @@ -929,10 +983,24 @@ function Highs_getDualRay(highs, has_dual_ray, dual_ray_value) ccall((:Highs_getDualRay, libhighs), HighsInt, (Ptr{Cvoid}, Ptr{HighsInt}, Ptr{Cdouble}), highs, has_dual_ray, dual_ray_value) end +""" + Highs_getDualUnboundednessDirection(highs, has_dual_unboundedness_direction, dual_unboundedness_direction_value) + +Indicates whether a dual unboundedness direction (corresponding to a certificate of primal infeasibility) exists, and (at the expense of solving an LP) gets it if it does not and dual\\_unboundedness\\_direction is not nullptr + +### Parameters +* `highs`: A pointer to the Highs instance. +* `has_dual_unboundedness_direction`: A pointer to an int to store 1 if the dual unboundedness direction exists. +* `dual_unboundedness_direction_value`: An array of length [num\\_col] filled with the unboundedness direction. +""" +function Highs_getDualUnboundednessDirection(highs, has_dual_unboundedness_direction, dual_unboundedness_direction_value) + ccall((:Highs_getDualUnboundednessDirection, libhighs), HighsInt, (Ptr{Cvoid}, Ptr{HighsInt}, Ptr{Cdouble}), highs, has_dual_unboundedness_direction, dual_unboundedness_direction_value) +end + """ Highs_getPrimalRay(highs, has_primal_ray, primal_ray_value) -Get an unbounded primal ray that is a certificate of dual infeasibility. +Indicates whether a primal ray that is a certificate of primal unboundedness currently exists, and (at the expense of solving an LP) gets it if it does not and primal\\_ray\\_value is not nullptr. ### Parameters * `highs`: A pointer to the Highs instance. @@ -2457,11 +2525,11 @@ const CMAKE_BUILD_TYPE = "Release" const CMAKE_INSTALL_PREFIX = "/workspace/destdir" -const HIGHS_GITHASH = "fcfb53414" +const HIGHS_GITHASH = "66f735e60" const HIGHS_VERSION_MAJOR = 1 -const HIGHS_VERSION_MINOR = 8 +const HIGHS_VERSION_MINOR = 9 const HIGHS_VERSION_PATCH = 0