C
HighsCallbackDataOut
— TypeHighsCallbackDataOut
Struct to handle callback output data
Highs_addCol
— MethodHighs_addCol(highs, cost, lower, upper, num_new_nz, index, value)
Add a new column (variable) to the model.
Parameters
highs
: A pointer to the Highs instance.cost
: The objective coefficient of the column.lower
: The lower bound of the column.upper
: The upper bound of the column.num_new_nz
: The number of non-zeros in the column.index
: An array of size [num_new_nz] with the row indices.value
: An array of size [num_new_nz] with row values.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_addCols
— MethodHighs_addCols(highs, num_new_col, costs, lower, upper, num_new_nz, starts, index, value)
Add multiple columns (variables) to the model.
Parameters
highs
: A pointer to the Highs instance.num_new_col
: The number of new columns to add.costs
: An array of size [num_new_col] with objective coefficients.lower
: An array of size [num_new_col] with lower bounds.upper
: An array of size [num_new_col] with upper bounds.num_new_nz
: The number of new nonzeros in the constraint matrix.starts
: The constraint coefficients are given as a matrix in compressed sparse column form by the arraysstarts
,index
, andvalue
.starts
is an array of size [num_new_cols] with the start index of each row in indices and values.index
: An array of size [num_new_nz] with row indices.value
: An array of size [num_new_nz] with row values.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_addRow
— MethodHighs_addRow(highs, lower, upper, num_new_nz, index, value)
Add a new row (a linear constraint) to the model.
Parameters
highs
: A pointer to the Highs instance.lower
: The lower bound of the row.upper
: The upper bound of the row.num_new_nz
: The number of non-zeros in the rowindex
: An array of size [num_new_nz] with column indices.value
: An array of size [num_new_nz] with column values.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_addRows
— MethodHighs_addRows(highs, num_new_row, lower, upper, num_new_nz, starts, index, value)
Add multiple rows (linear constraints) to the model.
Parameters
highs
: A pointer to the Highs instance.num_new_row
: The number of new rows to addlower
: An array of size [num_new_row] with the lower bounds of the rows.upper
: An array of size [num_new_row] with the upper bounds of the rows.num_new_nz
: The number of non-zeros in the rows.starts
: The constraint coefficients are given as a matrix in compressed sparse row form by the arraysstarts
,index
, andvalue
.starts
is an array of size [num_new_rows] with the start index of each row in indices and values.index
: An array of size [num_new_nz] with column indices.value
: An array of size [num_new_nz] with column values.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_addVar
— MethodHighs_addVar(highs, lower, upper)
Add a new variable to the model.
Parameters
highs
: A pointer to the Highs instance.lower
: The lower bound of the column.upper
: The upper bound of the column.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_addVars
— MethodHighs_addVars(highs, num_new_var, lower, upper)
Add multiple variables to the model.
Parameters
highs
: A pointer to the Highs instance.num_new_var
: The number of new variables to add.lower
: An array of size [num_new_var] with lower bounds.upper
: An array of size [num_new_var] with upper bounds.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_changeCoeff
— MethodHighs_changeCoeff(highs, row, col, value)
Change a coefficient in the constraint matrix.
Parameters
highs
: A pointer to the Highs instance.row
: The index of the row to change.col
: The index of the column to change.value
: The new constraint coefficient.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_changeColBounds
— MethodHighs_changeColBounds(highs, col, lower, upper)
Change the variable bounds of a column.
Parameters
highs
: A pointer to the Highs instance.col
: The index of the column whose bounds are to change.lower
: The new lower bound.upper
: The new upper bound.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_changeColCost
— MethodHighs_changeColCost(highs, col, cost)
Change the objective coefficient of a column.
Parameters
highs
: A pointer to the Highs instance.col
: The index of the column fo change.cost
: The new objective coefficient.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_changeColIntegrality
— MethodHighs_changeColIntegrality(highs, col, integrality)
Change the integrality of a column.
Parameters
highs
: A pointer to the Highs instance.col
: The column index to change.integrality
: The new integrality of the column in the form of akHighsVarType
constant.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_changeColsBoundsByMask
— MethodHighs_changeColsBoundsByMask(highs, mask, lower, upper)
Change the variable bounds of multiple columns given by a mask.
Parameters
highs
: A pointer to the Highs instance.mask
: An array of length [num_col] with 1 if the column bounds should be changed and 0 otherwise.lower
: An array of length [num_col] with the new lower bounds.upper
: An array of length [num_col] with the new upper bounds.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_changeColsBoundsByRange
— MethodHighs_changeColsBoundsByRange(highs, from_col, to_col, lower, upper)
Change the variable bounds of multiple adjacent columns.
Parameters
highs
: A pointer to the Highs instance.from_col
: The index of the first column whose bound changes.to_col
: The index of the last column whose bound changes.lower
: An array of length [to_col - from_col + 1] with the new lower bounds.upper
: An array of length [to_col - from_col + 1] with the new upper bounds.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_changeColsBoundsBySet
— MethodHighs_changeColsBoundsBySet(highs, num_set_entries, set, lower, upper)
Change the bounds of multiple columns given by an array of indices.
Parameters
highs
: A pointer to the Highs instance.num_set_entries
: The number of columns to change.set
: An array of size [num_set_entries] with the indices of the columns to change.lower
: An array of length [num_set_entries] with the new lower bounds.upper
: An array of length [num_set_entries] with the new upper bounds.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_changeColsCostByMask
— MethodHighs_changeColsCostByMask(highs, mask, cost)
Change the cost of multiple columns given by a mask.
Parameters
highs
: A pointer to the Highs instance.mask
: An array of length [num_col] with 1 if the column cost should be changed and 0 otherwise.cost
: An array of length [num_col] with the new costs.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_changeColsCostByRange
— MethodHighs_changeColsCostByRange(highs, from_col, to_col, cost)
Change the cost coefficients of multiple adjacent columns.
Parameters
highs
: A pointer to the Highs instance.from_col
: The index of the first column whose cost changes.to_col
: The index of the last column whose cost changes.cost
: An array of length [to_col - from_col + 1] with the new objective coefficients.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_changeColsCostBySet
— MethodHighs_changeColsCostBySet(highs, num_set_entries, set, cost)
Change the cost of multiple columns given by an array of indices.
Parameters
highs
: A pointer to the Highs instance.num_set_entries
: The number of columns to change.set
: An array of size [num_set_entries] with the indices of the columns to change.cost
: An array of length [num_set_entries] with the new costs of the columns.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_changeColsIntegralityByMask
— MethodHighs_changeColsIntegralityByMask(highs, mask, integrality)
Change the integrality of multiple columns given by a mask.
Parameters
highs
: A pointer to the Highs instance.mask
: An array of length [num_col] with 1 if the column integrality should be changed and 0 otherwise.integrality
: An array of length [num_col] with the new integralities of the columns in the form ofkHighsVarType
constants.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_changeColsIntegralityByRange
— MethodHighs_changeColsIntegralityByRange(highs, from_col, to_col, integrality)
Change the integrality of multiple adjacent columns.
Parameters
highs
: A pointer to the Highs instance.from_col
: The index of the first column whose integrality changes.to_col
: The index of the last column whose integrality changes.integrality
: An array of length [to_col - from_col + 1] with the new integralities of the columns in the form ofkHighsVarType
constants.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_changeColsIntegralityBySet
— MethodHighs_changeColsIntegralityBySet(highs, num_set_entries, set, integrality)
Change the integrality of multiple columns given by an array of indices.
Parameters
highs
: A pointer to the Highs instance.num_set_entries
: The number of columns to change.set
: An array of size [num_set_entries] with the indices of the columns to change.integrality
: An array of length [num_set_entries] with the new integralities of the columns in the form ofkHighsVarType
constants.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_changeObjectiveOffset
— MethodHighs_changeObjectiveOffset(highs, offset)
Change the objective offset of the model.
Parameters
highs
: A pointer to the Highs instance.offset
: The new objective offset.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_changeObjectiveSense
— MethodHighs_changeObjectiveSense(highs, sense)
Change the objective sense of the model.
Parameters
highs
: A pointer to the Highs instance.sense
: The new optimization sense in the form of akHighsObjSense
constant.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_changeRowBounds
— MethodHighs_changeRowBounds(highs, row, lower, upper)
Change the bounds of a row.
Parameters
highs
: A pointer to the Highs instance.row
: The index of the row whose bounds are to change.lower
: The new lower bound.upper
: The new upper bound.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_changeRowsBoundsByMask
— MethodHighs_changeRowsBoundsByMask(highs, mask, lower, upper)
Change the bounds of multiple rows given by a mask.
Parameters
highs
: A pointer to the Highs instance.mask
: An array of length [num_row] with 1 if the row bounds should be changed and 0 otherwise.lower
: An array of length [num_row] with the new lower bounds.upper
: An array of length [num_row] with the new upper bounds.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_changeRowsBoundsBySet
— MethodHighs_changeRowsBoundsBySet(highs, num_set_entries, set, lower, upper)
Change the bounds of multiple rows given by an array of indices.
Parameters
highs
: A pointer to the Highs instance.num_set_entries
: The number of rows to change.set
: An array of size [num_set_entries] with the indices of the rows to change.lower
: An array of length [num_set_entries] with the new lower bounds.upper
: An array of length [num_set_entries] with the new upper bounds.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_clear
— MethodHighs_clear(highs)
Reset the options and then call clearModel
.
See Highs_destroy
to free all associated memory.
Parameters
highs
: A pointer to the Highs instance.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_clearIntegrality
— MethodHighs_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.
Highs_clearModel
— MethodHighs_clearModel(highs)
Remove all variables and constraints from the model highs
, but do not invalidate the pointer highs
. Future calls (for example, adding new variables and constraints) are allowed.
Parameters
highs
: A pointer to the Highs instance.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_clearSolver
— MethodHighs_clearSolver(highs)
Clear all solution data associated with the model.
See Highs_destroy
to clear the model and free all associated memory.
Parameters
highs
: A pointer to the Highs instance.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_compilationDate
— MethodHighs_compilationDate()
Return the HiGHS compilation date.
Returns
Thse HiGHS compilation date.
Highs_create
— MethodHighs_create()
Create a Highs instance and return the reference.
Call Highs_destroy
on the returned reference to clean up allocated memory.
Returns
A pointer to the Highs instance.
Highs_crossover
— MethodHighs_crossover(highs, num_col, num_row, col_value, col_dual, row_dual)
Set a primal (and possibly dual) solution as a starting point, then run crossover to compute a basic feasible solution.
Parameters
highs
: A pointer to the Highs instance.num_col
: The number of variables.num_row
: The number of rows.col_value
: An array of length [num_col] with optimal primal solution for each column.col_dual
: An array of length [num_col] with optimal dual solution for each column. May beNULL
, in which case no dual solution is passed.row_dual
: An array of length [num_row] with optimal dual solution for each row. . May beNULL
, in which case no dual solution is passed.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_deleteColsByMask
— MethodHighs_deleteColsByMask(highs, mask)
Delete multiple columns given by a mask.
Parameters
highs
: A pointer to the Highs instance.mask
: An array of length [num_col] with 1 if the column should be deleted and 0 otherwise.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_deleteColsByRange
— MethodHighs_deleteColsByRange(highs, from_col, to_col)
Delete multiple adjacent columns.
Parameters
highs
: A pointer to the Highs instance.from_col
: The index of the first column to delete.to_col
: The index of the last column to delete.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_deleteColsBySet
— MethodHighs_deleteColsBySet(highs, num_set_entries, set)
Delete multiple columns given by an array of indices.
Parameters
highs
: A pointer to the Highs instance.num_set_entries
: The number of columns to delete.set
: An array of size [num_set_entries] with the indices of the columns to delete.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_deleteRowsByMask
— MethodHighs_deleteRowsByMask(highs, mask)
Delete multiple rows given by a mask.
Parameters
highs
: A pointer to the Highs instance.mask
: An array of length [num_row] with1
if the row should be deleted and0
otherwise. The new index of any column not deleted is stored in place of the value0
.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_deleteRowsByRange
— MethodHighs_deleteRowsByRange(highs, from_row, to_row)
Delete multiple adjacent rows.
Parameters
highs
: A pointer to the Highs instance.from_row
: The index of the first row to delete.to_row
: The index of the last row to delete.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_deleteRowsBySet
— MethodHighs_deleteRowsBySet(highs, num_set_entries, set)
Delete multiple rows given by an array of indices.
Parameters
highs
: A pointer to the Highs instance.num_set_entries
: The number of rows to delete.set
: An array of size [num_set_entries] with the indices of the rows to delete.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_destroy
— MethodHighs_destroy(highs)
Destroy the model highs
created by Highs_create
and free all corresponding memory. Future calls using highs
are not allowed.
To empty a model without invalidating highs
, see Highs_clearModel
.
Parameters
highs
: A pointer to the Highs instance.
Highs_feasibilityRelaxation
— MethodHighs_feasibilityRelaxation(highs, global_lower_penalty, global_upper_penalty, global_rhs_penalty, local_lower_penalty, local_upper_penalty, local_rhs_penalty)
Compute the solution corresponding to a (possibly weighted) sum of (allowable) infeasibilities in an LP/MIP.
If local penalties are not defined, pass NULL, and the global penalty will be used. Negative penalty values imply that the bound or RHS value cannot be violated
Parameters
highs
: A pointer to the Highs instance.const
: double global_lower_penalty The penalty for violating lower bounds on variablesconst
: double global_upper_penalty The penalty for violating upper bounds on variablesconst
: double global_rhs_penalty The penalty for violating constraint RHS valuesconst
: double* local_lower_penalty The penalties for violating specific lower bounds on variablesconst
: double* local_upper_penalty The penalties for violating specific upper bounds on variablesconst
: double* local_rhs_penalty The penalties for violating specific constraint RHS values
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getBasicVariables
— MethodHighs_getBasicVariables(highs, basic_variables)
Get the indices of the rows and columns that make up the basis matrix $B$ of a basic feasible solution.
Non-negative entries are indices of columns, and negative entries are -row\_index - 1
. For example, {1, -1}
would be the second column and first row.
The order of these rows and columns is important for calls to the functions:
Highs_getBasisInverseRow
-Highs_getBasisInverseCol
-Highs_getBasisSolve
-Highs_getBasisTransposeSolve
-Highs_getReducedRow
-Highs_getReducedColumn
Parameters
highs
: A pointer to the Highs instance.basic_variables
: An array of size [num_rows], filled with the indices of the basic variables.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getBasis
— MethodHighs_getBasis(highs, col_status, row_status)
Given a linear program with a basic feasible solution, get the column and row basis statuses.
Parameters
highs
: A pointer to the Highs instance.col_status
: An array of length [num_col], to be filled with the column basis statuses in the form of akHighsBasisStatus
constant.row_status
: An array of length [num_row], to be filled with the row basis statuses in the form of akHighsBasisStatus
constant.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getBasisInverseCol
— MethodHighs_getBasisInverseCol(highs, col, col_vector, col_num_nz, col_index)
Get a column of the inverse basis matrix $B^{-1}$.
See Highs_getBasicVariables
for a description of the $B$ matrix.
The arrays col_vector
and col_index
must have an allocated length of [num_row]. However, check col_num_nz
to see how many non-zero elements are actually stored.
Parameters
highs
: A pointer to the Highs instance.col
: The index of the column to compute.col_vector
: An array of length [num_row] in which to store the values of the non-zero elements.col_num_nz
: The number of non-zeros in the column.col_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.
Highs_getBasisInverseRow
— MethodHighs_getBasisInverseRow(highs, row, row_vector, row_num_nz, row_index)
Get a row of the inverse basis matrix $B^{-1}$.
See Highs_getBasicVariables
for a description of the $B$ matrix.
The arrays row_vector
and row_index
must have an allocated length of [num_row]. However, check row_num_nz
to see how many non-zero elements are actually stored.
Parameters
highs
: A pointer to the Highs instance.row
: The index of the row to compute.row_vector
: An array of length [num_row] in which to store the values of the non-zero elements.row_num_nz
: The number of non-zeros in the row.row_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.
Highs_getBasisSolve
— MethodHighs_getBasisSolve(highs, rhs, solution_vector, solution_num_nz, solution_index)
Compute ${x}=B^{-1}{b}$ for a given vector ${b}$.
See Highs_getBasicVariables
for a description of the $B$ matrix.
The arrays solution_vector
and solution_index
must have an allocated length of [num_row]. However, check solution_num_nz
to see how many non-zero elements are actually stored.
Parameters
highs
: A pointer to the Highs instance.rhs
: The right-hand side vector $b$.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 which to store the indices of the non-zero elements.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getBasisTransposeSolve
— MethodHighs_getBasisTransposeSolve(highs, rhs, solution_vector, solution_nz, solution_index)
Compute ${x}=B^{-T}{b}$ for a given vector ${b}$.
See Highs_getBasicVariables
for a description of the $B$ matrix.
The arrays solution_vector
and solution_index
must have an allocated length of [num_row]. However, check solution_num_nz
to see how many non-zero elements are actually stored.
Parameters
highs
: A pointer to the Highs instance.rhs
: The right-hand side vector $b$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 which to store the indices of the non-zero elements.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getBoolOptionValue
— MethodHighs_getBoolOptionValue(highs, option, value)
Get a boolean-valued option.
Parameters
highs
: A pointer to the Highs instance.option
: The name of the option.value
: The location in which the current value of the option should be placed.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getBoolOptionValues
— MethodHighs_getBoolOptionValues(highs, option, current_value, default_value)
Get the current and default values of a bool option
Parameters
highs
: A pointer to the Highs instance.current_value
: A pointer to the current value of the option.default_value
: A pointer to the default value of the option.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getCallbackDataOutItem
— MethodHighs_getCallbackDataOutItem(data_out, item_name)
Get a void* pointer to a callback data item
Parameters
data_out
: A pointer to theHighsCallbackDataOut
instance.item_name
: The name of the item.
Returns
A void* pointer to the callback data item, or NULL if item_name not valid
Highs_getColByName
— MethodHighs_getColByName(highs, name, col)
Get the index of a column from its name.
If multiple columns have the same name, or if no column exists with name
, this function returns kHighsStatusError
.
Parameters
name
: A pointer of the name of the column to query.col
: A pointer in which to store the index of the column
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getColIntegrality
— MethodHighs_getColIntegrality(highs, col, integrality)
Get the integrality of a column.
Parameters
col
: The index of the column to query.integrality
: An integer in which the integrality of the column should be placed. The integer is one of thekHighsVarTypeXXX
constants.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getColName
— MethodHighs_getColName(highs, col, name)
Get the name of a column.
Parameters
col
: The index of the column to query.name
: A pointer in which to store the name of the column. This must have lengthkHighsMaximumStringLength
.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getColsByMask
— MethodHighs_getColsByMask(highs, mask, num_col, costs, lower, upper, num_nz, matrix_start, matrix_index, matrix_value)
Get data associated with multiple columns given by a mask.
This function is identical to Highs_getColsByRange
, except for how the columns are specified.
Parameters
mask
: An array of length [num_col] containing a1
to get the column and0
otherwise.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getColsByRange
— MethodHighs_getColsByRange(highs, from_col, to_col, num_col, costs, lower, upper, num_nz, matrix_start, matrix_index, matrix_value)
Get data associated with multiple adjacent columns from the model.
To query the constraint coefficients, this function should be called twice.
First, call this function with matrix_start
, matrix_index
, and matrix_value
as NULL
. This call will populate num_nz
with the number of nonzero elements in the corresponding section of the constraint matrix.
Second, allocate new matrix_index
and matrix_value
arrays of length num_nz
and call this function again to populate the new arrays with their contents.
Parameters
highs
: A pointer to the Highs instance.from_col
: The first column for which to query data for.to_col
: The last column (inclusive) for which to query data for.num_col
: An integer populated with the number of columns got from the model (this should equalto\_col - from\_col + 1
).costs
: An array of size [to_col - from_col + 1] for the column cost coefficients.lower
: An array of size [to_col - from_col + 1] for the column lower bounds.upper
: An array of size [to_col - from_col + 1] for the column upper bounds.num_nz
: An integer to be populated with the number of non-zero elements in the constraint matrix.matrix_start
: An array of size [to_col - from_col + 1] with the start indices of each column inmatrix_index
andmatrix_value
.matrix_index
: An array of size [num_nz] with the row indices of each element in the constraint matrix.matrix_value
: An array of size [num_nz] with the non-zero elements of the constraint matrix.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getColsBySet
— MethodHighs_getColsBySet(highs, num_set_entries, set, num_col, costs, lower, upper, num_nz, matrix_start, matrix_index, matrix_value)
Get data associated with multiple columns given by an array.
This function is identical to Highs_getColsByRange
, except for how the columns are specified.
Parameters
num_set_indices
: The number of indices inset
.set
: An array of size [num_set_entries] with the column indices to get.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getDoubleInfoValue
— MethodHighs_getDoubleInfoValue(highs, info, value)
Get a double-valued info value.
Parameters
highs
: A pointer to the Highs instance.info
: The name of the info item.value
: A reference to a double that the result will be stored in.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getDoubleOptionValue
— MethodHighs_getDoubleOptionValue(highs, option, value)
Get a double-valued option.
Parameters
highs
: A pointer to the Highs instance.option
: The name of the option.value
: The location in which the current value of the option should be placed.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getDoubleOptionValues
— MethodHighs_getDoubleOptionValues(highs, option, current_value, min_value, max_value, default_value)
Get the current and default values of a double option
Parameters
highs
: A pointer to the Highs instance.current_value
: A pointer to the current value of the option.min_value
: A pointer to the minimum value of the option.max_value
: A pointer to the maximum value of the option.default_value
: A pointer to the default value of the option.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getDualRay
— MethodHighs_getDualRay(highs, has_dual_ray, dual_ray_value)
Get an unbounded dual ray that is a certificate of primal infeasibility.
Parameters
highs
: A pointer to the Highs instance.has_dual_ray
: A pointer to an int to store 1 if the dual ray exists.dual_ray_value
: An array of length [num_row] filled with the unbounded ray.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getHessianNumNz
— MethodHighs_getHessianNumNz(highs)
Return the number of nonzeroes in the Hessian matrix of the model.
Parameters
highs
: A pointer to the Highs instance.
Returns
The number of nonzeroes in the Hessian matrix of the model.
Highs_getInfinity
— MethodHighs_getInfinity(highs)
Return the value of infinity used by HiGHS.
Parameters
highs
: A pointer to the Highs instance.
Returns
The value of infinity used by HiGHS.
Highs_getInfoType
— MethodHighs_getInfoType(highs, info, type)
Get the type expected by an info item.
Parameters
highs
: A pointer to the Highs instance.info
: The name of the info item.type
: An int in which the correspondingkHighsOptionType
constant is stored.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getInt64InfoValue
— MethodHighs_getInt64InfoValue(highs, info, value)
Get an int64-valued info value.
Parameters
highs
: A pointer to the Highs instance.info
: The name of the info item.value
: A reference to an int64 that the result will be stored in.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getIntInfoValue
— MethodHighs_getIntInfoValue(highs, info, value)
Get an int-valued info value.
Parameters
highs
: A pointer to the Highs instance.info
: The name of the info item.value
: A reference to an integer that the result will be stored in.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getIntOptionValue
— MethodHighs_getIntOptionValue(highs, option, value)
Get an int-valued option.
Parameters
highs
: A pointer to the Highs instance.option
: The name of the option.value
: The location in which the current value of the option should be placed.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getIntOptionValues
— MethodHighs_getIntOptionValues(highs, option, current_value, min_value, max_value, default_value)
Get the current and default values of an int option
Parameters
highs
: A pointer to the Highs instance.current_value
: A pointer to the current value of the option.min_value
: A pointer to the minimum value of the option.max_value
: A pointer to the maximum value of the option.default_value
: A pointer to the default value of the option.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getLp
— MethodHighs_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
.
Note that all arrays must be pre-allocated to the correct size before calling Highs_getModel
. Use the following query methods to check the appropriate size: - Highs_getNumCol
- Highs_getNumRow
- Highs_getNumNz
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getModel
— MethodHighs_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)
Get the data from a HiGHS model.
The input arguments have the same meaning (in a different order) to those used in Highs_passModel
.
Note that all arrays must be pre-allocated to the correct size before calling Highs_getModel
. Use the following query methods to check the appropriate size: - Highs_getNumCol
- Highs_getNumRow
- Highs_getNumNz
- Highs_getHessianNumNz
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getModelStatus
— MethodHighs_getModelStatus(highs)
Return the optimization status of the model in the form of a kHighsModelStatus
constant.
Parameters
highs
: A pointer to the Highs instance.
Returns
An integer corresponding to the kHighsModelStatus
constant
Highs_getNumCol
— MethodHighs_getNumCol(highs)
Return the number of columns in the model.
Parameters
highs
: A pointer to the Highs instance.
Returns
The number of columns in the model.
Highs_getNumNz
— MethodHighs_getNumNz(highs)
Return the number of nonzeros in the constraint matrix of the model.
Parameters
highs
: A pointer to the Highs instance.
Returns
The number of nonzeros in the constraint matrix of the model.
Highs_getNumOptions
— MethodHighs_getNumOptions(highs)
Return the number of options
Parameters
highs
: A pointer to the Highs instance.
Highs_getNumRow
— MethodHighs_getNumRow(highs)
Return the number of rows in the model.
Parameters
highs
: A pointer to the Highs instance.
Returns
The number of rows in the model.
Highs_getObjectiveOffset
— MethodHighs_getObjectiveOffset(highs, offset)
Get the objective offset.
Parameters
highs
: A pointer to the Highs instance.offset
: The location in which the current objective offset should be placed.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getObjectiveSense
— MethodHighs_getObjectiveSense(highs, sense)
Get the objective sense.
Parameters
highs
: A pointer to the Highs instance.sense
: The location in which the current objective sense should be placed. The sense is akHighsObjSense
constant.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getObjectiveValue
— MethodHighs_getObjectiveValue(highs)
Get the primal objective function value.
Parameters
highs
: A pointer to the Highs instance.
Returns
The primal objective function value
Highs_getOptionName
— MethodHighs_getOptionName(highs, index, name)
Get the name of an option identified by index
Parameters
highs
: A pointer to the Highs instance.index
: The index of the option.name
: The name of the option.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getOptionType
— MethodHighs_getOptionType(highs, option, type)
Get the type expected by an option.
Parameters
highs
: A pointer to the Highs instance.option
: The name of the option.type
: An int in which the correspondingkHighsOptionType
constant should be placed.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getPresolvedLp
— MethodHighs_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
.
Note that all arrays must be pre-allocated to the correct size before calling Highs_getModel
. Use the following query methods to check the appropriate size: - Highs_getPresolvedNumCol
- Highs_getPresolvedNumRow
- Highs_getPresolvedNumNz
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getPresolvedNumCol
— MethodHighs_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.
Highs_getPresolvedNumNz
— MethodHighs_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.
Highs_getPresolvedNumRow
— MethodHighs_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.
Highs_getPrimalRay
— MethodHighs_getPrimalRay(highs, has_primal_ray, primal_ray_value)
Get an unbounded primal ray that is a certificate of dual infeasibility.
Parameters
highs
: A pointer to the Highs instance.has_primal_ray
: A pointer to an int to store 1 if the primal ray exists.primal_ray_value
: An array of length [num_col] filled with the unbounded ray.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getRanging
— MethodHighs_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 information is relative to the active bound. For basic variables the ranging information relates to...
For any values that are not required, pass NULL.
Parameters
highs
: A pointer to the Highs instance.col_cost_up_value
: The upper range of the cost valuecol_cost_up_objective
: The objective at the upper cost rangecol_cost_up_in_var
: The variable entering the basis at the upper cost rangecol_cost_up_ou_var
: The variable leaving the basis at the upper cost rangecol_cost_dn_value
: The lower range of the cost valuecol_cost_dn_objective
: The objective at the lower cost rangecol_cost_dn_in_var
: The variable entering the basis at the lower cost rangecol_cost_dn_ou_var
: The variable leaving the basis at the lower cost rangecol_bound_up_value
: The upper range of the column bound valuecol_bound_up_objective
: The objective at the upper column bound rangecol_bound_up_in_var
: The variable entering the basis at the upper column bound rangecol_bound_up_ou_var
: The variable leaving the basis at the upper column bound rangecol_bound_dn_value
: The lower range of the column bound valuecol_bound_dn_objective
: The objective at the lower column bound rangecol_bound_dn_in_var
: The variable entering the basis at the lower column bound rangecol_bound_dn_ou_var
: The variable leaving the basis at the lower column bound rangerow_bound_up_value
: The upper range of the row bound valuerow_bound_up_objective
: The objective at the upper row bound rangerow_bound_up_in_var
: The variable entering the basis at the upper row bound rangerow_bound_up_ou_var
: The variable leaving the basis at the upper row bound rangerow_bound_dn_value
: The lower range of the row bound valuerow_bound_dn_objective
: The objective at the lower row bound rangerow_bound_dn_in_var
: The variable entering the basis at the lower row bound rangerow_bound_dn_ou_var
: The variable leaving the basis at the lower row bound range
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getReducedColumn
— MethodHighs_getReducedColumn(highs, col, col_vector, col_num_nz, col_index)
Compute a column of $B^{-1}A$.
See Highs_getBasicVariables
for a description of the $B$ matrix.
The arrays col_vector
and col_index
must have an allocated length of [num_row]. However, check col_num_nz
to see how many non-zero elements are actually stored.
Parameters
highs
: A pointer to the Highs instance.col
: The index of the column to compute.col_vector
: An array of length [num_row] in which to store the values of the non-zero elements.col_num_nz
: The number of non-zeros in the column.col_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.
Highs_getReducedRow
— MethodHighs_getReducedRow(highs, row, row_vector, row_num_nz, row_index)
Compute a row of $B^{-1}A$.
See Highs_getBasicVariables
for a description of the $B$ matrix.
The arrays row_vector
and row_index
must have an allocated length of [num_row]. However, check row_num_nz
to see how many non-zero elements are actually stored.
Parameters
highs
: A pointer to the Highs instance.row
: The index of the row to compute.row_vector
: An array of length [num_row] in which to store the values of the non-zero elements.row_num_nz
: The number of non-zeros in the row.row_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.
Highs_getRowByName
— MethodHighs_getRowByName(highs, name, row)
Get the index of a row from its name.
If multiple rows have the same name, or if no row exists with name
, this function returns kHighsStatusError
.
Parameters
name
: A pointer of the name of the row to query.row
: A pointer in which to store the index of the row
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getRowName
— MethodHighs_getRowName(highs, row, name)
Get the name of a row.
Parameters
row
: The index of the row to query.name
: A pointer in which to store the name of the row. This must have lengthkHighsMaximumStringLength
.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getRowsByMask
— MethodHighs_getRowsByMask(highs, mask, num_row, lower, upper, num_nz, matrix_start, matrix_index, matrix_value)
Get data associated with multiple rows given by a mask.
This function is identical to Highs_getRowsByRange
, except for how the rows are specified.
Parameters
mask
: An array of length [num_row] containing a1
to get the row and0
otherwise.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getRowsByRange
— MethodHighs_getRowsByRange(highs, from_row, to_row, num_row, lower, upper, num_nz, matrix_start, matrix_index, matrix_value)
Get data associated with multiple adjacent rows from the model.
To query the constraint coefficients, this function should be called twice.
First, call this function with matrix_start
, matrix_index
, and matrix_value
as NULL
. This call will populate num_nz
with the number of nonzero elements in the corresponding section of the constraint matrix.
Second, allocate new matrix_index
and matrix_value
arrays of length num_nz
and call this function again to populate the new arrays with their contents.
Parameters
highs
: A pointer to the Highs instance.from_row
: The first row for which to query data for.to_row
: The last row (inclusive) for which to query data for.num_row
: An integer to be populated with the number of rows got from the smodel.lower
: An array of size [to_row - from_row + 1] for the row lower bounds.upper
: An array of size [to_row - from_row + 1] for the row upper bounds.num_nz
: An integer to be populated with the number of non-zero elements in the constraint matrix.matrix_start
: An array of size [to_row - from_row + 1] with the start indices of each row inmatrix_index
andmatrix_value
.matrix_index
: An array of size [num_nz] with the column indices of each element in the constraint matrix.matrix_value
: An array of size [num_nz] with the non-zero elements of the constraint matrix.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getRowsBySet
— MethodHighs_getRowsBySet(highs, num_set_entries, set, num_row, lower, upper, num_nz, matrix_start, matrix_index, matrix_value)
Get data associated with multiple rows given by an array.
This function is identical to Highs_getRowsByRange
, except for how the rows are specified.
Parameters
num_set_indices
: The number of indices inset
.set
: An array of size [num_set_entries] containing the row indices to get.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getRunTime
— MethodHighs_getRunTime(highs)
Return the cumulative wall-clock time spent in Highs_run
.
Parameters
highs
: A pointer to the Highs instance.
Returns
The cumulative wall-clock time spent in Highs_run
Highs_getSizeofHighsInt
— MethodHighs_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.
Highs_getSolution
— MethodHighs_getSolution(highs, col_value, col_dual, row_value, row_dual)
Get the primal and dual solution from an optimized model.
Parameters
highs
: A pointer to the Highs instance.col_value
: An array of length [num_col], to be filled with primal column values.col_dual
: An array of length [num_col], to be filled with dual column values.row_value
: An array of length [num_row], to be filled with primal row values.row_dual
: An array of length [num_row], to be filled with dual row values.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getStringOptionValue
— MethodHighs_getStringOptionValue(highs, option, value)
Get a string-valued option.
Parameters
highs
: A pointer to the Highs instance.option
: The name of the option.value
: A pointer to allocated memory (of at leastkMaximumStringLength
) to store the current value of the option.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_getStringOptionValues
— MethodHighs_getStringOptionValues(highs, option, current_value, default_value)
Get the current and default values of a string option
Parameters
highs
: A pointer to the Highs instance.current_value
: A pointer to the current value of the option.default_value
: A pointer to the default value of the option.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_githash
— MethodHighs_githash()
Return the HiGHS githash.
Returns
The HiGHS githash.
Highs_lpCall
— MethodHighs_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)
Formulate and solve a linear program using HiGHS.
Parameters
num_col
: The number of columns.num_row
: The number of rows.num_nz
: The number of nonzeros in the constraint matrix.a_format
: The format of the constraint matrix as akHighsMatrixFormat
constant.sense
: The optimization sense as akHighsObjSense
constant.offset
: The objective constant.col_cost
: An array of length [num_col] with the column costs.col_lower
: An array of length [num_col] with the column lower bounds.col_upper
: An array of length [num_col] with the column upper bounds.row_lower
: An array of length [num_row] with the row lower bounds.row_upper
: An array of length [num_row] with the row upper bounds.a_start
: The constraint matrix is provided to HiGHS in compressed sparse column form (ifa_format
iskHighsMatrixFormatColwise
, otherwise compressed sparse row form). The sparse matrix consists of three arrays,a_start
,a_index
, anda_value
.a_start
is an array of length [num_col] containing the starting index of each column ina_index
. Ifa_format
iskHighsMatrixFormatRowwise
the array is of length [num_row] corresponding to each row.a_index
: An array of length [num_nz] with indices of matrix entries.a_value
: An array of length [num_nz] with values of matrix entries.col_value
: An array of length [num_col], to be filled with the primal column solution.col_dual
: An array of length [num_col], to be filled with the dual column solution.row_value
: An array of length [num_row], to be filled with the primal row solution.row_dual
: An array of length [num_row], to be filled with the dual row solution.col_basis_status
: An array of length [num_col], to be filled with the basis status of the columns in the form of akHighsBasisStatus
constant.row_basis_status
: An array of length [num_row], to be filled with the basis status of the rows in the form of akHighsBasisStatus
constant.model_status
: The location in which to place the termination status of the model after the solve in the form of akHighsModelStatus
constant.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_mipCall
— MethodHighs_mipCall(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, integrality, col_value, row_value, model_status)
Formulate and solve a mixed-integer linear program using HiGHS.
The signature of this method is identical to Highs_lpCall
, except that it has an additional integrality
argument, and that it is missing the col_dual
, row_dual
, col_basis_status
and row_basis_status
arguments.
Parameters
integrality
: An array of length [num_col], containing akHighsVarType
constant for each column.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_passColName
— MethodHighs_passColName(highs, col, name)
Pass the name of a column.
Parameters
highs
: A pointer to the Highs instance.col
: The column for which the name is supplied.name
: The name of the column.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_passHessian
— MethodHighs_passHessian(highs, dim, num_nz, format, start, index, value)
Set the Hessian matrix for a quadratic objective.
Parameters
highs
: A pointer to the Highs instance.dim
: The dimension of the Hessian matrix. Should be [num_col].num_nz
: The number of non-zero elements in the Hessian matrix.format
: The format of the Hessian matrix as akHighsHessianFormat
constant. This must bekHighsHessianFormatTriangular
.start
: The Hessian matrix is provided to HiGHS as the lower triangular component in compressed sparse column form (or, equivalently, as the upper triangular component in compressed sparse row form), usingq_start
,q_index
, andq_value
.The Hessian matrix is provided to HiGHS as the lower triangular component in compressed sparse column form. The sparse matrix consists of three arrays,start
,index
, andvalue
.start
is an array of length [num_col] containing the starting index of each column inindex
.index
: An array of length [num_nz] with indices of matrix entries.value
: An array of length [num_nz] with values of matrix entries.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_passLp
— MethodHighs_passLp(highs, 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)
Pass a linear program (LP) to HiGHS in a single function call.
The signature of this function is identical to Highs_passModel
, without the arguments for passing the Hessian matrix of a quadratic program and the integrality vector.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_passMip
— MethodHighs_passMip(highs, 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, integrality)
Pass a mixed-integer linear program (MILP) to HiGHS in a single function call.
The signature of function is identical to Highs_passModel
, without the arguments for passing the Hessian matrix of a quadratic program.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_passModel
— MethodHighs_passModel(highs, num_col, num_row, num_nz, q_num_nz, a_format, q_format, 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)
Pass a model to HiGHS in a single function call. This is faster than constructing the model using Highs_addRow
and Highs_addCol
.
Parameters
highs
: A pointer to the Highs instance.num_col
: The number of columns.num_row
: The number of rows.num_nz
: The number of elements in the constraint matrix.q_num_nz
: The number of elements in the Hessian matrix.a_format
: The format of the constraint matrix to use in the form of akHighsMatrixFormat
constant.q_format
: The format of the Hessian matrix to use in the form of akHighsHessianFormat
constant.sense
: The optimization sense in the form of akHighsObjSense
constant.offset
: The constant term in the objective function.col_cost
: An array of length [num_col] with the objective coefficients.col_lower
: An array of length [num_col] with the lower column bounds.col_upper
: An array of length [num_col] with the upper column bounds.row_lower
: An array of length [num_row] with the upper row bounds.row_upper
: An array of length [num_row] with the upper row bounds.a_start
: The constraint matrix is provided to HiGHS in compressed sparse column form (ifa_format
iskHighsMatrixFormatColwise
, otherwise compressed sparse row form). The sparse matrix consists of three arrays,a_start
,a_index
, anda_value
.a_start
is an array of length [num_col] containing the starting index of each column ina_index
. Ifa_format
iskHighsMatrixFormatRowwise
the array is of length [num_row] corresponding to each row.a_index
: An array of length [num_nz] with indices of matrix entries.a_value
: An array of length [num_nz] with values of matrix entries.q_start
: The Hessian matrix is provided to HiGHS as the lower triangular component in compressed sparse column form (or, equivalently, as the upper triangular component in compressed sparse row form). The sparse matrix consists of three arrays,q_start
,q_index
, andq_value
.q_start
is an array of length [num_col]. 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 akHighsVarType
constant for each column.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_passRowName
— MethodHighs_passRowName(highs, row, name)
Pass the name of a row.
Parameters
highs
: A pointer to the Highs instance.row
: The row for which the name is supplied.name
: The name of the row.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_postsolve
— MethodHighs_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.
Highs_presolve
— MethodHighs_presolve(highs)
Presolve a model.
Parameters
highs
: A pointer to the Highs instance.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_qpCall
— MethodHighs_qpCall(num_col, num_row, num_nz, q_num_nz, a_format, q_format, sense, offset, col_cost, col_lower, col_upper, row_lower, row_upper, a_start, a_index, a_value, q_start, q_index, q_value, col_value, col_dual, row_value, row_dual, col_basis_status, row_basis_status, model_status)
Formulate and solve a quadratic program using HiGHS.
The signature of this method is identical to Highs_lpCall
, except that it has additional arguments for specifying the Hessian matrix.
Parameters
q_num_nz
: The number of nonzeros in the Hessian matrix.q_format
: The format of the Hessian matrix in the form of akHighsHessianStatus
constant. If q_num_nz > 0, this must bekHighsHessianFormatTriangular
.q_start
: The Hessian matrix is provided to HiGHS as the lower triangular component in compressed sparse column form (or, equivalently, as the upper triangular component in compressed sparse row form). The sparse matrix consists of three arrays,q_start
,q_index
, andq_value
.q_start
is an array of length [num_col].q_index
: An array of length [q_num_nz] with indices of matrix entries.q_value
: An array of length [q_num_nz] with values of matrix entries.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_readModel
— MethodHighs_readModel(highs, filename)
Read a model from filename
into highs
.
Parameters
highs
: A pointer to the Highs instance.filename
: The filename to read.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_readOptions
— MethodHighs_readOptions(highs, filename)
Read the option values from file.
Parameters
highs
: A pointer to the Highs instance.filename
: The filename from which to read the option values.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_resetGlobalScheduler
— MethodHighs_resetGlobalScheduler(blocking)
Releases all resources held by the global scheduler instance.
It is not thread-safe to call this function while calling Highs_run
or one of the Highs_XXXcall
methods on any other Highs instance in any thread.
After this function has terminated, it is guaranteed that eventually all previously created scheduler threads will terminate and allocated memory will be released.
After this function has returned, the option value for the number of threads may be altered to a new value before the next call to Highs_run
or one of the Highs_XXXcall
methods.
Parameters
blocking
: If theblocking
parameter has a nonzero value, then this function will not return until all memory is freed, which might be desirable when debugging heap memory, but it requires the calling thread to wait for all scheduler threads to wake-up which is usually not necessary.
Returns
No status is returned since the function call cannot fail. Calling this function while any Highs instance is in use on any thread is undefined behavior and may cause crashes, but cannot be detected and hence is fully in the callers responsibility.
Highs_resetOptions
— MethodHighs_resetOptions(highs)
Reset all options to their default value.
Parameters
highs
: A pointer to the Highs instance.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_run
— MethodHighs_run(highs)
Optimize a model. The algorithm used by HiGHS depends on the options that have been set.
Parameters
highs
: A pointer to the Highs instance.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_scaleCol
— MethodHighs_scaleCol(highs, col, scaleval)
Scale a column by a constant.
Scaling a column modifies the elements in the constraint matrix, the variable bounds, and the objective coefficient.
Parameters
highs
: A pointer to the Highs instance.col
: The index of the column to scale.scaleval
: The value by which to scale the column. Ifscaleval < 0
, the variable bounds flipped.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_scaleRow
— MethodHighs_scaleRow(highs, row, scaleval)
Scale a row by a constant.
Parameters
highs
: A pointer to the Highs instance.row
: The index of the row to scale.scaleval
: The value by which to scale the row. Ifscaleval < 0
, the row bounds are flipped.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_setBasis
— MethodHighs_setBasis(highs, col_status, row_status)
Set a basic feasible solution by passing the column and row basis statuses to the model.
Parameters
highs
: A pointer to the Highs instance.col_status
: an array of length [num_col] with the column basis status in the form ofkHighsBasisStatus
constantsrow_status
: an array of length [num_row] with the row basis status in the form ofkHighsBasisStatus
constants
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_setBoolOptionValue
— MethodHighs_setBoolOptionValue(highs, option, value)
Set a boolean-valued option.
Parameters
highs
: A pointer to the Highs instance.option
: The name of the option.value
: The new value of the option.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_setCallback
— MethodHighs_setCallback(highs, user_callback, user_callback_data)
Set the callback method to use for HiGHS
Parameters
highs
: A pointer to the Highs instance.user_callback
: A pointer to the user callbackuser_callback_data
: A pointer to the user callback data
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_setDoubleOptionValue
— MethodHighs_setDoubleOptionValue(highs, option, value)
Set a double-valued option.
Parameters
highs
: A pointer to the Highs instance.option
: The name of the option.value
: The new value of the option.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_setIntOptionValue
— MethodHighs_setIntOptionValue(highs, option, value)
Set an int-valued option.
Parameters
highs
: A pointer to the Highs instance.option
: The name of the option.value
: The new value of the option.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_setLogicalBasis
— MethodHighs_setLogicalBasis(highs)
Set a logical basis in the model.
Parameters
highs
: A pointer to the Highs instance.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_setSolution
— MethodHighs_setSolution(highs, col_value, row_value, col_dual, row_dual)
Set a solution by passing the column and row primal and dual solution values.
For any values that are unavailable, pass NULL.
Parameters
highs
: A pointer to the Highs instance.col_value
: An array of length [num_col] with the column solution values.row_value
: An array of length [num_row] with the row solution values.col_dual
: An array of length [num_col] with the column dual values.row_dual
: An array of length [num_row] with the row dual values.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_setSparseSolution
— MethodHighs_setSparseSolution(highs, num_entries, index, value)
Set a partial primal solution by passing values for a set of variables
Parameters
highs
: A pointer to the Highs instance.num_entries
: Number of variables in the setindex
: Indices of variables in the setvalue
: Values of variables in the set
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_setStringOptionValue
— MethodHighs_setStringOptionValue(highs, option, value)
Set a string-valued option.
Parameters
highs
: A pointer to the Highs instance.option
: The name of the option.value
: The new value of the option.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_startCallback
— MethodHighs_startCallback(highs, callback_type)
Start callback of given type
Parameters
highs
: A pointer to the Highs instance.callback_type
: The type of callback to be started
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_stopCallback
— MethodHighs_stopCallback(highs, callback_type)
Stop callback of given type
Parameters
highs
: A pointer to the Highs instance.callback_type
: The type of callback to be stopped
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_version
— MethodHighs_version()
Return the HiGHS version number as a string of the form "vX.Y.Z".
Returns
The HiGHS version as a char*
.
Highs_versionMajor
— MethodHighs_versionMajor()
Return the HiGHS major version number.
Returns
The HiGHS major version number.
Highs_versionMinor
— MethodHighs_versionMinor()
Return the HiGHS minor version number.
Returns
The HiGHS minor version number.
Highs_versionPatch
— MethodHighs_versionPatch()
Return the HiGHS patch version number.
Returns
The HiGHS patch version number.
Highs_writeModel
— MethodHighs_writeModel(highs, filename)
Write the model in highs
to filename
.
Parameters
highs
: A pointer to the Highs instance.filename
: The filename to write.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_writeOptions
— MethodHighs_writeOptions(highs, filename)
Write the current options to file.
Parameters
highs
: A pointer to the Highs instance.filename
: The filename to write the options to.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_writeOptionsDeviations
— MethodHighs_writeOptionsDeviations(highs, filename)
Write the value of non-default options to file.
This is similar to Highs_writeOptions
, except only options with non-default value are written to filename
.
Parameters
highs
: A pointer to the Highs instance.filename
: The filename to write the options to.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_writePresolvedModel
— MethodHighs_writePresolvedModel(highs, filename)
Write the presolved model in highs
to filename
.
Parameters
highs
: A pointer to the Highs instance.filename
: The filename to write.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_writeSolution
— MethodHighs_writeSolution(highs, filename)
Write the solution information (including dual and basis status, if available) to a file.
See also: Highs_writeSolutionPretty
.
Parameters
highs
: A pointer to the Highs instance.filename
: The name of the file to write the results to.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_writeSolutionPretty
— MethodHighs_writeSolutionPretty(highs, filename)
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
, except that the printout is in a human-readable format.
Parameters
highs
: A pointer to the Highs instance.filename
: The name of the file to write the results to.
Returns
A kHighsStatus
constant indicating whether the call succeeded.
Highs_zeroAllClocks
— MethodHighs_zeroAllClocks(highs)
Reset the clocks in a highs
model.
Each highs
model contains a single instance of clock that records how much time is spent in various parts of the algorithm. This clock is not reset on entry to Highs_run
, so repeated calls to Highs_run
report the cumulative time spent in the algorithm. A side-effect is that this will trigger a time limit termination once the cumulative run time exceeds the time limit, rather than the run time of each individual call to Highs_run
.
As a work-around, call Highs_zeroAllClocks
before each call to Highs_run
.
Parameters
highs
: A pointer to the Highs instance.
Returns
A kHighsStatus
constant indicating whether the call succeeded.