From 6e9f9bdf6421d838586066570dbffc4c407395be Mon Sep 17 00:00:00 2001 From: JAJHall Date: Sun, 14 Jul 2024 18:11:18 +0100 Subject: [PATCH] Added Highs_setSparseSolution to C API --- src/interfaces/highs_c_api.cpp | 5 +++++ src/interfaces/highs_c_api.h | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/interfaces/highs_c_api.cpp b/src/interfaces/highs_c_api.cpp index 0642b73283..59b73668b6 100644 --- a/src/interfaces/highs_c_api.cpp +++ b/src/interfaces/highs_c_api.cpp @@ -668,6 +668,11 @@ HighsInt Highs_setSolution(void* highs, const double* col_value, return (HighsInt)((Highs*)highs)->setSolution(solution); } +HighsInt Highs_setSparseSolution(void* highs, const HighsInt num_entries, + const HighsInt* index, const double* value) { + return (HighsInt)((Highs*)highs)->setSolution(num_entries, index, value); +} + HighsInt Highs_setCallback(void* highs, HighsCCallbackType user_callback, void* user_callback_data) { auto status = static_cast(highs)->setCallback(user_callback, diff --git a/src/interfaces/highs_c_api.h b/src/interfaces/highs_c_api.h index 1a43dd8e81..801ddf332e 100644 --- a/src/interfaces/highs_c_api.h +++ b/src/interfaces/highs_c_api.h @@ -1139,6 +1139,19 @@ HighsInt Highs_setSolution(void* highs, const double* col_value, const double* row_value, const double* col_dual, const double* row_dual); +/** + * Set a partial primal solution by passing values for a set of variables + * + * @param highs A pointer to the Highs instance. + * @param num_entries Number of variables in the set + * @param index Indices of variables in the set + * @param value Values of variables in the set + * + * @returns A `kHighsStatus` constant indicating whether the call succeeded. + */ +HighsInt Highs_setSparseSolution(void* highs, const HighsInt num_entries, + const HighsInt* index, const double* value); + /** * Set the callback method to use for HiGHS *