LP interface for Xpress-MP.
This interface was revised for Xpress 26. Therefore, we removed all legacy code.
Xpress requires that column and row names are unique. Since column and row names are not needed we ignore all column and row names to avoid the uniqueness issue.
Definition in file lpi_xprs.c.
#include <assert.h>#include <string.h>#include <strings.h>#include "xprs.h"#include "scip/bitencode.h"#include "scip/pub_misc.h"#include "scip/pub_message.h"#include "lpi/lpi.h"#include "tinycthread/tinycthread.h"Go to the source code of this file.
Data Structures | |
| struct | SCIP_LPi |
| struct | SCIP_LPiState |
Macros | |
| #define | XPRS_LPQUICKPRESOLVE 8207 |
| #define | XPRS_LP_OPTIMAL_SCALEDINFEAS 16 |
| #define | CHECK_ZERO(messagehdlr, x) |
| #define | ABORT_ZERO(messagehdlr, retval, x) |
| #define | COLS_PER_PACKET SCIP_DUALPACKETSIZE |
| #define | ROWS_PER_PACKET SCIP_DUALPACKETSIZE |
Miscellaneous Methods | |
| static _Thread_local char | xprsname [100] |
| 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 XPRS_LPQUICKPRESOLVE 8207 |
Definition at line 57 of file lpi_xprs.c.
Referenced by lpiSolve().
| #define XPRS_LP_OPTIMAL_SCALEDINFEAS 16 |
Definition at line 61 of file lpi_xprs.c.
Referenced by lpiSolve(), SCIPlpiIsDualFeasible(), SCIPlpiIsOptimal(), SCIPlpiIsPrimalFeasible(), and SCIPlpiIsStable().
| #define CHECK_ZERO | ( | messagehdlr, | |
| x ) |
Definition at line 63 of file lpi_xprs.c.
Referenced by lpiSolve(), lpiStrongbranch(), lpiStrongbranches(), SCIPlpiAddCols(), SCIPlpiAddRows(), SCIPlpiChgBounds(), SCIPlpiChgCoef(), SCIPlpiChgObj(), SCIPlpiChgObjsen(), SCIPlpiChgSides(), SCIPlpiClear(), SCIPlpiCreate(), SCIPlpiDelCols(), SCIPlpiDelColset(), SCIPlpiDelRows(), SCIPlpiDelRowset(), SCIPlpiFree(), SCIPlpiGetBase(), SCIPlpiGetBasisInd(), SCIPlpiGetBInvACol(), SCIPlpiGetBInvARow(), SCIPlpiGetBInvCol(), SCIPlpiGetBInvRow(), SCIPlpiGetBounds(), SCIPlpiGetCoef(), SCIPlpiGetCols(), SCIPlpiGetDualfarkas(), SCIPlpiGetIntpar(), SCIPlpiGetNCols(), SCIPlpiGetNNonz(), SCIPlpiGetNRows(), SCIPlpiGetObj(), SCIPlpiGetObjsen(), SCIPlpiGetObjval(), SCIPlpiGetPrimalRay(), SCIPlpiGetRealpar(), SCIPlpiGetRows(), SCIPlpiGetSides(), SCIPlpiGetSol(), SCIPlpiGetState(), SCIPlpiLoadColLP(), SCIPlpiReadLP(), SCIPlpiReadState(), SCIPlpiScaleCol(), SCIPlpiScaleRow(), SCIPlpiSetBase(), SCIPlpiSetIntpar(), SCIPlpiSetRealpar(), SCIPlpiSetState(), SCIPlpiSolveBarrier(), SCIPlpiWriteLP(), and SCIPlpiWriteState().
| #define ABORT_ZERO | ( | messagehdlr, | |
| retval, | |||
| x ) |
Definition at line 72 of file lpi_xprs.c.
Referenced by SCIPlpiHasDualRay(), SCIPlpiHasPrimalRay(), SCIPlpiIsDualFeasible(), SCIPlpiIsIterlimExc(), SCIPlpiIsPrimalFeasible(), and SCIPlpiIsTimelimExc().
| #define COLS_PER_PACKET SCIP_DUALPACKETSIZE |
Definition at line 83 of file lpi_xprs.c.
| #define ROWS_PER_PACKET SCIP_DUALPACKETSIZE |
Definition at line 85 of file lpi_xprs.c.
|
static |
check that the column range fits
| lpi | LP interface structure |
| firstcol | first column to be deleted |
| lastcol | last column to be deleted |
Definition at line 144 of file lpi_xprs.c.
References assert(), NULL, and SCIP_LPi::xprslp.
Referenced by SCIPlpiDelCols(), SCIPlpiGetBounds(), SCIPlpiGetColNames(), SCIPlpiGetCols(), and SCIPlpiGetObj().
|
static |
check that the row range fits
| lpi | LP interface structure |
| firstrow | first row to be deleted |
| lastrow | last row to be deleted |
Definition at line 161 of file lpi_xprs.c.
References assert(), NULL, and SCIP_LPi::xprslp.
Referenced by SCIPlpiDelRows(), SCIPlpiGetRowNames(), SCIPlpiGetRows(), and SCIPlpiGetSides().
|
static |
resizes larray and uarray to have at least num entries and fill it with 'L' and 'U' for the lower and upper bound markers
| lpi | LP interface structure |
| num | minimal number of entries in array |
Definition at line 195 of file lpi_xprs.c.
References assert(), BMSreallocMemoryArray, SCIP_LPi::boundchgsize, i, SCIP_LPi::larray, MAX, NULL, SCIP_ALLOC, SCIP_OKAY, and SCIP_LPi::uarray.
Referenced by SCIPlpiChgBounds().
|
static |
resizes senarray, rngarray, and rhsarray to have at least num entries
| lpi | LP interface structure |
| num | minimal number of entries in array |
Definition at line 224 of file lpi_xprs.c.
References assert(), BMSreallocMemoryArray, MAX, NULL, SCIP_LPi::rhsarray, SCIP_LPi::rngarray, SCIP_ALLOC, SCIP_OKAY, SCIP_LPi::senarray, and SCIP_LPi::sidechgsize.
Referenced by SCIPlpiAddRows(), SCIPlpiChgSides(), SCIPlpiGetSides(), SCIPlpiGetSol(), and SCIPlpiLoadColLP().
|
static |
resizes valarray and indarray to have at least num entries
| lpi | LP interface structure |
| num | minimal number of entries in array |
Definition at line 248 of file lpi_xprs.c.
References assert(), BMSreallocMemoryArray, SCIP_LPi::indarray, MAX, NULL, SCIP_ALLOC, SCIP_OKAY, SCIP_LPi::valarray, and SCIP_LPi::valsize.
Referenced by SCIPlpiAddCols(), SCIPlpiAddRows(), SCIPlpiDelCols(), SCIPlpiDelColset(), SCIPlpiDelRows(), SCIPlpiDelRowset(), SCIPlpiGetBInvACol(), SCIPlpiGetBInvARow(), SCIPlpiGetCols(), SCIPlpiGetRows(), SCIPlpiLoadColLP(), SCIPlpiScaleCol(), and SCIPlpiScaleRow().
|
static |
resizes cstat array to have at least num entries
| lpi | LP interface structure |
| num | minimal number of entries in array |
Definition at line 271 of file lpi_xprs.c.
References assert(), BMSreallocMemoryArray, SCIP_LPi::cstat, SCIP_LPi::cstatsize, MAX, NULL, SCIP_ALLOC, and SCIP_OKAY.
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 293 of file lpi_xprs.c.
References assert(), BMSreallocMemoryArray, MAX, NULL, SCIP_LPi::rstat, SCIP_LPi::rstatsize, SCIP_ALLOC, and SCIP_OKAY.
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 323 of file lpi_xprs.c.
References COLS_PER_PACKET.
|
static |
returns the number of packets needed to store row packet information
| nrows | number of rows to store |
Definition at line 332 of file lpi_xprs.c.
References ROWS_PER_PACKET.
|
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 (row status w.r.t. slack columns) |
Definition at line 341 of file lpi_xprs.c.
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 (row status w.r.t. slack columns) |
Definition at line 357 of file lpi_xprs.c.
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 373 of file lpi_xprs.c.
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 394 of file lpi_xprs.c.
References assert(), BMSfreeBlockMemory, BMSfreeBlockMemoryArray, colpacketNum(), NULL, and rowpacketNum().
Referenced by SCIPlpiFreeState().
|
static |
converts SCIP's objective sense into CPLEX's objective sense
| objsen | objective sense |
Definition at line 418 of file lpi_xprs.c.
References SCIP_OBJSEN_MAXIMIZE, SCIP_OBJSEN_MINIMIZE, SCIPABORT, and SCIPerrorMessage.
Referenced by SCIPlpiChgObjsen().
|
static |
converts SCIP's lhs/rhs pairs into Xpress' sen/rhs/rng
| lpi | LP interface structure |
| nrows | number of rows |
| lhss | left hand side vector |
| rhss | right hand side vector |
Definition at line 437 of file lpi_xprs.c.
References assert(), i, NULL, SCIP_LPi::rhsarray, SCIP_LPi::rngarray, SCIP_Real, and SCIP_LPi::senarray.
Referenced by SCIPlpiAddRows(), SCIPlpiChgSides(), and SCIPlpiLoadColLP().
converts Xpress' sen/rhs/rng triplets into SCIP's lhs/rhs pairs
| lpi | LP interface structure |
| nrows | number of rows |
| lhss | buffer to store the left hand side vector |
| rhss | buffer to store the right hand side vector |
Definition at line 486 of file lpi_xprs.c.
References assert(), i, NULL, SCIP_LPi::rhsarray, SCIP_LPi::rngarray, SCIP_Real, SCIPABORT, SCIPerrorMessage, and SCIP_LPi::senarray.
Referenced by reconvertSides().
converts Xpress' sen/rhs/rng triplets into SCIP's lhs/rhs pairs, only storing the left hand side
| lpi | LP interface structure |
| nrows | number of rows |
| lhss | buffer to store the left hand side vector |
Definition at line 535 of file lpi_xprs.c.
References assert(), i, NULL, SCIP_LPi::rhsarray, SCIP_LPi::rngarray, SCIP_Real, SCIPABORT, SCIPerrorMessage, and SCIP_LPi::senarray.
Referenced by reconvertSides().
converts Xpress' sen/rhs/rng triplets into SCIP's lhs/rhs pairs, only storing the right hand side
| lpi | LP interface structure |
| nrows | number of rows |
| rhss | buffer to store the right hand side vector |
Definition at line 580 of file lpi_xprs.c.
References assert(), i, NULL, SCIP_LPi::rhsarray, SCIP_LPi::rngarray, SCIP_Real, SCIPABORT, SCIPerrorMessage, and SCIP_LPi::senarray.
Referenced by reconvertSides().
converts Xpress' sen/rhs/rng triplets into SCIP's lhs/rhs pairs
| lpi | LP interface structure |
| nrows | number of rows |
| lhs | buffer to store the left hand side vector, or NULL |
| rhs | buffer to store the right hand side vector, or NULL |
Definition at line 625 of file lpi_xprs.c.
References NULL, reconvertBothSides(), reconvertLhs(), reconvertRhs(), and SCIP_Real.
Referenced by SCIPlpiGetSides().
|
static |
marks the current LP to be unsolved
Definition at line 645 of file lpi_xprs.c.
References assert(), NULL, and SCIP_LPi::solstat.
Referenced by lpiSolve(), SCIPlpiAddCols(), SCIPlpiAddRows(), SCIPlpiChgBounds(), SCIPlpiChgCoef(), SCIPlpiChgObj(), SCIPlpiChgObjsen(), SCIPlpiChgSides(), SCIPlpiClear(), SCIPlpiCreate(), SCIPlpiDelCols(), SCIPlpiDelColset(), SCIPlpiDelRows(), SCIPlpiDelRowset(), SCIPlpiLoadColLP(), SCIPlpiScaleCol(), SCIPlpiScaleRow(), and SCIPlpiSetBase().
|
static |
solve LP
| lpi | LP interface structure |
| method | indicates the method to use ('p' - primal, 'd' - dual, 'b' - barrier) |
Definition at line 1848 of file lpi_xprs.c.
References assert(), CHECK_ZERO, SCIP_LPi::clearstate, FALSE, invalidateSolution(), SCIP_LPi::iterations, SCIP_LPi::messagehdlr, NULL, SCIP_LPi::par_fastlp, SCIP_LPi::par_presolve, SCIP_OKAY, SCIPdebugMessage, SCIP_LPi::solisbasic, SCIP_LPi::solstat, TRUE, XPRS_LP_OPTIMAL_SCALEDINFEAS, XPRS_LPQUICKPRESOLVE, and SCIP_LPi::xprslp.
Referenced by SCIPlpiSolveBarrier(), SCIPlpiSolveDual(), and SCIPlpiSolvePrimal().
|
static |
performs strong branching iterations on one candidate
| 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 2031 of file lpi_xprs.c.
References assert(), CHECK_ZERO, EPSCEIL, EPSFLOOR, FALSE, SCIP_LPi::messagehdlr, NULL, SCIP_Bool, SCIP_CALL, SCIP_OBJSEN_MINIMIZE, SCIP_OKAY, SCIP_Real, SCIPdebugMessage, SCIPlpiGetObjsen(), TRUE, and SCIP_LPi::xprslp.
Referenced by SCIPlpiStrongbranchFrac(), and SCIPlpiStrongbranchInt().
|
static |
performs strong branching iterations on given candidates
| lpi | LP interface structure |
| cols | columns to apply strong branching on |
| ncols | number of columns |
| psols | current primal solution values of columns (might be integral) |
| itlim | iteration limit for strong branchings |
| down | stores dual bounds after branching columns down |
| up | stores dual bounds after branching columns up |
| downvalid | stores whether the returned down values are valid dual bounds; otherwise, they can only be used as an estimate values |
| upvalid | stores whether the returned up values are a valid dual bounds; otherwise, they can only be used as an estimate values |
| iter | stores total number of strong branching iterations, or -1; may be NULL |
Definition at line 2115 of file lpi_xprs.c.
References assert(), BMSallocMemoryArray, BMSfreeMemoryArray, CHECK_ZERO, EPSCEIL, EPSFLOOR, FALSE, SCIP_LPi::messagehdlr, NULL, SCIP_ALLOC, SCIP_Bool, SCIP_CALL, SCIP_OBJSEN_MINIMIZE, SCIP_OKAY, SCIP_Real, SCIPdebugMessage, SCIPlpiGetObjsen(), TRUE, and SCIP_LPi::xprslp.
Referenced by SCIPlpiStrongbranchesFrac(), and SCIPlpiStrongbranchesInt().
|
static |
Definition at line 663 of file lpi_xprs.c.
Referenced by SCIPlpiGetSolverName().