Scippy

SCIP

Solving Constraint Integer Programs

Detailed Description

LP interface for Gurobi.

Author
Marc Pfetsch
Tobias Achterberg
Michael Winkler

This LPI only works with Gurobi versions >= 7.0.2.

Definition in file lpi_grb.c.

#include <assert.h>
#include <string.h>
#include "gurobi_c.h"
#include "lpi/lpi.h"
#include "scip/pub_message.h"
#include "scip/pub_misc_sort.h"
#include "tinycthread/tinycthread.h"

Go to the source code of this file.

Data Structures

struct  SCIP_LPi
 
struct  SCIP_LPiState
 
struct  SCIP_LPiNorms
 

Macros

#define SCIP_REUSEENV
 
#define CHECK_ZERO(messagehdlr, x)
 
#define CHECK_ZERO_STAR(messagehdlr, x)
 
#define SVECTOR   GRBsvec
 
#define SCIP_DUALPACKETSIZE   (sizeof(SCIP_DUALPACKET)*4)
 
#define COLS_PER_PACKET   SCIP_DUALPACKETSIZE
 
#define ROWS_PER_PACKET   SCIP_DUALPACKETSIZE
 
#define GRB_REFACTORMAXITERS   50
 
#define NUMINTPARAM   6
 
#define NUMDBLPARAM   7
 

Typedefs

typedef unsigned int SCIP_DUALPACKET
 
typedef SCIP_DUALPACKET COLPACKET
 
typedef SCIP_DUALPACKET ROWPACKET
 
typedef struct GRBParam GRBPARAM
 

Functions

static SCIP_RETCODE ensureSidechgMem (SCIP_LPI *lpi, int num)
 
static SCIP_RETCODE ensureValMem (SCIP_LPI *lpi, int num)
 
static SCIP_RETCODE ensureCstatMem (SCIP_LPI *lpi, int num)
 
static SCIP_RETCODE ensureRstatMem (SCIP_LPI *lpi, int num)
 
static SCIP_RETCODE ensureRngrowmapMem (SCIP_LPI *lpi, int num)
 
static SCIP_RETCODE ensureRngrowsMem (SCIP_LPI *lpi, int num)
 
static SCIP_RETCODE getBase (SCIP_LPI *lpi, SCIP_Bool *success)
 
static SCIP_RETCODE setBase (SCIP_LPI *lpi)
 
static int colpacketNum (int ncols)
 
static int rowpacketNum (int nrows)
 
static void SCIPencodeDualBitNeg (const int *inp, SCIP_DUALPACKET *out, int count)
 
static void SCIPdecodeDualBitNeg (const SCIP_DUALPACKET *inp, int *out, int count)
 
static void lpistatePack (SCIP_LPISTATE *lpistate, const int *cstat, const int *rstat)
 
static void lpistateUnpack (const SCIP_LPISTATE *lpistate, int *cstat, int *rstat)
 
static SCIP_RETCODE lpistateCreate (SCIP_LPISTATE **lpistate, BMS_BLKMEM *blkmem, int ncols, int nrows, int nrngrows)
 
static void lpistateFree (SCIP_LPISTATE **lpistate, BMS_BLKMEM *blkmem)
 
static SCIP_RETCODE getParameterValues (SCIP_LPI *lpi, GRBPARAM *grbparam)
 
static SCIP_RETCODE checkParameterValues (SCIP_LPI *lpi)
 
static SCIP_RETCODE setParameterValues (SCIP_LPI *lpi, GRBPARAM *grbparam)
 
static void copyParameterValues (GRBPARAM *dest, const GRBPARAM *source)
 
static SCIP_RETCODE getIntParam (SCIP_LPI *lpi, const char *param, int *p)
 
static SCIP_RETCODE setIntParam (SCIP_LPI *lpi, const char *param, int parval)
 
static SCIP_RETCODE getDblParam (SCIP_LPI *lpi, const char *param, double *p)
 
static SCIP_RETCODE setDblParam (SCIP_LPI *lpi, const char *param, double parval)
 
static void invalidateSolution (SCIP_LPI *lpi)
 
static SCIP_RETCODE convertSides (SCIP_LPI *lpi, int nrows, const SCIP_Real *lhs, const SCIP_Real *rhs, int *rngcount)
 
static SCIP_RETCODE reconvertSides (SCIP_LPI *lpi, int firstrow, int lastrow, SCIP_Real *lhs, SCIP_Real *rhs)
 
static SCIP_RETCODE restoreLPData (SCIP_LPI *lpi)
 
static void checkRangeInfo (SCIP_LPI *lpi)
 
static SCIP_RETCODE addRangeVars (SCIP_LPI *lpi)
 
static SCIP_RETCODE delRangeVars (SCIP_LPI *lpi)
 
static void clearRangeInfo (SCIP_LPI *lpi)
 
static SCIP_RETCODE addRangeInfo (SCIP_LPI *lpi, int rngcount, int firstrow)
 
Miscellaneous Methods
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)
 
LPI Creation and Destruction Methods
SCIP_RETCODE SCIPlpiCreate (SCIP_LPI **lpi, SCIP_MESSAGEHDLR *messagehdlr, const char *name, SCIP_OBJSEN objsen)
 
SCIP_RETCODE SCIPlpiFree (SCIP_LPI **lpi)
 
Modification Methods
SCIP_RETCODE SCIPlpiLoadColLP (SCIP_LPI *lpi, SCIP_OBJSEN objsen, int ncols, const SCIP_Real *obj, const SCIP_Real *lb, const SCIP_Real *ub, char **colnames, int nrows, const SCIP_Real *lhs, const SCIP_Real *rhs, char **rownames, int nnonz, const int *beg, const int *ind, const SCIP_Real *val)
 
SCIP_RETCODE SCIPlpiAddCols (SCIP_LPI *lpi, int ncols, const SCIP_Real *obj, const SCIP_Real *lb, const SCIP_Real *ub, char **colnames, int nnonz, const int *beg, const int *ind, const SCIP_Real *val)
 
SCIP_RETCODE SCIPlpiDelCols (SCIP_LPI *lpi, int firstcol, int lastcol)
 
SCIP_RETCODE SCIPlpiDelColset (SCIP_LPI *lpi, int *dstat)
 
SCIP_RETCODE SCIPlpiAddRows (SCIP_LPI *lpi, int nrows, const SCIP_Real *lhs, const SCIP_Real *rhs, char **rownames, int nnonz, const int *beg, const int *ind, const SCIP_Real *val)
 
SCIP_RETCODE SCIPlpiDelRows (SCIP_LPI *lpi, int firstrow, int lastrow)
 
SCIP_RETCODE SCIPlpiDelRowset (SCIP_LPI *lpi, int *dstat)
 
SCIP_RETCODE SCIPlpiClear (SCIP_LPI *lpi)
 
SCIP_RETCODE SCIPlpiChgBounds (SCIP_LPI *lpi, int ncols, const int *ind, const SCIP_Real *lb, const SCIP_Real *ub)
 
SCIP_RETCODE SCIPlpiChgSides (SCIP_LPI *lpi, int nrows, const int *ind, const SCIP_Real *lhs, const SCIP_Real *rhs)
 
SCIP_RETCODE SCIPlpiChgCoef (SCIP_LPI *lpi, int row, int col, SCIP_Real newval)
 
SCIP_RETCODE SCIPlpiChgObjsen (SCIP_LPI *lpi, SCIP_OBJSEN objsen)
 
SCIP_RETCODE SCIPlpiChgObj (SCIP_LPI *lpi, int ncols, const int *ind, const SCIP_Real *obj)
 
SCIP_RETCODE SCIPlpiScaleRow (SCIP_LPI *lpi, int row, SCIP_Real scaleval)
 
SCIP_RETCODE SCIPlpiScaleCol (SCIP_LPI *lpi, int col, SCIP_Real scaleval)
 
Data Accessing Methods
SCIP_RETCODE SCIPlpiGetNRows (SCIP_LPI *lpi, int *nrows)
 
SCIP_RETCODE SCIPlpiGetNCols (SCIP_LPI *lpi, int *ncols)
 
SCIP_RETCODE SCIPlpiGetNNonz (SCIP_LPI *lpi, int *nnonz)
 
SCIP_RETCODE SCIPlpiGetCols (SCIP_LPI *lpi, int firstcol, int lastcol, SCIP_Real *lb, SCIP_Real *ub, int *nnonz, int *beg, int *ind, SCIP_Real *val)
 
SCIP_RETCODE SCIPlpiGetRows (SCIP_LPI *lpi, int firstrow, int lastrow, SCIP_Real *lhs, SCIP_Real *rhs, int *nnonz, int *beg, int *ind, SCIP_Real *val)
 
SCIP_RETCODE SCIPlpiGetColNames (SCIP_LPI *lpi, int firstcol, int lastcol, char **colnames, char *namestorage, int namestoragesize, int *storageleft)
 
SCIP_RETCODE SCIPlpiGetRowNames (SCIP_LPI *lpi, int firstrow, int lastrow, char **rownames, char *namestorage, int namestoragesize, int *storageleft)
 
SCIP_RETCODE SCIPlpiGetObjsen (SCIP_LPI *lpi, SCIP_OBJSEN *objsen)
 
SCIP_RETCODE SCIPlpiGetObj (SCIP_LPI *lpi, int firstcol, int lastcol, SCIP_Real *vals)
 
SCIP_RETCODE SCIPlpiGetBounds (SCIP_LPI *lpi, int firstcol, int lastcol, SCIP_Real *lbs, SCIP_Real *ubs)
 
SCIP_RETCODE SCIPlpiGetSides (SCIP_LPI *lpi, int firstrow, int lastrow, SCIP_Real *lhss, SCIP_Real *rhss)
 
SCIP_RETCODE SCIPlpiGetCoef (SCIP_LPI *lpi, int row, int col, SCIP_Real *val)
 
Solving Methods
SCIP_RETCODE SCIPlpiSolvePrimal (SCIP_LPI *lpi)
 
SCIP_RETCODE SCIPlpiSolveDual (SCIP_LPI *lpi)
 
SCIP_RETCODE SCIPlpiSolveBarrier (SCIP_LPI *lpi, SCIP_Bool crossover)
 
SCIP_RETCODE SCIPlpiStartStrongbranch (SCIP_LPI *lpi)
 
SCIP_RETCODE SCIPlpiEndStrongbranch (SCIP_LPI *lpi)
 
static SCIP_RETCODE lpiStrongbranch (SCIP_LPI *lpi, int col, SCIP_Real psol, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter)
 
SCIP_RETCODE SCIPlpiStrongbranchFrac (SCIP_LPI *lpi, int col, SCIP_Real psol, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter)
 
SCIP_RETCODE SCIPlpiStrongbranchesFrac (SCIP_LPI *lpi, int *cols, int ncols, SCIP_Real *psols, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter)
 
SCIP_RETCODE SCIPlpiStrongbranchInt (SCIP_LPI *lpi, int col, SCIP_Real psol, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter)
 
SCIP_RETCODE SCIPlpiStrongbranchesInt (SCIP_LPI *lpi, int *cols, int ncols, SCIP_Real *psols, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter)
 
Solution Information Methods
SCIP_Bool SCIPlpiWasSolved (SCIP_LPI *lpi)
 
SCIP_RETCODE SCIPlpiGetSolFeasibility (SCIP_LPI *lpi, SCIP_Bool *primalfeasible, SCIP_Bool *dualfeasible)
 
SCIP_Bool SCIPlpiExistsPrimalRay (SCIP_LPI *lpi)
 
SCIP_Bool SCIPlpiHasPrimalRay (SCIP_LPI *lpi)
 
SCIP_Bool SCIPlpiIsPrimalUnbounded (SCIP_LPI *lpi)
 
SCIP_Bool SCIPlpiIsPrimalInfeasible (SCIP_LPI *lpi)
 
SCIP_Bool SCIPlpiIsPrimalFeasible (SCIP_LPI *lpi)
 
SCIP_Bool SCIPlpiExistsDualRay (SCIP_LPI *lpi)
 
SCIP_Bool SCIPlpiHasDualRay (SCIP_LPI *lpi)
 
SCIP_Bool SCIPlpiIsDualUnbounded (SCIP_LPI *lpi)
 
SCIP_Bool SCIPlpiIsDualInfeasible (SCIP_LPI *lpi)
 
SCIP_Bool SCIPlpiIsDualFeasible (SCIP_LPI *lpi)
 
SCIP_Bool SCIPlpiIsOptimal (SCIP_LPI *lpi)
 
SCIP_Bool SCIPlpiIsStable (SCIP_LPI *lpi)
 
SCIP_Bool SCIPlpiIsObjlimExc (SCIP_LPI *lpi)
 
SCIP_Bool SCIPlpiIsIterlimExc (SCIP_LPI *lpi)
 
SCIP_Bool SCIPlpiIsTimelimExc (SCIP_LPI *lpi)
 
int SCIPlpiGetInternalStatus (SCIP_LPI *lpi)
 
SCIP_RETCODE SCIPlpiIgnoreInstability (SCIP_LPI *lpi, SCIP_Bool *success)
 
SCIP_RETCODE SCIPlpiGetObjval (SCIP_LPI *lpi, SCIP_Real *objval)
 
SCIP_RETCODE SCIPlpiGetSol (SCIP_LPI *lpi, SCIP_Real *objval, SCIP_Real *primsol, SCIP_Real *dualsol, SCIP_Real *activity, SCIP_Real *redcost)
 
SCIP_RETCODE SCIPlpiGetPrimalRay (SCIP_LPI *lpi, SCIP_Real *ray)
 
SCIP_RETCODE SCIPlpiGetDualfarkas (SCIP_LPI *lpi, SCIP_Real *dualfarkas)
 
SCIP_RETCODE SCIPlpiGetIterations (SCIP_LPI *lpi, int *iterations)
 
SCIP_RETCODE SCIPlpiGetRealSolQuality (SCIP_LPI *lpi, SCIP_LPSOLQUALITY qualityindicator, SCIP_Real *quality)
 
LP Basis Methods
SCIP_RETCODE SCIPlpiGetBase (SCIP_LPI *lpi, int *cstat, int *rstat)
 
SCIP_RETCODE SCIPlpiSetBase (SCIP_LPI *lpi, const int *cstat, const int *rstat)
 
SCIP_RETCODE SCIPlpiGetBasisInd (SCIP_LPI *lpi, int *bind)
 
SCIP_RETCODE SCIPlpiGetBInvRow (SCIP_LPI *lpi, int r, SCIP_Real *coef, int *inds, int *ninds)
 
SCIP_RETCODE SCIPlpiGetBInvCol (SCIP_LPI *lpi, int c, SCIP_Real *coef, int *inds, int *ninds)
 
SCIP_RETCODE SCIPlpiGetBInvARow (SCIP_LPI *lpi, int r, const SCIP_Real *binvrow, SCIP_Real *coef, int *inds, int *ninds)
 
SCIP_RETCODE SCIPlpiGetBInvACol (SCIP_LPI *lpi, int c, SCIP_Real *coef, int *inds, int *ninds)
 
LP State Methods
SCIP_RETCODE SCIPlpiGetState (SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPISTATE **lpistate)
 
SCIP_RETCODE SCIPlpiSetState (SCIP_LPI *lpi, BMS_BLKMEM *blkmem, const SCIP_LPISTATE *lpistate)
 
SCIP_RETCODE SCIPlpiClearState (SCIP_LPI *lpi)
 
SCIP_RETCODE SCIPlpiFreeState (SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPISTATE **lpistate)
 
SCIP_Bool SCIPlpiHasStateBasis (SCIP_LPI *lpi, SCIP_LPISTATE *lpistate)
 
SCIP_RETCODE SCIPlpiReadState (SCIP_LPI *lpi, const char *fname)
 
SCIP_RETCODE SCIPlpiWriteState (SCIP_LPI *lpi, const char *fname)
 
LP Pricing Norms Methods
SCIP_RETCODE SCIPlpiGetNorms (SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPINORMS **lpinorms)
 
SCIP_RETCODE SCIPlpiSetNorms (SCIP_LPI *lpi, BMS_BLKMEM *blkmem, const SCIP_LPINORMS *lpinorms)
 
SCIP_RETCODE SCIPlpiFreeNorms (SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPINORMS **lpinorms)
 
Parameter Methods
SCIP_RETCODE SCIPlpiGetIntpar (SCIP_LPI *lpi, SCIP_LPPARAM type, int *ival)
 
SCIP_RETCODE SCIPlpiSetIntpar (SCIP_LPI *lpi, SCIP_LPPARAM type, int ival)
 
SCIP_RETCODE SCIPlpiGetRealpar (SCIP_LPI *lpi, SCIP_LPPARAM type, SCIP_Real *dval)
 
SCIP_RETCODE SCIPlpiSetRealpar (SCIP_LPI *lpi, SCIP_LPPARAM type, SCIP_Real dval)
 
SCIP_RETCODE SCIPlpiInterrupt (SCIP_LPI *lpi, SCIP_Bool interrupt)
 
Numerical Methods
SCIP_Real SCIPlpiInfinity (SCIP_LPI *lpi)
 
SCIP_Bool SCIPlpiIsInfinity (SCIP_LPI *lpi, SCIP_Real val)
 
File Interface Methods
SCIP_RETCODE SCIPlpiReadLP (SCIP_LPI *lpi, const char *fname)
 
SCIP_RETCODE SCIPlpiWriteLP (SCIP_LPI *lpi, const char *fname)
 

Variables

static GRBenv * reusegrbenv = NULL
 
static int numlp = 0
 
static const char * intparam [NUMINTPARAM]
 
static const char * dblparam [NUMDBLPARAM]
 
static const double dblparammin [NUMDBLPARAM]
 
static const char grbname []
 

Macro Definition Documentation

◆ SCIP_REUSEENV

#define SCIP_REUSEENV

Definition at line 67 of file lpi_grb.c.

◆ CHECK_ZERO

◆ CHECK_ZERO_STAR

#define CHECK_ZERO_STAR (   messagehdlr,
  x 
)
Value:
do { int _restat_; \
if( (_restat_ = (x)) != 0 ) \
{ \
SCIPmessagePrintWarning((messagehdlr), "Gurobi error %d: %s\n", _restat_, GRBgeterrormsg((*lpi)->grbenv)); \
return SCIP_LPERROR; \
} \
} while(0)
SCIP_VAR ** x
Definition: circlepacking.c:63

Definition at line 80 of file lpi_grb.c.

Referenced by SCIPlpiCreate(), and SCIPlpiFree().

◆ SVECTOR

#define SVECTOR   GRBsvec

◆ SCIP_DUALPACKETSIZE

#define SCIP_DUALPACKETSIZE   (sizeof(SCIP_DUALPACKET)*4)

each entry needs two bits of information

Definition at line 93 of file lpi_grb.c.

Referenced by SCIPdecodeDualBitNeg(), and SCIPencodeDualBitNeg().

◆ COLS_PER_PACKET

#define COLS_PER_PACKET   SCIP_DUALPACKETSIZE

Definition at line 96 of file lpi_grb.c.

Referenced by colpacketNum().

◆ ROWS_PER_PACKET

#define ROWS_PER_PACKET   SCIP_DUALPACKETSIZE

Definition at line 98 of file lpi_grb.c.

Referenced by rowpacketNum().

◆ GRB_REFACTORMAXITERS

#define GRB_REFACTORMAXITERS   50

maximal number of iterations allowed for producing a refactorization of the basis

Definition at line 104 of file lpi_grb.c.

Referenced by restoreLPData().

◆ NUMINTPARAM

#define NUMINTPARAM   6

number of Gurobi integer parameters that can be changed

Definition at line 108 of file lpi_grb.c.

Referenced by checkParameterValues(), copyParameterValues(), getIntParam(), getParameterValues(), setIntParam(), and setParameterValues().

◆ NUMDBLPARAM

#define NUMDBLPARAM   7

number of Gurobi double parameters that can be changed

Definition at line 121 of file lpi_grb.c.

Referenced by checkParameterValues(), copyParameterValues(), getDblParam(), getParameterValues(), setDblParam(), and setParameterValues().

Typedef Documentation

◆ SCIP_DUALPACKET

typedef unsigned int SCIP_DUALPACKET

storing bit pairs in packed format

Definition at line 92 of file lpi_grb.c.

◆ COLPACKET

each column needs two bits of information (basic/on_lower/on_upper)

Definition at line 95 of file lpi_grb.c.

◆ ROWPACKET

each row needs two bit of information (basic/on_lower/on_upper)

Definition at line 97 of file lpi_grb.c.

◆ GRBPARAM

typedef struct GRBParam GRBPARAM

Definition at line 152 of file lpi_grb.c.

Function Documentation

◆ ensureSidechgMem()

static SCIP_RETCODE ensureSidechgMem ( SCIP_LPI lpi,
int  num 
)
static

resizes senarray to have at least num entries

Parameters
lpiLP interface structure
numminimal number of entries in array

Definition at line 224 of file lpi_grb.c.

References BMSreallocMemoryArray, MAX, NULL, SCIP_LPi::rhsarray, SCIP_LPi::rngarray, SCIP_LPi::rngidxarray, SCIP_ALLOC, SCIP_OKAY, SCIP_LPi::senarray, and SCIP_LPi::sidechgsize.

Referenced by SCIPlpiAddRows(), SCIPlpiChgSides(), SCIPlpiGetBase(), SCIPlpiGetRows(), SCIPlpiGetSides(), SCIPlpiGetSol(), and SCIPlpiLoadColLP().

◆ ensureValMem()

static SCIP_RETCODE ensureValMem ( SCIP_LPI lpi,
int  num 
)
static

resizes valarray and indarray to have at least num entries

Parameters
lpiLP interface structure
numminimal number of entries in array

Definition at line 249 of file lpi_grb.c.

References BMSreallocMemoryArray, SCIP_LPi::indarray, MAX, NULL, SCIP_ALLOC, SCIP_OKAY, SCIP_LPi::valarray, and SCIP_LPi::valsize.

Referenced by SCIPlpiScaleCol(), and SCIPlpiScaleRow().

◆ ensureCstatMem()

static SCIP_RETCODE ensureCstatMem ( SCIP_LPI lpi,
int  num 
)
static

resizes cstat array to have at least num entries

Parameters
lpiLP interface structure
numminimal number of entries in array

Definition at line 272 of file lpi_grb.c.

References BMSreallocMemoryArray, SCIP_LPi::cstat, SCIP_LPi::cstatsize, MAX, NULL, SCIP_ALLOC, and SCIP_OKAY.

Referenced by getBase(), SCIPlpiSetBase(), and SCIPlpiSetState().

◆ ensureRstatMem()

static SCIP_RETCODE ensureRstatMem ( SCIP_LPI lpi,
int  num 
)
static

resizes rstat array to have at least num entries

Parameters
lpiLP interface structure
numminimal number of entries in array

Definition at line 294 of file lpi_grb.c.

References BMSreallocMemoryArray, MAX, NULL, SCIP_LPi::rstat, SCIP_LPi::rstatsize, SCIP_ALLOC, and SCIP_OKAY.

Referenced by getBase(), SCIPlpiSetBase(), and SCIPlpiSetState().

◆ ensureRngrowmapMem()

static SCIP_RETCODE ensureRngrowmapMem ( SCIP_LPI lpi,
int  num 
)
static

resizes rngrowmap array to have at least num entries

Parameters
lpiLP interface structure
numminimal number of entries in array

Definition at line 316 of file lpi_grb.c.

References BMSreallocMemoryArray, MAX, NULL, r, SCIP_LPi::rngrowmap, SCIP_LPi::rngrowmapsize, SCIP_ALLOC, and SCIP_OKAY.

Referenced by addRangeInfo(), SCIPlpiAddRows(), and SCIPlpiChgSides().

◆ ensureRngrowsMem()

static SCIP_RETCODE ensureRngrowsMem ( SCIP_LPI lpi,
int  num 
)
static

resizes rngrows and rngvals arrays to have at least num entries

Parameters
lpiLP interface structure
numminimal number of entries in array

Definition at line 341 of file lpi_grb.c.

References BMSreallocMemoryArray, MAX, NULL, SCIP_LPi::rngrows, SCIP_LPi::rngrowssize, SCIP_LPi::rngvals, SCIP_ALLOC, and SCIP_OKAY.

Referenced by addRangeInfo(), and SCIPlpiChgSides().

◆ getBase()

static SCIP_RETCODE getBase ( SCIP_LPI lpi,
SCIP_Bool success 
)
static

stores current basis in internal arrays of LPI data structure

Parameters
lpiLP interface structure
successwhether basis information has successfully been obtained

Definition at line 364 of file lpi_grb.c.

References CHECK_ZERO, SCIP_LPi::cstat, ensureCstatMem(), ensureRstatMem(), FALSE, SCIP_LPi::grbenv, SCIP_LPi::grbmodel, SCIP_LPi::messagehdlr, NULL, SCIP_LPi::rstat, SCIP_CALL, SCIP_LPERROR, SCIP_OKAY, SCIPdebugMessage, SCIPerrorMessage, and TRUE.

Referenced by lpiStrongbranch(), and SCIPlpiGetState().

◆ setBase()

static SCIP_RETCODE setBase ( SCIP_LPI lpi)
static

loads basis stored in internal arrays of LPI data structure into Gurobi

Parameters
lpiLP interface structure

Definition at line 422 of file lpi_grb.c.

References CHECK_ZERO, SCIP_LPi::cstat, SCIP_LPi::grbmodel, SCIP_LPi::messagehdlr, NULL, SCIP_LPi::rstat, SCIP_OKAY, and SCIPdebugMessage.

Referenced by lpiStrongbranch(), and SCIPlpiSetState().

◆ colpacketNum()

static int colpacketNum ( int  ncols)
static

returns the number of packets needed to store column packet information

Parameters
ncolsnumber of columns to store

Definition at line 455 of file lpi_grb.c.

References COLS_PER_PACKET.

Referenced by lpistateCreate(), and lpistateFree().

◆ rowpacketNum()

static int rowpacketNum ( int  nrows)
static

returns the number of packets needed to store row packet information

Parameters
nrowsnumber of rows to store

Definition at line 464 of file lpi_grb.c.

References ROWS_PER_PACKET.

Referenced by lpistateCreate(), and lpistateFree().

◆ SCIPencodeDualBitNeg()

static void SCIPencodeDualBitNeg ( const int *  inp,
SCIP_DUALPACKET out,
int  count 
)
static

encode a negated dual bit vector into packed format

Parameters
inpunpacked input vector
outbuffer to store the packed vector
countnumber of elements

Definition at line 476 of file lpi_grb.c.

References NULL, and SCIP_DUALPACKETSIZE.

Referenced by lpistatePack().

◆ SCIPdecodeDualBitNeg()

static void SCIPdecodeDualBitNeg ( const SCIP_DUALPACKET inp,
int *  out,
int  count 
)
static

decode a packed dual bit vector into negated unpacked format

Parameters
inppacked input vector
outbuffer to store unpacked vector
countnumber of elements

Definition at line 547 of file lpi_grb.c.

References NULL, and SCIP_DUALPACKETSIZE.

Referenced by lpistateUnpack().

◆ lpistatePack()

static void lpistatePack ( SCIP_LPISTATE lpistate,
const int *  cstat,
const int *  rstat 
)
static

store row and column basis status in a packed LPi state object

Parameters
lpistatepointer to LPi state data
cstatbasis status of columns in unpacked format
rstatbasis status of rows in unpacked format

Definition at line 623 of file lpi_grb.c.

References SCIP_LPiState::ncols, SCIP_LPiState::nrngrows, SCIP_LPiState::nrows, NULL, SCIP_LPiState::packcstat, SCIP_LPiState::packrstat, and SCIPencodeDualBitNeg().

Referenced by SCIPlpiGetState().

◆ lpistateUnpack()

static void lpistateUnpack ( const SCIP_LPISTATE lpistate,
int *  cstat,
int *  rstat 
)
static

unpacks row and column basis status from a packed LPi state object

Parameters
lpistatepointer to LPi state data
cstatbuffer for storing basis status of columns in unpacked format
rstatbuffer for storing basis status of rows in unpacked format

Definition at line 639 of file lpi_grb.c.

References SCIP_LPiState::ncols, SCIP_LPiState::nrngrows, SCIP_LPiState::nrows, NULL, SCIP_LPiState::packcstat, SCIP_LPiState::packrstat, and SCIPdecodeDualBitNeg().

Referenced by SCIPlpiSetState().

◆ lpistateCreate()

static SCIP_RETCODE lpistateCreate ( SCIP_LPISTATE **  lpistate,
BMS_BLKMEM blkmem,
int  ncols,
int  nrows,
int  nrngrows 
)
static

creates LPi state information object

Parameters
lpistatepointer to LPi state
blkmemblock memory
ncolsnumber of columns to store
nrowsnumber of rows to store
nrngrowsnumber of ranged rows

Definition at line 655 of file lpi_grb.c.

References BMSallocBlockMemory, BMSallocBlockMemoryArray, colpacketNum(), NULL, rowpacketNum(), SCIP_ALLOC, and SCIP_OKAY.

Referenced by SCIPlpiGetState().

◆ lpistateFree()

static void lpistateFree ( SCIP_LPISTATE **  lpistate,
BMS_BLKMEM blkmem 
)
static

frees LPi state information

Parameters
lpistatepointer to LPi state information (like basis information)
blkmemblock memory

Definition at line 677 of file lpi_grb.c.

References BMSfreeBlockMemory, BMSfreeBlockMemoryArrayNull, colpacketNum(), NULL, and rowpacketNum().

Referenced by SCIPlpiFreeState().

◆ getParameterValues()

static SCIP_RETCODE getParameterValues ( SCIP_LPI lpi,
GRBPARAM grbparam 
)
static

gets all Gurobi parameters used in LPI

Parameters
lpiLP interface structure
grbparamGurobi parameters

Definition at line 699 of file lpi_grb.c.

References CHECK_ZERO, dblparam, SCIP_LPi::grbenv, intparam, SCIP_LPi::messagehdlr, NULL, NUMDBLPARAM, NUMINTPARAM, SCIP_OKAY, and SCIPdebugMessage.

Referenced by checkParameterValues(), and SCIPlpiCreate().

◆ checkParameterValues()

static SCIP_RETCODE checkParameterValues ( SCIP_LPI lpi)
static

in debug mode, checks validity of Gurobi parameters

Parameters
lpiLP interface structure

Definition at line 726 of file lpi_grb.c.

References SCIP_LPi::curparam, dblparammin, SCIP_CPXParam::dblparval, getParameterValues(), SCIP_CPXParam::intparval, MAX, NUMDBLPARAM, NUMINTPARAM, SCIP_CALL, and SCIP_OKAY.

Referenced by setParameterValues().

◆ setParameterValues()

static SCIP_RETCODE setParameterValues ( SCIP_LPI lpi,
GRBPARAM grbparam 
)
static

◆ copyParameterValues()

static void copyParameterValues ( GRBPARAM dest,
const GRBPARAM source 
)
static

copies Gurobi parameters from source to dest

Parameters
destdestination Gurobi parameters
sourceoriginal Gurobi parameters

Definition at line 787 of file lpi_grb.c.

References NUMDBLPARAM, and NUMINTPARAM.

Referenced by SCIPlpiCreate().

◆ getIntParam()

static SCIP_RETCODE getIntParam ( SCIP_LPI lpi,
const char *  param,
int *  p 
)
static

gets a single integer parameter value

Parameters
lpiLP interface structure
paramparameter name
pvalue of parameter

Definition at line 802 of file lpi_grb.c.

References SCIP_LPi::grbparam, intparam, NULL, NUMINTPARAM, SCIP_LPERROR, SCIP_OKAY, and SCIPerrorMessage.

Referenced by SCIPlpiGetIntpar().

◆ setIntParam()

static SCIP_RETCODE setIntParam ( SCIP_LPI lpi,
const char *  param,
int  parval 
)
static

sets a single integer parameter value

Parameters
lpiLP interface structure
paramparameter name
parvalvalue of parameter

Definition at line 827 of file lpi_grb.c.

References SCIP_LPi::grbparam, intparam, NULL, NUMINTPARAM, SCIP_LPERROR, SCIP_OKAY, and SCIPerrorMessage.

Referenced by SCIPlpiSetIntpar().

◆ getDblParam()

static SCIP_RETCODE getDblParam ( SCIP_LPI lpi,
const char *  param,
double *  p 
)
static

gets a single double parameter value

Parameters
lpiLP interface structure
paramparameter name
pvalue of parameter

Definition at line 852 of file lpi_grb.c.

References dblparam, SCIP_LPi::grbparam, NULL, NUMDBLPARAM, SCIP_LPERROR, SCIP_OKAY, and SCIPerrorMessage.

Referenced by lpiStrongbranch(), SCIPlpiGetIntpar(), SCIPlpiGetObjval(), SCIPlpiGetRealpar(), and SCIPlpiSolveDual().

◆ setDblParam()

static SCIP_RETCODE setDblParam ( SCIP_LPI lpi,
const char *  param,
double  parval 
)
static

sets a single double parameter value

Parameters
lpiLP interface structure
paramparameter name
parvalvalue of parameter

Definition at line 877 of file lpi_grb.c.

References dblparam, SCIP_LPi::grbparam, NULL, NUMDBLPARAM, SCIP_LPERROR, SCIP_OKAY, and SCIPerrorMessage.

Referenced by lpiStrongbranch(), SCIPlpiSetIntpar(), and SCIPlpiSetRealpar().

◆ invalidateSolution()

◆ convertSides()

static SCIP_RETCODE convertSides ( SCIP_LPI lpi,
int  nrows,
const SCIP_Real lhs,
const SCIP_Real rhs,
int *  rngcount 
)
static

converts SCIP's lhs/rhs pairs into Gurobi's sen/rhs

Parameters
lpiLP interface structure
nrowsnumber of rows
lhsleft hand side vector
rhsright hand side vector
rngcountnumber of ranged rows found

Definition at line 912 of file lpi_grb.c.

References NULL, SCIP_LPi::rhsarray, SCIP_LPi::rngarray, SCIP_LPi::rngidxarray, SCIP_OKAY, and SCIP_LPi::senarray.

Referenced by SCIPlpiAddRows(), SCIPlpiChgSides(), and SCIPlpiLoadColLP().

◆ reconvertSides()

static SCIP_RETCODE reconvertSides ( SCIP_LPI lpi,
int  firstrow,
int  lastrow,
SCIP_Real lhs,
SCIP_Real rhs 
)
static

converts Gurobi's sen/rhs pairs into SCIP's lhs/rhs pairs

Parameters
lpiLP interface structure
firstrowfirst row to get sides for
lastrowlast row to get sides for
lhsbuffer to store the left hand side vector, or NULL
rhsbuffer to store the right hand side vector, or NULL

Definition at line 970 of file lpi_grb.c.

References SCIP_LPi::nrngrows, NULL, SCIP_LPi::rhsarray, SCIP_LPi::rngrowmap, SCIP_LPi::rngvals, SCIP_LPERROR, SCIP_OKAY, SCIPABORT, SCIPerrorMessage, and SCIP_LPi::senarray.

Referenced by SCIPlpiGetRows(), and SCIPlpiGetSides().

◆ restoreLPData()

static SCIP_RETCODE restoreLPData ( SCIP_LPI lpi)
static

after restoring old LP data, need to resolve the LP to be able to retrieve correct information

Parameters
lpiLP interface structure

Definition at line 1033 of file lpi_grb.c.

References CHECK_ZERO, GRB_REFACTORMAXITERS, SCIP_LPi::grbenv, SCIP_LPi::grbmodel, SCIP_LPi::messagehdlr, NULL, SCIP_OKAY, and SCIPmessagePrintWarning().

Referenced by SCIPlpiGetBasisInd(), SCIPlpiGetBInvACol(), SCIPlpiGetBInvARow(), SCIPlpiGetBInvCol(), and SCIPlpiGetBInvRow().

◆ checkRangeInfo()

◆ addRangeVars()

static SCIP_RETCODE addRangeVars ( SCIP_LPI lpi)
static

◆ delRangeVars()

static SCIP_RETCODE delRangeVars ( SCIP_LPI lpi)
static

◆ clearRangeInfo()

static void clearRangeInfo ( SCIP_LPI lpi)
static

◆ addRangeInfo()

static SCIP_RETCODE addRangeInfo ( SCIP_LPI lpi,
int  rngcount,
int  firstrow 
)
static

creates or updates maps for ranged rows after new rows have been added

Parameters
lpiLP interface structure
rngcountnumber of ranged rows added
firstrowindex of first row that was added

Definition at line 1185 of file lpi_grb.c.

References delRangeVars(), ensureRngrowmapMem(), ensureRngrowsMem(), SCIP_LPi::nrngrows, NULL, r, SCIP_LPi::rngarray, SCIP_LPi::rngidxarray, SCIP_LPi::rngrowmap, SCIP_LPi::rngrows, SCIP_LPi::rngvals, SCIP_LPi::rngvarsadded, SCIP_CALL, SCIP_OKAY, SCIPlpiGetNCols(), and SCIPlpiGetNRows().

Referenced by SCIPlpiAddRows(), and SCIPlpiLoadColLP().

Variable Documentation

◆ reusegrbenv

GRBenv* reusegrbenv = NULL
static

global Gurobi environment

Definition at line 65 of file lpi_grb.c.

Referenced by SCIPlpiCreate().

◆ numlp

int numlp = 0
static

number of open LP objects

Definition at line 66 of file lpi_grb.c.

Referenced by SCIPlpiCreate().

◆ intparam

const char* intparam[NUMINTPARAM]
static
Initial value:
=
{
GRB_INT_PAR_SCALEFLAG,
GRB_INT_PAR_PRESOLVE,
GRB_INT_PAR_SIMPLEXPRICING,
GRB_INT_PAR_OUTPUTFLAG,
GRB_INT_PAR_THREADS,
GRB_INT_PAR_SEED
}

Definition at line 110 of file lpi_grb.c.

Referenced by getIntParam(), getParameterValues(), setIntParam(), and setParameterValues().

◆ dblparam

const char* dblparam[NUMDBLPARAM]
static
Initial value:
=
{
GRB_DBL_PAR_FEASIBILITYTOL,
GRB_DBL_PAR_OPTIMALITYTOL,
GRB_DBL_PAR_BARCONVTOL,
GRB_DBL_PAR_CUTOFF,
GRB_DBL_PAR_TIMELIMIT,
GRB_DBL_PAR_ITERATIONLIMIT,
GRB_DBL_PAR_MARKOWITZTOL
}

Definition at line 123 of file lpi_grb.c.

Referenced by getDblParam(), getParameterValues(), setDblParam(), and setParameterValues().

◆ dblparammin

const double dblparammin[NUMDBLPARAM]
static
Initial value:
=
{
+1e-09,
+1e-09,
0.0,
-GRB_INFINITY,
0,
0,
1e-04
}

minimal values for double parameters

Definition at line 135 of file lpi_grb.c.

Referenced by checkParameterValues(), and setParameterValues().

◆ grbname

const char grbname[]
static
Initial value:
= {'G', 'u', 'r', 'o', 'b', 'i', ' ',
GRB_VERSION_MAJOR + '0',
'.', GRB_VERSION_MINOR + '0', '.', GRB_VERSION_TECHNICAL + '0'}

Definition at line 1246 of file lpi_grb.c.

Referenced by SCIPlpiGetSolverName().