Detailed Description
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:
- tune pricing strategy
- tune and activate primal simplex
- tune and activate parallel dual simplex
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) ( ((val1)-(val2))/(MAX3(1.0,REALABS(val1),REALABS(val2))) ) |
#define | HIGHS_CALL(x) |
#define | HIGHS_CALL_WITH_WARNING(x) |
#define | COLS_PER_PACKET SCIP_DUALPACKETSIZE |
#define | ROWS_PER_PACKET SCIP_DUALPACKETSIZE |
Typedefs | |
typedef SCIP_DUALPACKET | COLPACKET |
typedef SCIP_DUALPACKET | ROWPACKET |
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) |
Macro Definition Documentation
◆ HIGHS_relDiff
Definition at line 78 of file lpi_highs.cpp.
Referenced by SCIPlpiIsStable().
◆ HIGHS_CALL
#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().
◆ HIGHS_CALL_WITH_WARNING
#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().
◆ COLS_PER_PACKET
#define COLS_PER_PACKET SCIP_DUALPACKETSIZE |
each column needs two bits of information (basic/on_lower/on_upper)
Definition at line 188 of file lpi_highs.cpp.
Referenced by colpacketNum().
◆ ROWS_PER_PACKET
#define ROWS_PER_PACKET SCIP_DUALPACKETSIZE |
each row needs two bit of information (basic/on_lower/on_upper)
Definition at line 190 of file lpi_highs.cpp.
Referenced by rowpacketNum().
Typedef Documentation
◆ COLPACKET
typedef SCIP_DUALPACKET COLPACKET |
Definition at line 187 of file lpi_highs.cpp.
◆ ROWPACKET
typedef SCIP_DUALPACKET ROWPACKET |
Definition at line 189 of file lpi_highs.cpp.
Function Documentation
◆ ensureCstatMem()
|
static |
resizes cstat array to have at least num entries
- Parameters
-
lpi LP interface structure num minimal number of entries in array
Definition at line 207 of file lpi_highs.cpp.
References BMSreallocMemoryArray, SCIP_LPi::cstat, SCIP_LPi::cstatsize, MAX, NULL, SCIP_ALLOC, SCIP_OKAY, and SCIPdebugMessage.
Referenced by SCIPlpiGetState(), and SCIPlpiSetState().
◆ ensureRstatMem()
|
static |
resizes rstat array to have at least num entries
- Parameters
-
lpi LP interface structure num minimal number of entries in array
Definition at line 230 of file lpi_highs.cpp.
References BMSreallocMemoryArray, MAX, NULL, SCIP_LPi::rstat, SCIP_LPi::rstatsize, SCIP_ALLOC, SCIP_OKAY, and SCIPdebugMessage.
Referenced by SCIPlpiGetState(), and SCIPlpiSetState().
◆ colpacketNum()
|
static |
returns the number of packets needed to store column packet information
- Parameters
-
ncols number of columns to store
Definition at line 258 of file lpi_highs.cpp.
References COLS_PER_PACKET.
Referenced by lpistateCreate(), and lpistateFree().
◆ rowpacketNum()
|
static |
returns the number of packets needed to store row packet information
- Parameters
-
nrows number of rows to store
Definition at line 267 of file lpi_highs.cpp.
References ROWS_PER_PACKET.
Referenced by lpistateCreate(), and lpistateFree().
◆ lpistatePack()
|
static |
store row and column basis status in a packed LPi state object
- Parameters
-
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 276 of file lpi_highs.cpp.
References SCIP_LPiState::ncols, SCIP_LPiState::nrows, NULL, SCIP_LPiState::packcstat, SCIP_LPiState::packrstat, and SCIPencodeDualBit().
Referenced by SCIPlpiGetState().
◆ lpistateUnpack()
|
static |
unpacks row and column basis status from a packed LPi state object
- Parameters
-
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 292 of file lpi_highs.cpp.
References SCIP_LPiState::ncols, SCIP_LPiState::nrows, NULL, SCIP_LPiState::packcstat, SCIP_LPiState::packrstat, and SCIPdecodeDualBit().
Referenced by SCIPlpiSetState().
◆ lpistateCreate()
|
static |
creates LPi state information object
- Parameters
-
lpistate pointer to LPi state blkmem block memory ncols number of columns to store nrows number of rows to store
Definition at line 308 of file lpi_highs.cpp.
References BMSallocBlockMemory, BMSallocBlockMemoryArray, colpacketNum(), NULL, rowpacketNum(), SCIP_ALLOC, and SCIP_OKAY.
Referenced by SCIPlpiGetState().
◆ lpistateFree()
|
static |
frees LPi state information
- Parameters
-
lpistate pointer to LPi state information (like basis information) blkmem block memory
Definition at line 332 of file lpi_highs.cpp.
References BMSfreeBlockMemory, BMSfreeBlockMemoryArray, colpacketNum(), NULL, and rowpacketNum().
Referenced by SCIPlpiFreeState().
◆ invalidateSolution()
|
static |
marks the current LP to be unsolved
- Parameters
-
lpi LP interface structure
Definition at line 356 of file lpi_highs.cpp.
References FALSE, NULL, and SCIP_LPi::solved.
Referenced by SCIPlpiAddCols(), SCIPlpiAddRows(), SCIPlpiChgBounds(), SCIPlpiChgCoef(), SCIPlpiChgObj(), SCIPlpiChgObjsen(), SCIPlpiChgSides(), SCIPlpiClear(), SCIPlpiCreate(), SCIPlpiDelCols(), SCIPlpiDelColset(), SCIPlpiDelRows(), SCIPlpiDelRowset(), SCIPlpiScaleCol(), and SCIPlpiScaleRow().
◆ basestatToHighsBasisStatus()
|
static |
converts basis statuses
Definition at line 366 of file lpi_highs.cpp.
References SCIP_BASESTAT_BASIC, SCIP_BASESTAT_LOWER, SCIP_BASESTAT_UPPER, SCIP_BASESTAT_ZERO, and SCIPerrorMessage.
Referenced by SCIPlpiSetBase().
◆ simplexStrategyToString()
|
static |
returns a string representation of the simplex strategy parameter
Definition at line 389 of file lpi_highs.cpp.
Referenced by lpiSolve().
◆ checkMatrixValue()
|
static |
checks that matrix values are within range defined by HiGHS parameters
- Parameters
-
lpi LP interface structure value value of coefficient
Definition at line 412 of file lpi_highs.cpp.
References SCIP_LPi::highs, HIGHS_CALL, SCIP_OKAY, and SCIP_Real.
Referenced by SCIPlpiAddCols(), SCIPlpiAddRows(), SCIPlpiChgCoef(), and SCIPlpiLoadColLP().
◆ lpiSolve()
|
static |
calls HiGHS to solve the LP with given settings
- Parameters
-
lpi LP interface structure
Definition at line 433 of file lpi_highs.cpp.
References SCIP_LPi::fromscratch, SCIP_LPi::highs, HIGHS_CALL, HIGHS_CALL_WITH_WARNING, nsolvecalls, NULL, SCIP_CALL, SCIP_LPERROR, SCIP_OKAY, SCIPdebugMessage, SCIPerrorMessage, simplexStrategyToString(), SCIP_LPi::solved, and TRUE.
Referenced by SCIPlpiSolveDual(), and SCIPlpiSolvePrimal().
Variable Documentation
◆ nsolvecalls
int nsolvecalls = 0 |
Definition at line 144 of file lpi_highs.cpp.
Referenced by lpiSolve().
◆ highsname
|
static |
Definition at line 548 of file lpi_highs.cpp.
Referenced by SCIPlpiGetSolverName().
◆ highsdesc
|
static |
Definition at line 549 of file lpi_highs.cpp.
Referenced by SCIPlpiGetSolverDesc().