LP interface for HiGHS 1.4 and higher.
This is an implementation of SCIP's LP interface for the open-source solver HiGHS.
The most important open todos are:
Definition in file lpi_highs.cpp.
#include <cassert>
#include <cstdlib>
#include <string>
#include <vector>
#include <Highs.h>
#include <lp_data/HighsLpUtils.h>
#include "lpi/lpi.h"
#include "scip/bitencode.h"
#include "scip/pub_message.h"
#include "scip/type_lp.h"
Go to the source code of this file.
Data Structures | |
class | HighsSCIP |
struct | SCIP_LPi |
struct | SCIP_LPiState |
Macros | |
#define | HIGHS_relDiff(val1, val2) |
#define | HIGHS_CALL(x) |
#define | HIGHS_CALL_WITH_WARNING(x) |
#define | COLS_PER_PACKET SCIP_DUALPACKETSIZE |
#define | ROWS_PER_PACKET SCIP_DUALPACKETSIZE |
Variables | |
int | nsolvecalls = 0 |
Miscellaneous Methods | |
static char | highsname [30] |
static char | highsdesc [200] |
const char * | SCIPlpiGetSolverName (void) |
const char * | SCIPlpiGetSolverDesc (void) |
void * | SCIPlpiGetSolverPointer (SCIP_LPI *lpi) |
SCIP_RETCODE | SCIPlpiSetIntegralityInformation (SCIP_LPI *lpi, int ncols, int *intInfo) |
SCIP_Bool | SCIPlpiHasPrimalSolve (void) |
SCIP_Bool | SCIPlpiHasDualSolve (void) |
SCIP_Bool | SCIPlpiHasBarrierSolve (void) |
#define HIGHS_relDiff | ( | val1, | |
val2 ) |
#define HIGHS_CALL | ( | x | ) |
Macro for a single HiGHS call for which exceptions have to be caught. We make no distinction between different exception types, e.g., between memory allocation and other exceptions. Additionally, we check if HiGHS returns kOk as status and return an LP error if not.
Definition at line 84 of file lpi_highs.cpp.
Referenced by checkMatrixValue(), lpiSolve(), SCIPlpiAddCols(), SCIPlpiAddRows(), SCIPlpiChgBounds(), SCIPlpiChgCoef(), SCIPlpiChgObj(), SCIPlpiChgObjsen(), SCIPlpiChgSides(), SCIPlpiClear(), SCIPlpiClearState(), SCIPlpiCreate(), SCIPlpiDelCols(), SCIPlpiDelColset(), SCIPlpiDelRows(), SCIPlpiDelRowset(), SCIPlpiGetBasisInd(), SCIPlpiGetBInvACol(), SCIPlpiGetBInvARow(), SCIPlpiGetBInvCol(), SCIPlpiGetBInvRow(), SCIPlpiGetCoef(), SCIPlpiGetCols(), SCIPlpiGetDualfarkas(), SCIPlpiGetIntpar(), SCIPlpiGetObjval(), SCIPlpiGetPrimalRay(), SCIPlpiGetRealpar(), SCIPlpiGetRows(), SCIPlpiGetSol(), SCIPlpiHasDualRay(), SCIPlpiHasPrimalRay(), SCIPlpiIsStable(), SCIPlpiLoadColLP(), SCIPlpiReadLP(), SCIPlpiReadState(), SCIPlpiScaleCol(), SCIPlpiScaleRow(), SCIPlpiSetBase(), SCIPlpiSetIntpar(), SCIPlpiSetRealpar(), SCIPlpiSolveDual(), SCIPlpiSolvePrimal(), SCIPlpiWriteLP(), and SCIPlpiWriteState().
#define HIGHS_CALL_WITH_WARNING | ( | x | ) |
A relaxed version of HIGHS_CALL that accepts status kWarning.
Definition at line 116 of file lpi_highs.cpp.
Referenced by lpiSolve(), SCIPlpiAddCols(), SCIPlpiAddRows(), and SCIPlpiGetIterations().
#define COLS_PER_PACKET SCIP_DUALPACKETSIZE |
each column needs two bits of information (basic/on_lower/on_upper)
Definition at line 189 of file lpi_highs.cpp.
#define ROWS_PER_PACKET SCIP_DUALPACKETSIZE |
each row needs two bit of information (basic/on_lower/on_upper)
Definition at line 191 of file lpi_highs.cpp.
|
static |
resizes cstat array to have at least num entries
lpi | LP interface structure |
num | minimal number of entries in array |
Definition at line 208 of file lpi_highs.cpp.
References assert(), BMSreallocMemoryArray, SCIP_LPi::cstat, SCIP_LPi::cstatsize, MAX, NULL, SCIP_ALLOC, SCIP_OKAY, and SCIPdebugMessage.
Referenced by SCIPlpiGetState(), and SCIPlpiSetState().
|
static |
resizes rstat array to have at least num entries
lpi | LP interface structure |
num | minimal number of entries in array |
Definition at line 231 of file lpi_highs.cpp.
References assert(), BMSreallocMemoryArray, MAX, NULL, SCIP_LPi::rstat, SCIP_LPi::rstatsize, SCIP_ALLOC, SCIP_OKAY, and SCIPdebugMessage.
Referenced by SCIPlpiGetState(), and SCIPlpiSetState().
|
static |
returns the number of packets needed to store column packet information
ncols | number of columns to store |
Definition at line 259 of file lpi_highs.cpp.
References COLS_PER_PACKET.
Referenced by lpistateCreate(), and lpistateFree().
|
static |
returns the number of packets needed to store row packet information
nrows | number of rows to store |
Definition at line 268 of file lpi_highs.cpp.
References ROWS_PER_PACKET.
Referenced by lpistateCreate(), and lpistateFree().
|
static |
store row and column basis status in a packed LPi state object
lpistate | pointer to LPi state data |
cstat | basis status of columns in unpacked format |
rstat | basis status of rows in unpacked format |
Definition at line 277 of file lpi_highs.cpp.
References assert(), SCIP_LPiState::ncols, SCIP_LPiState::nrows, NULL, SCIP_LPiState::packcstat, SCIP_LPiState::packrstat, and SCIPencodeDualBit().
Referenced by SCIPlpiGetState().
|
static |
unpacks row and column basis status from a packed LPi state object
lpistate | pointer to LPi state data |
cstat | buffer for storing basis status of columns in unpacked format |
rstat | buffer for storing basis status of rows in unpacked format |
Definition at line 293 of file lpi_highs.cpp.
References assert(), SCIP_LPiState::ncols, SCIP_LPiState::nrows, NULL, SCIP_LPiState::packcstat, SCIP_LPiState::packrstat, and SCIPdecodeDualBit().
Referenced by SCIPlpiSetState().
|
static |
creates LPi state information object
lpistate | pointer to LPi state |
blkmem | block memory |
ncols | number of columns to store |
nrows | number of rows to store |
Definition at line 309 of file lpi_highs.cpp.
References assert(), BMSallocBlockMemory, BMSallocBlockMemoryArray, colpacketNum(), NULL, rowpacketNum(), SCIP_ALLOC, and SCIP_OKAY.
Referenced by SCIPlpiGetState().
|
static |
frees LPi state information
lpistate | pointer to LPi state information (like basis information) |
blkmem | block memory |
Definition at line 333 of file lpi_highs.cpp.
References assert(), BMSfreeBlockMemory, BMSfreeBlockMemoryArray, colpacketNum(), NULL, and rowpacketNum().
Referenced by SCIPlpiFreeState().
|
static |
marks the current LP to be unsolved
lpi | LP interface structure |
Definition at line 357 of file lpi_highs.cpp.
References assert(), FALSE, NULL, and SCIP_LPi::solved.
Referenced by SCIPlpiAddCols(), SCIPlpiAddRows(), SCIPlpiChgBounds(), SCIPlpiChgCoef(), SCIPlpiChgObj(), SCIPlpiChgObjsen(), SCIPlpiChgSides(), SCIPlpiClear(), SCIPlpiCreate(), SCIPlpiDelCols(), SCIPlpiDelColset(), SCIPlpiDelRows(), SCIPlpiDelRowset(), SCIPlpiScaleCol(), and SCIPlpiScaleRow().
|
static |
converts basis statuses
Definition at line 367 of file lpi_highs.cpp.
References assert(), SCIP_BASESTAT_BASIC, SCIP_BASESTAT_LOWER, SCIP_BASESTAT_UPPER, SCIP_BASESTAT_ZERO, and SCIPerrorMessage.
Referenced by SCIPlpiSetBase().
|
static |
returns a string representation of the simplex strategy parameter
Definition at line 390 of file lpi_highs.cpp.
Referenced by lpiSolve().
|
static |
checks that matrix values are within range defined by HiGHS parameters
lpi | LP interface structure |
value | value of coefficient |
Definition at line 413 of file lpi_highs.cpp.
References assert(), SCIP_LPi::highs, HIGHS_CALL, SCIP_OKAY, and SCIP_Real.
Referenced by SCIPlpiAddCols(), SCIPlpiAddRows(), SCIPlpiChgCoef(), and SCIPlpiLoadColLP().
|
static |
calls HiGHS to solve the LP with given settings
lpi | LP interface structure |
Definition at line 434 of file lpi_highs.cpp.
References assert(), FALSE, SCIP_LPi::fromscratch, SCIP_LPi::highs, HIGHS_CALL, HIGHS_CALL_WITH_WARNING, lpiSolve(), nsolvecalls, NULL, SCIP_LPi::presolve, SCIP_CALL, SCIP_LPERROR, SCIP_OKAY, SCIPdebugMessage, SCIPerrorMessage, simplexStrategyToString(), SCIP_LPi::solved, and TRUE.
Referenced by lpiSolve(), SCIPlpiSolveDual(), and SCIPlpiSolvePrimal().
int nsolvecalls = 0 |
Definition at line 144 of file lpi_highs.cpp.
Referenced by lpiSolve().
|
static |
Definition at line 551 of file lpi_highs.cpp.
Referenced by SCIPlpiGetSolverName().
|
static |
Definition at line 552 of file lpi_highs.cpp.
Referenced by SCIPlpiGetSolverDesc().