Skip to content

Commit

Permalink
Added Highs_setSparseSolution to C API
Browse files Browse the repository at this point in the history
  • Loading branch information
jajhall committed Jul 14, 2024
1 parent faeb3f3 commit 6e9f9bd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/interfaces/highs_c_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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*>(highs)->setCallback(user_callback,
Expand Down
13 changes: 13 additions & 0 deletions src/interfaces/highs_c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit 6e9f9bd

Please sign in to comment.