Detailed Description
LP interface for SoPlex version 1.4 and higher.
This is an implementation of SCIP's LP interface for SoPlex. While the ratio test is fixed to SoPlex's standard, different pricing methods can be chosen and an autopricing strategy (start with devex and switch to steepest edge after too many iterations) is implemented directly. Scaler and simplifier may be applied if solving from scratch.
For debugging purposes, the SoPlex results can be double checked with CPLEX if SCIP_WITH_LPSCHECK is defined. This may yield false positives, since the LP is dumped to a file for transfering it to CPLEX, hence, precision may be lost.
Definition in file lpi_spx1.cpp.
#include "soplex.h"
#include "spxsolver.h"
#include "slufactor.h"
#include "spxsteeppr.h"
#include "spxparmultpr.h"
#include "spxdevexpr.h"
#include "spxfastrt.h"
#include "spxmainsm.h"
#include "spxequilisc.h"
#include "spxboundflippingrt.h"
#include "scip/pub_message.h"
#include <cassert>
#include "lpi/lpi.h"
#include "scip/bitencode.h"
Go to the source code of this file.
Data Structures | |
struct | SCIP_LPi |
struct | SCIP_LPiState |
struct | SCIP_LPiNorms |
Macros | |
#define | AUTOPRICING_ITERSWITCH 10000 |
#define | STRONGBRANCH_RESTOREBASIS |
#define | SOPLEX_SUBVERSION 0 |
#define | SOPLEX_APIVERSION 0 |
#define | WITH_BOUNDFLIPPING |
#define | SOPLEX_VERBLEVEL 5 |
#define | NULL 0 |
#define | SOPLEX_TRY(messagehdlr, x) |
#define | SOPLEX_TRY_ABORT(x) |
#define | COLS_PER_PACKET SCIP_DUALPACKETSIZE |
#define | ROWS_PER_PACKET SCIP_DUALPACKETSIZE |
Typedefs | |
typedef SCIP_DUALPACKET | COLPACKET |
typedef SCIP_DUALPACKET | ROWPACKET |
Variables | |
static const char | spxname [20] = {'S', 'o', 'p', 'l', 'e', 'x', '1', ' ', SOPLEX_VERSION/100 + '0', '.', (SOPLEX_VERSION % 100)/10 + '0', '.', SOPLEX_VERSION % 10 + '0'} |
static char * | spxdesc = initSpxDesc() |
Macro Definition Documentation
◆ AUTOPRICING_ITERSWITCH
#define AUTOPRICING_ITERSWITCH 10000 |
start with devex and switch to steepest edge after this many iterations
Definition at line 43 of file lpi_spx1.cpp.
◆ STRONGBRANCH_RESTOREBASIS
#define STRONGBRANCH_RESTOREBASIS |
if defined then in SCIPlpiStrongbranch() we restore the basis after the down branch and after the up branch; if false only after the end of a strong branching phase, which however seems to mostly increase strong branching time and iterations
Definition at line 44 of file lpi_spx1.cpp.
◆ SOPLEX_SUBVERSION
#define SOPLEX_SUBVERSION 0 |
Definition at line 101 of file lpi_spx1.cpp.
Referenced by invalidateSolution().
◆ SOPLEX_APIVERSION
#define SOPLEX_APIVERSION 0 |
Definition at line 105 of file lpi_spx1.cpp.
◆ WITH_BOUNDFLIPPING
#define WITH_BOUNDFLIPPING |
Definition at line 120 of file lpi_spx1.cpp.
◆ SOPLEX_VERBLEVEL
#define SOPLEX_VERBLEVEL 5 |
verbosity level for LPINFO
Definition at line 154 of file lpi_spx1.cpp.
◆ NULL
#define NULL 0 |
Definition at line 164 of file lpi_spx1.cpp.
Referenced by ensureCstatMem(), ensureRstatMem(), fileExists(), lpiGetBInvVec(), lpistateCreate(), lpistateFree(), lpistatePack(), lpistateUnpack(), lpiStrongbranch(), SCIPlpiAddCols(), SCIPlpiAddRows(), SCIPlpiChgBounds(), SCIPlpiChgCoef(), SCIPlpiChgObj(), SCIPlpiChgObjsen(), SCIPlpiChgSides(), SCIPlpiClear(), SCIPlpiClearState(), SCIPlpiCreate(), SCIPlpiDelCols(), SCIPlpiDelColset(), SCIPlpiDelRows(), SCIPlpiDelRowset(), SCIPlpiEndStrongbranch(), SCIPlpiExistsDualRay(), SCIPlpiExistsPrimalRay(), SCIPlpiFree(), SCIPlpiFreeNorms(), SCIPlpiFreeState(), SCIPlpiGetBase(), SCIPlpiGetBasisInd(), SCIPlpiGetBInvACol(), SCIPlpiGetBInvARow(), SCIPlpiGetBInvCol(), SCIPlpiGetBInvRow(), SCIPlpiGetBounds(), SCIPlpiGetCoef(), SCIPlpiGetColNames(), SCIPlpiGetCols(), SCIPlpiGetDualfarkas(), SCIPlpiGetInternalStatus(), SCIPlpiGetIntpar(), SCIPlpiGetIterations(), SCIPlpiGetNCols(), SCIPlpiGetNNonz(), SCIPlpiGetNorms(), SCIPlpiGetNRows(), SCIPlpiGetObj(), SCIPlpiGetObjsen(), SCIPlpiGetObjval(), SCIPlpiGetPrimalRay(), SCIPlpiGetRealpar(), SCIPlpiGetRealSolQuality(), SCIPlpiGetRowNames(), SCIPlpiGetRows(), SCIPlpiGetSides(), SCIPlpiGetSol(), SCIPlpiGetSolFeasibility(), SCIPlpiGetState(), SCIPlpiHasDualRay(), SCIPlpiHasPrimalRay(), SCIPlpiHasStateBasis(), SCIPlpiIgnoreInstability(), SCIPlpiInterrupt(), SCIPlpiIsDualFeasible(), SCIPlpiIsDualInfeasible(), SCIPlpiIsDualUnbounded(), SCIPlpiIsIterlimExc(), SCIPlpiIsObjlimExc(), SCIPlpiIsOptimal(), SCIPlpiIsPrimalFeasible(), SCIPlpiIsPrimalInfeasible(), SCIPlpiIsPrimalUnbounded(), SCIPlpiIsStable(), SCIPlpiIsTimelimExc(), SCIPlpiLoadColLP(), SCIPlpiReadLP(), SCIPlpiReadState(), SCIPlpiScaleCol(), SCIPlpiScaleRow(), SCIPlpiSetBase(), SCIPlpiSetIntegralityInformation(), SCIPlpiSetIntpar(), SCIPlpiSetNorms(), SCIPlpiSetRealpar(), SCIPlpiSetState(), SCIPlpiSolveBarrier(), SCIPlpiSolveDual(), SCIPlpiSolvePrimal(), SCIPlpiStartStrongbranch(), SCIPlpiStrongbranchesFrac(), SCIPlpiStrongbranchesInt(), SCIPlpiWasSolved(), SCIPlpiWriteLP(), SCIPlpiWriteState(), spxObjsen(), and spxSolve().
◆ SOPLEX_TRY
#define SOPLEX_TRY | ( | messagehdlr, | |
x | |||
) |
Macro for a single SoPlex call for which exceptions have to be catched - return an LP error. We make no distinction between different exception types, e.g., between memory allocation and other exceptions.
Definition at line 175 of file lpi_spx1.cpp.
Referenced by SCIPlpiChgCoef(), SCIPlpiChgObjsen(), SCIPlpiClear(), SCIPlpiCreate(), SCIPlpiDelCols(), SCIPlpiDelColset(), SCIPlpiDelRows(), SCIPlpiDelRowset(), SCIPlpiReadState(), SCIPlpiSetBase(), and SCIPlpiWriteState().
◆ SOPLEX_TRY_ABORT
#define SOPLEX_TRY_ABORT | ( | x | ) |
Definition at line 220 of file lpi_spx1.cpp.
◆ COLS_PER_PACKET
#define COLS_PER_PACKET SCIP_DUALPACKETSIZE |
Definition at line 1398 of file lpi_spx1.cpp.
Referenced by colpacketNum().
◆ ROWS_PER_PACKET
#define ROWS_PER_PACKET SCIP_DUALPACKETSIZE |
Definition at line 1400 of file lpi_spx1.cpp.
Referenced by rowpacketNum().
Typedef Documentation
◆ COLPACKET
typedef SCIP_DUALPACKET COLPACKET |
Definition at line 1397 of file lpi_spx1.cpp.
◆ ROWPACKET
typedef SCIP_DUALPACKET ROWPACKET |
Definition at line 1399 of file lpi_spx1.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 1445 of file lpi_spx1.cpp.
References BMSreallocMemoryArray, SCIP_LPi::cstat, SCIP_LPi::cstatsize, ensureRstatMem(), MAX, NULL, SCIP_ALLOC, and SCIP_OKAY.
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 1467 of file lpi_spx1.cpp.
References BMSreallocMemoryArray, colpacketNum(), MAX, NULL, SCIP_LPi::rstat, SCIP_LPi::rstatsize, SCIP_ALLOC, and SCIP_OKAY.
Referenced by ensureCstatMem(), 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 1496 of file lpi_spx1.cpp.
References COLS_PER_PACKET, and rowpacketNum().
Referenced by ensureRstatMem(), 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 1505 of file lpi_spx1.cpp.
References lpistatePack(), and ROWS_PER_PACKET.
Referenced by colpacketNum(), 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 1514 of file lpi_spx1.cpp.
References lpistateUnpack(), SCIP_LPiState::ncols, SCIP_LPiState::nrows, NULL, SCIP_LPiState::packcstat, SCIP_LPiState::packrstat, and SCIPencodeDualBit().
Referenced by rowpacketNum(), and 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 1530 of file lpi_spx1.cpp.
References lpistateCreate(), SCIP_LPiState::ncols, SCIP_LPiState::nrows, NULL, SCIP_LPiState::packcstat, SCIP_LPiState::packrstat, and SCIPdecodeDualBit().
Referenced by lpistatePack(), and 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 1546 of file lpi_spx1.cpp.
References BMSallocBlockMemory, BMSallocBlockMemoryArray, colpacketNum(), lpistateFree(), NULL, rowpacketNum(), SCIP_ALLOC, and SCIP_OKAY.
Referenced by lpistateUnpack(), and SCIPlpiGetState().
◆ lpistateFree()
|
static |
frees LPi state information
- Parameters
-
lpistate pointer to LPi state information (like basis information) blkmem block memory
Definition at line 1570 of file lpi_spx1.cpp.
References BMSfreeBlockMemory, BMSfreeBlockMemoryArray, colpacketNum(), NULL, rowpacketNum(), and spxObjsen().
Referenced by lpistateCreate(), and SCIPlpiFreeState().
◆ spxObjsen()
|
static |
converts SCIP's objective sense into SoPlex's objective sense
- Parameters
-
objsen SCIP's objective sense value
Definition at line 1596 of file lpi_spx1.cpp.
References invalidateSolution(), NULL, SCIP_OBJSEN_MAXIMIZE, SCIP_OBJSEN_MINIMIZE, SCIPABORT, and SCIPerrorMessage.
Referenced by lpistateFree(), SCIPlpiChgObjsen(), and SCIPlpiLoadColLP().
◆ invalidateSolution()
|
static |
marks the current LP to be unsolved
Definition at line 1615 of file lpi_spx1.cpp.
References SCIP_LPi::factorization, initSpxDesc(), SOPLEX_SUBVERSION, and spxname.
Referenced by SCIPlpiAddCols(), SCIPlpiAddRows(), SCIPlpiChgBounds(), SCIPlpiChgCoef(), SCIPlpiChgObj(), SCIPlpiChgObjsen(), SCIPlpiChgSides(), SCIPlpiClear(), SCIPlpiCreate(), SCIPlpiDelCols(), SCIPlpiDelColset(), SCIPlpiDelRows(), SCIPlpiDelRowset(), SCIPlpiLoadColLP(), SCIPlpiScaleCol(), SCIPlpiScaleRow(), SCIPlpiSetBase(), spxObjsen(), and spxSolve().
◆ initSpxDesc()
char * initSpxDesc | ( | ) |
Definition at line 1647 of file lpi_spx1.cpp.
Referenced by invalidateSolution().
◆ spxSolve()
|
static |
solves LP – used for both, primal and dual simplex, because SoPlex doesn't distinct the two cases
- Parameters
-
lpi LP interface structure rep basis representation type algorithm type
Definition at line 2886 of file lpi_spx1.cpp.
References invalidateSolution(), NULL, SCIP_LPERROR, SCIP_OKAY, SCIPdebugMessage, SCIPlpiSolvePrimal(), SCIP_LPi::solved, SCIP_LPi::spx, TRUE, and UNKNOWN.
Referenced by SCIPlpiGetCoef(), SCIPlpiSolveDual(), and SCIPlpiSolvePrimal().
◆ lpiStrongbranch()
|
static |
performs strong branching iterations on one arbitrary candidate
- Parameters
-
lpi LP interface structure col column to apply strong branching on psol current primal solution value of column itlim iteration limit for strong branchings down stores dual bound after branching column down up stores dual bound after branching column up downvalid stores whether the returned down value is a valid dual bound; otherwise, it can only be used as an estimate value upvalid stores whether the returned up value is a valid dual bound; otherwise, it can only be used as an estimate value iter stores total number of strong branching iterations, or -1; may be NULL
Definition at line 3068 of file lpi_spx1.cpp.
References EPSCEIL, EPSFLOOR, FALSE, NULL, SCIP_LPERROR, SCIP_OKAY, SCIP_Real, SCIPdebugMessage, SCIPlpiStrongbranchFrac(), SCIP_LPi::spx, TRUE, and UNKNOWN.
Referenced by SCIPlpiEndStrongbranch(), SCIPlpiStrongbranchesFrac(), SCIPlpiStrongbranchesInt(), SCIPlpiStrongbranchFrac(), and SCIPlpiStrongbranchInt().
◆ getRedCostEst()
|
static |
Return reduced cost of column col
if this is readily available, otherwise return 0.0
Definition at line 4000 of file lpi_spx1.cpp.
Referenced by SCIPlpiGetBase(), and SCIPlpiGetRealSolQuality().
◆ lpiGetBInvVec()
|
static |
get solution of basis matrix B * coef = rhs
- Parameters
-
lpi LP interface structure rhs right-hand side vector coef vector to return coefficients
Definition at line 4535 of file lpi_spx1.cpp.
References BMSallocMemoryArray, BMSfreeMemoryArray, SCIP_LPi::factorization, SCIP_LPi::messagehdlr, NULL, SCIP_ALLOC, SCIP_CALL, SCIP_LPERROR, SCIP_OKAY, SCIPdebugMessage, SCIPlpiGetBasisInd(), SCIPlpiGetBInvCol(), SCIPmessagePrintWarning(), SCIP_LPi::spx, x, and y.
Referenced by SCIPlpiGetBInvACol(), SCIPlpiGetBInvCol(), and SCIPlpiGetBInvRow().
◆ fileExists()
|
static |
returns, whether the given file exists
- Parameters
-
filename file name
Definition at line 5452 of file lpi_spx1.cpp.
References FALSE, NULL, SCIPlpiReadLP(), and TRUE.
Referenced by SCIPlpiIsInfinity(), and SCIPlpiReadLP().
Variable Documentation
◆ spxname
|
static |
Definition at line 1642 of file lpi_spx1.cpp.
Referenced by invalidateSolution(), and SCIPlpiGetSolverName().
◆ spxdesc
|
static |
Definition at line 1645 of file lpi_spx1.cpp.
Referenced by SCIPlpiGetSolverDesc().