Skip to content
Snippets Groups Projects
Commit 9c99a93d authored by Claus Jonathan Fritzemeier's avatar Claus Jonathan Fritzemeier
Browse files

initial commit of version 1.2.11

parent 59c7a4cb
Branches
No related tags found
No related merge requests found
Package: glpkAPI
Type: Package
Title: R Interface to C API of GLPK
Version: 1.2.11
Date: 2014-11-16
Authors@R: c(person("Gabriel", "Gelius-Dietrich", role = c("aut", "cre"), email = "geliudie@uni-duesseldorf.de"))
Maintainer: Gabriel Gelius-Dietrich <geliudie@uni-duesseldorf.de>
Depends: R (>= 2.6.0)
Imports: methods
Description: R Interface to C API of GLPK, needs GLPK Version >= 4.42
SystemRequirements: GLPK (>= 4.42)
License: GPL-3
LazyLoad: yes
Collate: generics.R glpk_ptrClass.R glpk.R glpkAPI.R zzz.R
Packaged: 2014-11-16 17:16:33 UTC; gabriel
Author: Gabriel Gelius-Dietrich [aut, cre]
NeedsCompilation: yes
Repository: CRAN
Date/Publication: 2014-11-16 22:12:16
NAMESPACE 0 → 100644
useDynLib(glpkAPI)
import(methods)
exportClass("glpkPtr")
export(
# methods
"glpkPointer",
"glpkPtrType",
"glpkPtrType<-",
"isNULLpointerGLPK",
"isGLPKpointer",
"isTRWKSpointer",
# function names
addColsGLPK,
addRowsGLPK,
advBasisGLPK,
bfExistsGLPK,
bfUpdatedGLPK,
checkDupGLPK,
copyProbGLPK,
cpxBasisGLPK,
createIndexGLPK,
delColsGLPK,
deleteIndexGLPK,
delProbGLPK,
delRowsGLPK,
eraseProbGLPK,
factorizeGLPK,
findColGLPK,
findRowGLPK,
getBfcpGLPK,
getBheadGLPK,
getCbindGLPK,
getColDualGLPK,
getColDualIptGLPK,
getColKindGLPK,
getColLowBndGLPK,
getColNameGLPK,
getColPrimGLPK,
getColPrimIptGLPK,
getColsDualGLPK,
getColsDualIptGLPK,
getColsKindGLPK,
getColsLowBndsGLPK,
getColsPrimGLPK,
getColsPrimIptGLPK,
getColsStatGLPK,
getColStatGLPK,
getColsUppBndsGLPK,
getColTypeGLPK,
getColUppBndGLPK,
getDualStatGLPK,
getInteriorParmGLPK,
getMatColGLPK,
getMatRowGLPK,
getMIPParmGLPK,
getNumBinGLPK,
getNumColsGLPK,
getNumIntGLPK,
getNumNnzGLPK,
getNumRowsGLPK,
getObjCoefGLPK,
getObjCoefsGLPK,
getObjDirGLPK,
getObjNameGLPK,
getObjValGLPK,
getObjValIptGLPK,
getPrimStatGLPK,
getProbNameGLPK,
getRbindGLPK,
getRiiGLPK,
getRowDualGLPK,
getRowDualIptGLPK,
getRowLowBndGLPK,
getRowNameGLPK,
getRowPrimGLPK,
getRowPrimIptGLPK,
getRowsDualGLPK,
getRowsDualIptGLPK,
getRowsLowBndsGLPK,
getRowsPrimGLPK,
getRowsPrimIptGLPK,
getRowsStatGLPK,
getRowStatGLPK,
getRowsTypesGLPK,
getRowsUppBndsGLPK,
getRowTypeGLPK,
getRowUppBndGLPK,
getSimplexParmGLPK,
getSjjGLPK,
getSolStatGLPK,
getSolStatIptGLPK,
getUnbndRayGLPK,
initProbGLPK,
loadMatrixGLPK,
mipColsValGLPK,
mipColValGLPK,
mipObjValGLPK,
mipRowsValGLPK,
mipRowValGLPK,
mipStatusGLPK,
mplAllocWkspGLPK,
mplBuildProbGLPK,
mplFreeWkspGLPK,
mplGenerateGLPK,
mplPostsolveGLPK,
mplReadDataGLPK,
mplReadModelGLPK,
printIptGLPK,
printMIPGLPK,
printRangesGLPK,
printSolGLPK,
readIptGLPK,
readLPGLPK,
readMIPGLPK,
readMPSGLPK,
readProbGLPK,
readSolGLPK,
return_codeGLPK,
scaleProbGLPK,
setBfcpGLPK,
setColBndGLPK,
setColKindGLPK,
setColNameGLPK,
setColsBndsGLPK,
setColsBndsObjCoefsGLPK,
setColsKindGLPK,
setColsNamesGLPK,
setColStatGLPK,
setDefaultIptParmGLPK,
setDefaultMIPParmGLPK,
setDefaultSmpParmGLPK,
setInteriorParmGLPK,
setMatColGLPK,
setMatRowGLPK,
setMIPParmGLPK,
setObjCoefGLPK,
setObjCoefsGLPK,
setObjDirGLPK,
setObjNameGLPK,
setProbNameGLPK,
setRhsZeroGLPK,
setRiiGLPK,
setRowBndGLPK,
setRowNameGLPK,
setRowsBndsGLPK,
setRowsNamesGLPK,
setRowStatGLPK,
setSimplexParmGLPK,
setSjjGLPK,
solveInteriorGLPK,
solveMIPGLPK,
solveSimplexExactGLPK,
solveSimplexGLPK,
sortMatrixGLPK,
status_codeGLPK,
stdBasisGLPK,
termOutGLPK,
unscaleProbGLPK,
versionGLPK,
warmUpGLPK,
writeIptGLPK,
writeLPGLPK,
writeMIPGLPK,
writeMPSGLPK,
writeProbGLPK,
writeSolGLPK,
# parameter variable names
BINARIZE,
BR_TECH,
BT_TECH,
CB_SIZE,
CLQ_CUTS,
COV_CUTS,
EPS_TOL,
FP_HEUR,
GLP_BF_BG,
GLP_BF_FT,
GLP_BF_GR,
GLP_BR_DTH,
GLP_BR_FFV,
GLP_BR_LFV,
GLP_BR_MFV,
GLP_BR_PCH,
GLP_BS,
GLP_BT_BFS,
GLP_BT_BLB,
GLP_BT_BPH,
GLP_BT_DFS,
GLP_BV,
GLP_CV,
GLP_DB,
GLP_DN_BRNCH,
GLP_DUAL,
GLP_DUALP,
GLP_EBADB,
GLP_EBOUND,
GLP_ECOND,
GLP_EDATA,
GLP_EFAIL,
GLP_EINSTAB,
GLP_EITLIM,
GLP_EMIPGAP,
GLP_ENOCVG,
GLP_ENODFS,
GLP_ENOFEAS,
GLP_ENOPFS,
GLP_EOBJLL,
GLP_EOBJUL,
GLP_ERANGE,
GLP_EROOT,
GLP_ESING,
GLP_ESTOP,
GLP_ETMLIM,
GLP_FEAS,
GLP_FR,
GLP_FX,
GLP_IBINGO,
GLP_IBRANCH,
GLP_ICUTGEN,
GLP_IHEUR,
GLP_INFEAS,
GLP_IPREPRO,
GLP_IPT,
GLP_IROWGEN,
GLP_ISELECT,
GLP_IV,
GLP_KKT_CS,
GLP_KKT_DB,
GLP_KKT_DE,
GLP_KKT_PB,
GLP_KKT_PE,
GLP_LO,
GLP_MAX,
GLP_MIN,
GLP_MIP,
GLP_MPS_DECK,
GLP_MPS_FILE,
GLP_MSG_ALL,
GLP_MSG_DBG,
GLP_MSG_ERR,
GLP_MSG_OFF,
GLP_MSG_ON,
GLP_NF,
GLP_NL,
GLP_NO_BRNCH,
GLP_NOFEAS,
GLP_NS,
GLP_NU,
GLP_OFF,
GLP_ON,
GLP_OPT,
GLP_ORD_AMD,
GLP_ORD_NONE,
GLP_ORD_QMD,
GLP_ORD_SYMAMD,
GLP_PP_ALL,
GLP_PP_NONE,
GLP_PP_ROOT,
GLP_PRIMAL,
GLP_PT_PSE,
GLP_PT_STD,
GLP_RF_CLQ,
GLP_RF_COV,
GLP_RF_CUT,
GLP_RF_GMI,
GLP_RF_LAZY,
GLP_RF_MIR,
GLP_RF_REG,
GLP_RT_HAR,
GLP_RT_STD,
GLP_SF_2N,
GLP_SF_AUTO,
GLP_SF_EQ,
GLP_SF_GM,
GLP_SF_SKIP,
GLP_SOL,
GLP_UNBND,
GLP_UNDEF,
GLP_UP_BRNCH,
GLP_UP,
CB_FUNC,
GMI_CUTS,
IT_LIM,
LU_SIZE,
MAX_GRO,
METH,
MIP_GAP,
MIR_CUTS,
MSG_LEV,
NFS_MAX,
NRS_MAX,
OBJ_LL,
OBJ_UL,
ORD_ALG,
OUT_DLY,
OUT_FRQ,
PIV_LIM,
PIV_TOL,
PP_TECH,
PRESOLVE,
PRICING,
R_TEST,
RS_SIZE,
SUHL,
TM_LIM,
TOL_BND,
TOL_DJ,
TOL_INT,
TOL_OBJ,
TOL_PIV,
TYPE,
UPD_TOL
)
#------------------------------------------------------------------------------#
# R interface to GLPK #
#------------------------------------------------------------------------------#
# generics.R
# R interface to GLPK.
#
# Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
# Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
# All right reserved.
# Email: geliudie@uni-duesseldorf.de
#
# This file is part of glpkAPI.
#
# GlpkAPI is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GlpkAPI is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with glpkAPI If not, see <http://www.gnu.org/licenses/>.
#------------------------------------------------------------------------------#
# generics #
#------------------------------------------------------------------------------#
setGeneric(name = "glpkPointer",
def = function(object) { standardGeneric("glpkPointer") }
)
setGeneric(name = "glpkPtrType",
def = function(object) { standardGeneric("glpkPtrType") }
)
setGeneric(name = "glpkPtrType<-",
def = function(object, value) { standardGeneric("glpkPtrType<-") }
)
setGeneric(name = "isNULLpointerGLPK",
def = function(object) { standardGeneric("isNULLpointerGLPK") }
)
setGeneric(name = "isGLPKpointer",
def = function(object) { standardGeneric("isGLPKpointer") }
)
setGeneric(name = "isTRWKSpointer",
def = function(object) { standardGeneric("isTRWKSpointer") }
)
R/glpk.R 0 → 100644
#------------------------------------------------------------------------------#
# R interface to GLPK #
#------------------------------------------------------------------------------#
# glpk.R
# R interface to GLPK.
#
# Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
# Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
# All right reserved.
# Email: geliudie@uni-duesseldorf.de
#
# This file is part of glpkAPI.
#
# GlpkAPI is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GlpkAPI is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with glpkAPI If not, see <http://www.gnu.org/licenses/>.
#------------------------------------------------------------------------------#
# global variables (from glpk.h [4.42]) #
#------------------------------------------------------------------------------#
# simplex integer parameters (not from glpk.h, self defined)
MSG_LEV <- 101
METH <- 102
PRICING <- 103
R_TEST <- 104
IT_LIM <- 105
TM_LIM <- 106
OUT_FRQ <- 107
OUT_DLY <- 108
PRESOLVE <- 109
# simplex double parameters (not from glpk.h, self defined)
TOL_BND <- 201
TOL_DJ <- 202
TOL_PIV <- 203
OBJ_LL <- 204
OBJ_UL <- 205
# additional interior integer parameters (not from glpk.h, self defined)
ORD_ALG <- 301
# basis factorization integer control parameters (not from glpk.h, self defined)
TYPE <- 401
LU_SIZE <- 402
PIV_LIM <- 403
SUHL <- 404
NFS_MAX <- 405
NRS_MAX <- 406
RS_SIZE <- 407
# basis factorization double control parameters (not from glpk.h, self defined)
PIV_TOL <- 501
EPS_TOL <- 502
MAX_GRO <- 503
UPD_TOL <- 504
# MIP integer parameters (not from glpk.h, self defined)
BR_TECH <- 601
BT_TECH <- 602
PP_TECH <- 603
FP_HEUR <- 604
GMI_CUTS <- 605
MIR_CUTS <- 606
COV_CUTS <- 607
CLQ_CUTS <- 608
CB_SIZE <- 609
BINARIZE <- 610
# MIP double parameters (not from glpk.h, self defined)
TOL_INT <- 701
TOL_OBJ <- 702
MIP_GAP <- 703
# use callback routine glpkCallback in MIP
CB_FUNC <- 651
#------------------------------------------------------------------------------#
# LP/MIP problem object
# optimization direction flag:
GLP_MIN <- 1 # minimization
GLP_MAX <- 2 # maximization
# kind of structural variable:
GLP_CV <- 1 # continuous variable
GLP_IV <- 2 # integer variable
GLP_BV <- 3 # binary variable
# type of auxiliary/structural variable:
GLP_FR <- 1 # free variable
GLP_LO <- 2 # variable with lower bound
GLP_UP <- 3 # variable with upper bound
GLP_DB <- 4 # double-bounded variable
GLP_FX <- 5 # fixed variable
# status of auxiliary/structural variable:
GLP_BS <- 1 # basic variable
GLP_NL <- 2 # non-basic variable on lower bound
GLP_NU <- 3 # non-basic variable on upper bound
GLP_NF <- 4 # non-basic free variable
GLP_NS <- 5 # non-basic fixed variable
# scaling options:
GLP_SF_GM <- 0x01 # perform geometric mean scaling
GLP_SF_EQ <- 0x10 # perform equilibration scaling
GLP_SF_2N <- 0x20 # round scale factors to power of two
GLP_SF_SKIP <- 0x40 # skip if problem is well scaled
GLP_SF_AUTO <- 0x80 # choose scaling options automatically
# solution indicator:
GLP_SOL <- 1 # basic solution
GLP_IPT <- 2 # interior-point solution
GLP_MIP <- 3 # mixed integer solution
# solution status:
GLP_UNDEF <- 1 # solution is undefined
GLP_FEAS <- 2 # solution is feasible
GLP_INFEAS <- 3 # solution is infeasible
GLP_NOFEAS <- 4 # no feasible solution exists
GLP_OPT <- 5 # solution is optimal
GLP_UNBND <- 6 # solution is unbounded
#------------------------------------------------------------------------------#
# basis factorization control parameters
# type
GLP_BF_FT <- 0x01 # LUF + Forrest-Tomlin
GLP_BF_BG <- 0x02 # LUF + Schur compl. + Bartels-Golub
GLP_BF_GR <- 0x03 # LUF + Schur compl. + Givens rotation
GLP_BF_LUF <- 0x00 # plain LU-factorization
GLP_BF_BTF <- 0x10 # block triangular LU-factorization
#------------------------------------------------------------------------------#
# simplex method control parameters
# msg_lev # message level:
GLP_MSG_OFF <- 0 # no output
GLP_MSG_ERR <- 1 # warning and error messages only
GLP_MSG_ON <- 2 # normal output
GLP_MSG_ALL <- 3 # full output
GLP_MSG_DBG <- 4 # debug output
# meth # simplex method option:
GLP_PRIMAL <- 1 # use primal simplex
GLP_DUALP <- 2 # use dual; if it fails, use primal
GLP_DUAL <- 3 # use dual simplex
# pricing # pricing technique:
GLP_PT_STD <- 0x11 # standard (Dantzig rule)
GLP_PT_PSE <- 0x22 # projected steepest edge
# r_test # ratio test technique:
GLP_RT_STD <- 0x11 # standard (textbook)
GLP_RT_HAR <- 0x22 # two-pass Harris' ratio test
#------------------------------------------------------------------------------#
# interior-point solver control parameters
# ord_alg # ordering algorithm:
GLP_ORD_NONE <- 0 # natural (original) ordering
GLP_ORD_QMD <- 1 # quotient minimum degree (QMD)
GLP_ORD_AMD <- 2 # approx. minimum degree (AMD)
GLP_ORD_SYMAMD <- 3 # approx. minimum degree (SYMAMD)
#------------------------------------------------------------------------------#
# integer optimizer control parameters
# br_tech # branching technique:
GLP_BR_FFV <- 1 # first fractional variable
GLP_BR_LFV <- 2 # last fractional variable
GLP_BR_MFV <- 3 # most fractional variable
GLP_BR_DTH <- 4 # heuristic by Driebeck and Tomlin
GLP_BR_PCH <- 5 # hybrid pseudocost heuristic
# bt_tech # backtracking technique:
GLP_BT_DFS <- 1 # depth first search
GLP_BT_BFS <- 2 # breadth first search
GLP_BT_BLB <- 3 # best local bound
GLP_BT_BPH <- 4 # best projection heuristic
# pp_tech # preprocessing technique:
GLP_PP_NONE <- 0 # disable preprocessing
GLP_PP_ROOT <- 1 # preprocessing only on root level
GLP_PP_ALL <- 2 # preprocessing on all levels
#------------------------------------------------------------------------------#
# additional row attributes
# the row origin flag:
GLP_RF_REG <- 0 # regular constraint
GLP_RF_LAZY <- 1 # "lazy" constraint
GLP_RF_CUT <- 2 # cutting plane constraint
# the row class descriptor:
# klass
GLP_RF_GMI <- 1 # Gomory's mixed integer cut
GLP_RF_MIR <- 2 # mixed integer rounding cut
GLP_RF_COV <- 3 # mixed cover cut
GLP_RF_CLQ <- 4 # clique cut
#------------------------------------------------------------------------------#
# enable/disable flag:
GLP_ON <- 1 # enable something
GLP_OFF <- 0 # disable something
#------------------------------------------------------------------------------#
# reason codes:
GLP_IROWGEN <- 0x01 # request for row generation
GLP_IBINGO <- 0x02 # better integer solution found
GLP_IHEUR <- 0x03 # request for heuristic solution
GLP_ICUTGEN <- 0x04 # request for cut generation
GLP_IBRANCH <- 0x05 # request for branching
GLP_ISELECT <- 0x06 # request for subproblem selection
GLP_IPREPRO <- 0x07 # request for preprocessing
#------------------------------------------------------------------------------#
# branch selection indicator:
GLP_NO_BRNCH <- 0 # select no branch
GLP_DN_BRNCH <- 1 # select down-branch
GLP_UP_BRNCH <- 2 # select up-branch
#------------------------------------------------------------------------------#
# return codes:
GLP_EBADB <- 0x01 # invalid basis
GLP_ESING <- 0x02 # singular matrix
GLP_ECOND <- 0x03 # ill-conditioned matrix
GLP_EBOUND <- 0x04 # invalid bounds
GLP_EFAIL <- 0x05 # solver failed
GLP_EOBJLL <- 0x06 # objective lower limit reached
GLP_EOBJUL <- 0x07 # objective upper limit reached
GLP_EITLIM <- 0x08 # iteration limit exceeded
GLP_ETMLIM <- 0x09 # time limit exceeded
GLP_ENOPFS <- 0x0A # no primal feasible solution
GLP_ENODFS <- 0x0B # no dual feasible solution
GLP_EROOT <- 0x0C # root LP optimum not provided
GLP_ESTOP <- 0x0D # search terminated by application
GLP_EMIPGAP <- 0x0E # relative mip gap tolerance reached
GLP_ENOFEAS <- 0x0F # no primal/dual feasible solution
GLP_ENOCVG <- 0x10 # no convergence
GLP_EINSTAB <- 0x11 # numerical instability
GLP_EDATA <- 0x12 # invalid data
GLP_ERANGE <- 0x13 # result out of range
#------------------------------------------------------------------------------#
# condition indicator:
GLP_KKT_PE <- 1 # primal equalities
GLP_KKT_PB <- 2 # primal bounds
GLP_KKT_DE <- 3 # dual equalities
GLP_KKT_DB <- 4 # dual bounds
GLP_KKT_CS <- 5 # complementary slackness
#------------------------------------------------------------------------------#
# MPS file format:
GLP_MPS_DECK <- 1 # fixed (ancient)
GLP_MPS_FILE <- 2 # free (modern)
#------------------------------------------------------------------------------#
# return codes of glpk optimizations
return_codeGLPK <- function(code) {
if (code == 0) { return( "solution process was successful" ) }
else if (code == GLP_EBADB) { return( "invalid basis" ) }
else if (code == GLP_ESING) { return( "singular matrix" ) }
else if (code == GLP_ECOND) { return( "ill-conditioned matrix" ) }
else if (code == GLP_EBOUND) { return( "invalid bounds" ) }
else if (code == GLP_EFAIL) { return( "solver failed" ) }
else if (code == GLP_EOBJLL) { return( "objective lower limit reached" ) }
else if (code == GLP_EOBJUL) { return( "objective upper limit reached" ) }
else if (code == GLP_EITLIM) { return( "iteration limit exceeded" ) }
else if (code == GLP_ETMLIM) { return( "time limit exceeded" ) }
else if (code == GLP_ENOPFS) { return( "no primal feasible solution" ) }
else if (code == GLP_ENODFS) { return( "no dual feasible solution" ) }
else if (code == GLP_EROOT) { return( "root LP optimum not provided" ) }
else if (code == GLP_ESTOP) { return( "search terminated by application" ) }
else if (code == GLP_EMIPGAP) { return( "relative mip gap tolerance reached" ) }
else if (code == GLP_ENOFEAS) { return( "no primal/dual feasible solution" ) }
else if (code == GLP_ENOCVG) { return( "no convergence" ) }
else if (code == GLP_EINSTAB) { return( "numerical instability" ) }
else if (code == GLP_EDATA) { return( "invalid data" ) }
else if (code == GLP_ERANGE) { return( "result out of range" ) }
else { return(paste("Failed to obtain solution, unknown error code:", code)) }
}
# solution status codes of glpk optimizations
status_codeGLPK <- function(code) {
if (code == GLP_OPT) { return( "solution is optimal" ) }
else if (code == GLP_UNDEF) { return( "solution is undefined" ) }
else if (code == GLP_FEAS) { return( "solution is feasible" ) }
else if (code == GLP_INFEAS) { return( "solution is infeasible" ) }
else if (code == GLP_NOFEAS) { return( "no feasible solution exists" ) }
else if (code == GLP_UNBND) { return( "solution is unbounded" ) }
else { return(paste("unknown status code:", code)) }
}
R/glpkAPI.R 0 → 100644
This diff is collapsed.
#------------------------------------------------------------------------------#
# R interface to GLPK #
#------------------------------------------------------------------------------#
# glpk_ptrClass.R
# R interface to GLPK.
#
# Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
# Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
# All right reserved.
# Email: geliudie@uni-duesseldorf.de
#
# This file is part of glpkAPI.
#
# GlpkAPI is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GlpkAPI is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with glpkAPI If not, see <http://www.gnu.org/licenses/>.
#------------------------------------------------------------------------------#
# definition of class glpkPtr #
#------------------------------------------------------------------------------#
# representation of class glpkPtr
setClass(Class = "glpkPtr",
representation(
glpkPtrType = "character",
glpkPointer = "externalptr"
# ,
# glpkParmSim = "externalptr",
# glpkParmInt = "externalptr",
# glpkParmMip = "externalptr"
)
#, contains = "externalptr"
)
#------------------------------------------------------------------------------#
# contructor for class glpkPtr
setMethod(f = "initialize",
signature = "glpkPtr",
definition = function(.Object, p, w) {
.Object@glpkPointer <- attr(p, which = w, exact = TRUE)
.Object@glpkPtrType <- as.character(p)
# .Object@glpkParm <- "parameter"
# .Object@glpkParmSim <- attr(p, which = "simplex", exact = TRUE)
# .Object@glpkParmInt <- attr(p, which = "interior", exact = TRUE)
# .Object@glpkParmMip <- attr(p, which = "mip", exact = TRUE)
return(.Object)
}
)
# contructor for pointers to glpk problem structures
glpk_Pointer <- function(pointer) {
if (is(pointer, "glpk_ptr")) {
pObj <- new("glpkPtr",
p = pointer,
w = as.character("glpk_ptr"))
}
else {
pObj <- pointer
}
return(pObj)
}
# contructor for pointers to translator workspace
trwks_Pointer <- function(pointer) {
if (is(pointer, "trwks_ptr")) {
pObj <- new("glpkPtr",
p = pointer,
w = as.character("trwks_ptr"))
}
else {
pObj <- pointer
}
return(pObj)
}
#------------------------------------------------------------------------------#
# glpkPtrType
setMethod("glpkPtrType", signature(object = "glpkPtr"),
function(object) {
return(object@glpkPtrType)
}
)
setReplaceMethod("glpkPtrType", signature = (object = "glpkPtr"),
function(object, value) {
object@glpkPtrType <- value
return(object)
}
)
# glpkPointer
setMethod("glpkPointer", signature(object = "glpkPtr"),
function(object) {
return(object@glpkPointer)
}
)
#------------------------------------------------------------------------------#
setMethod("isNULLpointerGLPK", signature(object = "glpkPtr"),
function(object) {
return(.Call("isNULLptr", PACKAGE = "glpkAPI", glpkPointer(object)))
}
)
setMethod("isGLPKpointer", signature(object = "glpkPtr"),
function(object) {
return(.Call("isGLPKptr", PACKAGE = "glpkAPI", glpkPointer(object)))
}
)
setMethod("isTRWKSpointer", signature(object = "glpkPtr"),
function(object) {
return(.Call("isTRWKSptr", PACKAGE = "glpkAPI", glpkPointer(object)))
}
)
#------------------------------------------------------------------------------#
setMethod("show", signature(object = "glpkPtr"),
function(object) {
nc <- NA
if (isNULLpointerGLPK(object)) {
ptrtype <- "NULL"
}
else {
if (isGLPKpointer(object)) {
ptrtype <- "GLPK problem object"
nc <- getNumColsGLPK(object)
}
else if (isTRWKSpointer(object)) {
ptrtype <- "MathProg translator workspace"
}
else {
ptrtype <- "unknown"
}
}
cat("object of class ", dQuote("glpkPtr"),
": pointer to ", ptrtype, ".\n", sep = "")
if (!is.na(nc)) {
if ( (nc < 1) || (nc > 10) ) {
cat(paste("Number of variables: ",
getNumColsGLPK(object), "\n"))
cat(paste("Number of constraints:",
getNumRowsGLPK(object), "\n"))
}
else {
# make a more illustrative method here
cat(paste("Number of variables: ",
getNumColsGLPK(object), "\n"))
cat(paste("Number of constraints:",
getNumRowsGLPK(object), "\n"))
}
}
cat(paste("Slot ",
dQuote("glpkPtrType"), ": ",
glpkPtrType(object), "\n", sep = ""))
cat(paste("Slot ", dQuote("glpkPointer"), ": ", sep = ""))
print(slot(object, "glpkPointer"), sep = "")
}
)
R/zzz.R 0 → 100644
#------------------------------------------------------------------------------#
# R interface to GLPK #
#------------------------------------------------------------------------------#
# zzz.R
# R interface to GLPK.
#
# Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
# Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
# All right reserved.
# Email: geliudie@uni-duesseldorf.de
#
# This file is part of glpkAPI.
#
# GlpkAPI is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GlpkAPI is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with glpkAPI If not, see <http://www.gnu.org/licenses/>.
.packageName <- "glpkAPI"
.onLoad <- function(libname, pkgname) {
.Call("initGLPK", PACKAGE = "glpkAPI")
}
.onAttach <- function(libname, pkgname) {
packageStartupMessage("using GLPK version ", versionGLPK())
}
#! /bin/sh
rm -rf config.* autom4te.cache src/Makevars src/config.h src/*.o
exit 0
configure 0 → 100755
This diff is collapsed.
AC_INIT([glpkAPI], [1.2.12], [geliudie@uni-duesseldorf.de])
dnl # --------------------------------------------------------------------
dnl # global (environment) variables
dnl # --------------------------------------------------------------------
dnl
dnl # PKG_CPPFLAGS C preprocessor flags -I...
dnl # PKG_CFLAGS C compiler flags
dnl # PKG_LIBS libraries -l...
dnl # --------------------------------------------------------------------
dnl # R compiler and flags
dnl # --------------------------------------------------------------------
: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
echo "could not determine R_HOME"
exit 1
fi
dnl # GNU R default settings
CC=`"${R_HOME}/bin/R" CMD config CC`
CPP=`"${R_HOME}/bin/R" CMD config CPP`
CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS`
CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS`
AC_PROG_CC
AC_PROG_CPP
dnl # --------------------------------------------------------------------
dnl # template config.h.in
dnl # --------------------------------------------------------------------
AC_CONFIG_HEADERS([src/config.h])
dnl # --------------------------------------------------------------------
dnl # test for global variables
dnl # --------------------------------------------------------------------
ARGS_OK="FALSE"
if test [ -n "$PKG_CPPFLAGS" -a -n "$PKG_LIBS" ] ; then
ARGS_OK="TRUE"
else
if test [ -n "$PKG_CPPFLAGS" -o -n "$PKG_LIBS" ] ; then
AC_MSG_ERROR([Please set both variables: PKG_CPPFLAGS AND PKG_LIBS])
fi
fi
dnl # --------------------------------------------------------------------
dnl # get arguments
dnl # --------------------------------------------------------------------
AC_ARG_WITH(glpk-include,
AC_HELP_STRING([--with-glpk-include=PATH],
[location of glpk include directory [[/usr/local/include]]]
),
[GLPK_INCLUDE=$withval],
[GLPK_INCLUDE=""])
AC_ARG_WITH(glpk-lib,
AC_HELP_STRING([--with-glpk-lib=PATH],
[location of GLPK callable library [[/usr/local/lib]]]
),
[GLPK_LIB=$withval],
[GLPK_LIB=""])
AC_ARG_ENABLE(gmp,
AC_HELP_STRING([--enable-gmp[=yes|no]],
[link to GNU bignum library libgmp [[yes]]]
),
[GMP=$enableval], [GMP="yes"])
AC_ARG_ENABLE(chkargs,
AC_HELP_STRING([--enable-chkargs[=yes|no]],
[check arguments to GLPK [[yes]]]
),
[CHKARGS=$enableval], [CHKARGS="yes"])
dnl # --------------------------------------------------------------------
dnl # test arguments
dnl # --------------------------------------------------------------------
dnl # include and library directories
if test [ "$ARGS_OK" = "FALSE" ] ; then
if test [ -n "$GLPK_INCLUDE" -a -n "$GLPK_LIB" ] ; then
if test [ -d "$GLPK_INCLUDE" ] ; then
PKG_CPPFLAGS="-I${GLPK_INCLUDE}"
else
AC_MSG_ERROR([directory $GLPK_INCLUDE does not exist])
fi
if test [ -d "$GLPK_LIB" ] ; then
PKG_LIBS="-L${GLPK_LIB}"
# PKG_LIBS="-L${GLPK_LIB} -Wl,-rpath ${GLPK_LIB}"
else
AC_MSG_ERROR([directory $GLPK_LIB does not exist])
fi
else
dnl # if no arguments are given, try to find the glpsol executable. If is not
dnl # found, use /usr/local and /usr
AC_PREFIX_PROGRAM(glpsol)
if test [ "$prefix" = "NONE" ] ; then
AC_MSG_NOTICE([No prefix given, trying /usr and /usr/local])
if test [ -d "/usr/include" -o -d "/usr/local/include" ] ; then
PKG_CPPFLAGS="-I/usr/include -I/usr/local/include"
else
AC_MSG_ERROR([directories /usr/include and /usr/local/include do not exist])
fi
if test [ -d "/usr/local/lib" -o -d "/usr/local/lib64" -o -d "/usr/lib" -o -d "/usr/lib64"] ; then
PKG_LIBS=""
if test [ -d "/usr/local/lib" ] ; then
PKG_LIBS="$PKG_LIBS -L/usr/local/lib"
fi
if test [ -d "/usr/local/lib64" ] ; then
PKG_LIBS="$PKG_LIBS -L/usr/local/lib64"
fi
if test [ -d "/usr/lib" ] ; then
PKG_LIBS="$PKG_LIBS -L/usr/lib"
fi
if test [ -d "/usr/lib64" ] ; then
PKG_LIBS="$PKG_LIBS -L/usr/lib64"
fi
# PKG_LIBS="-L/usr/local/lib -Wl,-rpath /usr/local/lib"
else
AC_MSG_ERROR([none of the directories /usr/local/lib, /usr/local/lib64, /usr/lib of /usr/lib64 exists])
fi
else
AC_MSG_NOTICE([found executable glpsol in $prefix])
if test [ -d "$prefix/include" ] ; then
PKG_CPPFLAGS="-I$prefix/include"
else
AC_MSG_ERROR([directory $prefix/include does not exist])
fi
if test [ -d "$prefix/lib" -o -d "$prefix/lib64" ] ; then
PKG_LIBS=""
if test [ -d "$prefix/lib" ] ; then
PKG_LIBS="$PKG_LIBS -L$prefix/lib"
fi
if test [ -d "$prefix/lib64" ] ; then
PKG_LIBS="$PKG_LIBS -L$prefix/lib64"
fi
else
AC_MSG_ERROR([neither $prefix/lib nor $prefix/lib64 exist])
fi
dnl # if test [ -d "$prefix/include" -a -d "$prefix/lib" ] ; then
dnl # PKG_CPPFLAGS="-I$prefix/include"
dnl # PKG_LIBS="-L$prefix/lib"
dnl # # PKG_LIBS="-L$prefix/lib -Wl,-rpath $prefix/lib"
dnl # else
dnl # AC_MSG_ERROR([directories $prefix/include and $prefix/lib do not exist])
dnl # fi
fi
fi
if test [ "${GMP}" != "no" ] ; then
dnl # AC_CHECK_HEADER([gmp.h], INCL="$INCL -lgmp", AC_MSG_NOTICE([Could not link to gmp.]))
LINK="-lglpk -lgmp"
AC_DEFINE([USE_GMP], [1], [defined, if gnu bignum is used])
else
LINK="-lglpk"
fi
PKG_LIBS="${PKG_LIBS} ${LINK}"
ARGS_OK="TRUE"
fi
dnl # check arguments to CPLEX
if test [ "${CHKARGS}" != "no" ] ; then
AC_DEFINE([CHECK_GLPK_ARGS], [1], [defined, if check arguments to GLPK])
PKG_CPPFLAGS="-DHAVE_CONFIG_H ${PKG_CPPFLAGS}"
fi
dnl # --------------------------------------------------------------------
dnl # CFLAGS
dnl # --------------------------------------------------------------------
if test [ -z "$PKG_CFLAGS" ] ; then
if test [ "${R_ARCH}" = "/x86_64" ] ; then
PKG_CFLAGS="-m64"
elif test [ "${R_ARCH}" = "/i386" ] ; then
PKG_CFLAGS="-m32"
else
PKG_CFLAGS=""
fi
fi
dnl # --------------------------------------------------------------------
dnl # check header and library
dnl # --------------------------------------------------------------------
LIBS="${PKG_LIBS}"
CFLAGS="${CFLAGS} ${PKG_CFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PKG_CPPFLAGS}"
AC_CHECK_HEADER([glpk.h],,
AC_MSG_ERROR([Could not find glpk.h:
glpkAPI requires GLPK from http://www.gnu.org/software/glpk/
use --with-glpk-include or GLPK_INCLUDE to specify the include path.]))
AC_SEARCH_LIBS([glp_create_prob], [glpk], ,
AC_MSG_ERROR([Could not link to GLPK:
use --with-glpk-lib or GLPK_LIB to specify the lib path.
Maybe you want to set --enable-gmp=no]))
dnl # GLPK version
AC_CHECK_FUNC([glp_print_ranges], ,
AC_MSG_ERROR([GLPK version must be >= 4.42.]))
dnl # --------------------------------------------------------------------
dnl # substitute src/Makevars
dnl # --------------------------------------------------------------------
AC_SUBST(PKG_CFLAGS)
AC_SUBST(PKG_LIBS)
AC_SUBST(PKG_CPPFLAGS)
AC_OUTPUT(src/Makevars)
exit 0
GNU R package glpkAPI: R Interface to C API of GLPK
The installation procedure for the glpkAPI package needs to know where to
find the GLPK include directory and where to find the callable library.
# ---------------------------------------------------------------------------- #
# Linux and MacOS X installation
# ---------------------------------------------------------------------------- #
There are basically three different ways of installing the glpkAPI package:
1) Use --with-glpk-<ARG>
--with-glpk-include=PATH with PATH being the include directory of GLPK
--with-glpk-lib=PATH with PATH being the directory containing the
callable library.
R CMD INSTALL --configure-args=" \
--with-glpk-include=/path/to/include/dir \
--with-glpk-lib=/path/to/lib/dir" glpkAPI_X.X.X.tar.gz
When using --with-glpk-<ARG>, both arguments must be given.
2) Use of environment variables
PKG_CPPFLAGS giving the PATH to the include directory of GLPK
PKG_LIBS giving the PATH to the directory containing the
callable library and the libraries to link to.
3) Use --prefix
--prefix=PATH with path being the installation directory of
GLPK. The include directory is assumed to be
PATH/include and the callable library should be
in PATH/lib.
If either --with-glpk-<ARG> nor --prefix is given, it is checked wether
glpsol is in the PATH. If yes, PATH is used as prefix. If not,
/usr/local/include and /usr/local/lib[64] and /usr/include and /usr/lib[64]
are tested.
If one wants to use GNU BIGNUM in order to use glp_exact, use --enable-gmp
(default is set to yes).
The argument --enable-chkargs enables a mechanism checking column and row
indices, variable types and kinds given as arguments to glpkAPI functions.
If e.g. a desired column index does not exist, glpk will terminate abnormally,
which also will close the running R session. The --enable-chkarg options will
cause an overhead to the functions needing an index, because it checks if that
index is valid. This option is enabled by default.
# ---------------------------------------------------------------------------- #
# Windows installation
# ---------------------------------------------------------------------------- #
For the installation on Windows systems the file Makewars.win in src/ is
required. The file looks like this:
PKG_CPPFLAGS=-g -D_R_=1 -DUSE_R=1 -I${GLPK_HOME}/include -DCHECK_GLPK_ARGS
PKG_LIBS=-L${GLPK_HOME}/lib -lglpk -lgmp
with the environment variable GLPK_HOME being the installation directory
of GLPK and GNU BIGNUM.
%% glpkAPI Version History
\name{NEWS}
\title{glpkAPI News}
\encoding{UTF-8}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.2.11 2014-11-16}{
\itemize{
\item added bsais factorization control parameters: \code{GLP_BF_LUF}
and \code{GLP_BF_BTF}
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.2.10 2014-01-08}{
\itemize{
\item wring column or row indices to \code{setMatRowGLPK} and
\code{setMatColGLPK} will not longer stop the running R session
\item fixed a bug in functions \code{delRowsGLPK} and \code{delColsGLPK}
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.2.9 2013-07-27}{
\itemize{
\item fixed a bug in \code{loadMatrixGLPK}: symbol \code{R_orderVector} is
first available in R version 3.0.0
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.2.8 2013-07-16}{
\itemize{
\item duplicate entries in inputs to \code{loadMatrixGLPK} will not longer
stop the running R session
\item added function \code{getRowsTypesGLPK}
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.2.7 2013-05-23}{
\itemize{
\item a minor change in file \file{Makevars.win} so that the Windows version
will be compiled using --enable-chkargs
\item added functions \code{setColsNamesGLPK()}, \code{setRowsNamesGLPK()}
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.2.6 2013-02-12}{
\itemize{
\item prints the version number of GLPK on startup
\item removed argument \code{check} from function \code{loadMatrixGLPK}
\item if compiled with --enable-chkargs [which is the default]), arguments
to GLPK API functions containing GLPK constants or row and column
indices are checked more carefully
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.2.5 2012-11-14}{
\itemize{
\item very basic support for the GLPK callback routine
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.2.4 2012-07-06}{
\itemize{
\item inconsistent inputs to \code{loadMatrixGLPK} will not longer stop
the running R session
\item new argument \code{check} to function \code{loadMatrixGLPK}:
if set to \code{TRUE} (and \pkg{glpkAPI} compiled with
--enable-chkargs [which is the default]), other arguments to
\code{loadMatrixGLPK} will be reviewed in terms of vector length and
valid row and column indices, before changing the problem object
\item functions \code{setMatRowGLPK} and \code{getMatRowGLPK} can use
vectors returned by \code{getMatRowGLPK} and \code{getMatColGLPK}
respectively
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.2.3 2012-04-20}{
\itemize{
\item bugfix in \file{configure.ac} when compiling with \command{R32}
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.2.2 2012-03-27}{
\itemize{
\item renamed \code{glpkPtr} method \code{isNULLpointer} to
\code{isNULLpointerGLPK}
\item renamed \code{glpkPtr} method \code{pType} to \code{glpkPtrType}
\item renamed \code{glpkPtr} method \code{ptr} to \code{glpkPointer}
\item renamed \code{glpkPtr} slot \code{pType} to \code{glpkPtrType}
\item renamed \code{glpkPtr} slot \code{ptr} to \code{glpkPointer}
\item updated \file{configure.ac} script
\item file \file{NEWS} is now in \file{inst/NEWS.Rd}
\item fixed a bug in \code{getCbindGLPK}
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.2.1 2012-03-15}{
\itemize{
\item class \code{glpkPtr} does not extend \code{externalptr} (not allowed
in R version <= 2.14)
\item method show for objects of class \code{glpkPtr}
\item fixed a bug in \file{init.c}: number of arguments to
\code{mplAllocWksp} was wrong
\item added methods \code{isGLPKpointer}, \code{isNULLpointer} and
\code{isTRWKSpointer} for objects of class \code{glpkPtr}
\item make use of \code{glp_error_hook} in \file{glpkAPI.c} in order to
prevent GLPK exiting abnormal and so terminating the running R session
\item check arguments for row and column indices (\code{i} and \code{j}) if
they fit to the given problem object (again: prevent GLPK from
terminating the running R session)
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.2.0 2012-02-14}{
\itemize{
\item exported API-functions are registered
\item class \code{glpkPtr} extends \code{externalptr}
\item file \file{c2r.map} in \file{inst/}: mapping of filenames between
C API and \pkg{glpkAPI}, run
\preformatted{
c2r <- system.file(package = "glpkAPI", "c2r.map")
source(c2r)
}
in order to use original function names of the GLPK C API.
\item fixed a bug in \code{copyProbGLPK()}
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.1.9 2012-02-13}{
\itemize{
\item added finalizers for GLPK problem objects and MathProg
translator workspace objects
\item Functions \code{initProbGLPK()} and \code{mplAllocWkspGLPK()} return
instances of class \code{glpkPtr}. This class has two data slots:
\tabular{ll}{
pType \tab a character string giving the pointer type and \cr
ptr \tab a pointer to a C structure \cr
}
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.1.8 2012-02-07}{
\itemize{
\item added MathProg support:
\code{mplAllocWkspGLPK()},
\code{mplBuildProbGLPK()},
\code{mplFreeWkspGLPK()},
\code{mplGenerateGLPK()},
\code{mplPostsolveGLPK()},
\code{mplReadDataGLPK()} and
\code{mplReadModelGLPK()}
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.1.7 2012-01-10}{
\itemize{
\item some minor changes in \file{configure.ac}
\item empty \file{configure.win} file and some finetuning in
\file{Makevars.win}
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.1.6 2012-01-09}{
\itemize{
\item some minor changes in \file{configure.ac}
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.1.5 2011-07-28}{
\itemize{
\item added \file{NAMESPACE}
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.1.4 2011-07-27}{
\itemize{
\item removed file \file{COPYING}
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.1.3 2011-07-27}{
\itemize{
\item updated \file{configure.ac} script
\item updated package vignette
\item added files \file{INSTALL} and \file{README}
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.1.2 2011-07-12}{
\itemize{
\item renamed from sybilGLPK to \pkg{glpkAPI}
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.1.1 2011-06-14}{
\itemize{
\item fixed a bug in \code{getColsKind()}
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.1.0 2011-05-17}{
\itemize{
\item updated documentation
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.0.4 2011-05-09}{
\itemize{
\item renamed functions \code{getFluxDistGLPK()} and
\code{getFluxDistIptGLPK()} to \code{getColsPrimGLPK()} and
\code{getColsPrimIptGLPK()} respectively
\item added functions \code{getColKindGLPK()},
\code{getColsDualGLPK()},
\code{getColsDualIptGLPK()},
\code{getColsKindGLPK()},
\code{getColsStatGLPK()},
\code{getMIPParmGLPK()},
\code{getNumBinGLPK()},
\code{getNumIntGLPK()},
\code{getRowsDualGLPK()},
\code{getRowsDualIptGLPK()},
\code{getRowsPrimGLPK()},
\code{getRowsPrimIptGLPK()},
\code{getRowsStatGLPK()},
\code{mipColValGLPK()},
\code{mipColsValGLPK()},
\code{mipObjValGLPK()},
\code{mipRowValGLPK()},
\code{mipRowsValGLPK()},
\code{mipStatusGLPK()},
\code{printIptGLPK()},
\code{printMIPGLPK()},
\code{printSolGLPK()},
\code{readIptGLPK()},
\code{readMIPGLPK()},
\code{readSolGLPK()},
\code{setColKindGLPK()},
\code{setColsKindGLPK()},
\code{setDefaultMIPParmGLPK()},
\code{setMIPParmGLPK()},
\code{solveMIPGLPK()},
\code{writeIptGLPK()},
\code{writeMIPGLPK()} and
\code{writeSolGLPK()}
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.0.3 2011-03-08}{
\itemize{
\item fixed a bug in \code{findColGLPK()}
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.0.2 2011-02-15}{
\itemize{
\item added functions \code{checkDupGLPK()},
\code{sortMatrixGLPK()},
\code{delRowsGLPK()},
\code{delColsGLPK()},
\code{setBfcpGLPK()},
\code{getBfcpGLPK()},
\code{readProbGLPK()},
\code{writeProbGLPK()},
\code{getBheadGLPK()},
\code{getRbindGLPK()} and
\code{getCbindGLPK()}
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.0.1 2010-11-04}{
\itemize{
\item added functions \file{setMatRowGLPK()} and \file{setMatColGLPK()}
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 1.0.0 2010-08-19}{
\itemize{
\item initial public release
}
}
GNU R package glpkAPI: R Interface to C API of GLPK
The package glpkAPI requires a working installation of GLPK (in particular
libraries and header files).
#------------------------------------------------------------------------------#
# map GLPK function names to glpkAPI function names #
#------------------------------------------------------------------------------#
# GLPK # glpkAPI
glp_add_cols <- glpkAPI::addColsGLPK
glp_add_rows <- glpkAPI::addRowsGLPK
glp_adv_basis <- glpkAPI::advBasisGLPK
glp_bf_exists <- glpkAPI::bfExistsGLPK
glp_bf_updated <- glpkAPI::bfUpdatedGLPK
glp_check_dup <- glpkAPI::checkDupGLPK
glp_copy_prob <- glpkAPI::copyProbGLPK
glp_cpx_basis <- glpkAPI::cpxBasisGLPK
glp_create_index <- glpkAPI::createIndexGLPK
glp_create_prob <- glpkAPI::initProbGLPK
glp_del_cols <- glpkAPI::delColsGLPK
glp_del_rows <- glpkAPI::delRowsGLPK
glp_delete_index <- glpkAPI::deleteIndexGLPK
glp_delete_prob <- glpkAPI::delProbGLPK
glp_erase_prob <- glpkAPI::eraseProbGLPK
glp_exact <- glpkAPI::solveSimplexExactGLPK
glp_factorize <- glpkAPI::factorizeGLPK
glp_find_col <- glpkAPI::findColGLPK
glp_find_row <- glpkAPI::findRowGLPK
glp_get_bfcp <- glpkAPI::getBfcpGLPK
glp_get_bhead <- glpkAPI::getBheadGLPK
glp_get_col_bind <- glpkAPI::getCbindGLPK
glp_get_col_dual <- glpkAPI::getColDualGLPK
glp_get_col_kind <- glpkAPI::getColKindGLPK
glp_get_col_lb <- glpkAPI::getColLowBndGLPK
glp_get_col_name <- glpkAPI::getColNameGLPK
glp_get_col_prim <- glpkAPI::getColPrimGLPK
glp_get_col_stat <- glpkAPI::getColStatGLPK
glp_get_col_type <- glpkAPI::getColTypeGLPK
glp_get_col_ub <- glpkAPI::getColUppBndGLPK
glp_get_dual_stat <- glpkAPI::getDualStatGLPK
glp_get_mat_col <- glpkAPI::getMatColGLPK
glp_get_mat_row <- glpkAPI::getMatRowGLPK
glp_get_num_bin <- glpkAPI::getNumBinGLPK
glp_get_num_cols <- glpkAPI::getNumColsGLPK
glp_get_num_int <- glpkAPI::getNumIntGLPK
glp_get_num_nz <- glpkAPI::getNumNnzGLPK
glp_get_num_rows <- glpkAPI::getNumRowsGLPK
glp_get_obj_coef <- glpkAPI::getObjCoefGLPK
glp_get_obj_dir <- glpkAPI::getObjDirGLPK
glp_get_obj_name <- glpkAPI::getObjNameGLPK
glp_get_obj_val <- glpkAPI::getObjValGLPK
glp_get_prim_stat <- glpkAPI::getPrimStatGLPK
glp_get_prob_name <- glpkAPI::getProbNameGLPK
glp_get_rii <- glpkAPI::getRiiGLPK
glp_get_row_bind <- glpkAPI::getRbindGLPK
glp_get_row_dual <- glpkAPI::getRowDualGLPK
glp_get_row_lb <- glpkAPI::getRowLowBndGLPK
glp_get_row_name <- glpkAPI::getRowNameGLPK
glp_get_row_prim <- glpkAPI::getRowPrimGLPK
glp_get_row_stat <- glpkAPI::getRowStatGLPK
glp_get_row_type <- glpkAPI::getRowTypeGLPK
glp_get_row_ub <- glpkAPI::getRowUppBndGLPK
glp_get_sjj <- glpkAPI::getSjjGLPK
glp_get_status <- glpkAPI::getSolStatGLPK
glp_get_unbnd_ray <- glpkAPI::getUnbndRayGLPK
glp_init_iocp <- glpkAPI::setDefaultMIPParmGLPK
glp_init_iptcp <- glpkAPI::setDefaultIptParmGLPK
glp_interior <- glpkAPI::solveInteriorGLPK
glp_intopt <- glpkAPI::solveMIPGLPK
glp_ipt_col_dual <- glpkAPI::getColDualIptGLPK
glp_ipt_col_prim <- glpkAPI::getColPrimIptGLPK
glp_ipt_obj_val <- glpkAPI::getObjValIptGLPK
glp_ipt_row_dual <- glpkAPI::getRowDualIptGLPK
glp_ipt_row_prim <- glpkAPI::getRowPrimIptGLPK
glp_ipt_status <- glpkAPI::getSolStatIptGLPK
glp_load_matrix <- glpkAPI::loadMatrixGLPK
glp_mip_col_val <- glpkAPI::mipColValGLPK
glp_mip_obj_val <- glpkAPI::mipObjValGLPK
glp_mip_row_val <- glpkAPI::mipRowValGLPK
glp_mip_status <- glpkAPI::mipStatusGLPK
glp_mpl_alloc_wksp <- glpkAPI::mplAllocWkspGLPK
glp_mpl_build_prob <- glpkAPI::mplBuildProbGLPK
glp_mpl_free_wksp <- glpkAPI::mplFreeWkspGLPK
glp_mpl_generate <- glpkAPI::mplGenerateGLPK
glp_mpl_postsolve <- glpkAPI::mplPostsolveGLPK
glp_mpl_read_data <- glpkAPI::mplReadDataGLPK
glp_mpl_read_model <- glpkAPI::mplReadModelGLPK
glp_print_ipt <- glpkAPI::printIptGLPK
glp_print_mip <- glpkAPI::printMIPGLPK
glp_print_ranges <- glpkAPI::printRangesGLPK
glp_print_sol <- glpkAPI::printSolGLPK
glp_read_ipt <- glpkAPI::readIptGLPK
glp_read_lp <- glpkAPI::readLPGLPK
glp_read_mip <- glpkAPI::readMIPGLPK
glp_read_mps <- glpkAPI::readMPSGLPK
glp_read_prob <- glpkAPI::readProbGLPK
glp_read_sol <- glpkAPI::readSolGLPK
glp_scale_prob <- glpkAPI::scaleProbGLPK
glp_set_bfcp <- glpkAPI::setBfcpGLPK
glp_set_col_bnds <- glpkAPI::setColBndGLPK
glp_set_col_kind <- glpkAPI::setColKindGLPK
glp_set_col_name <- glpkAPI::setColNameGLPK
glp_set_col_stat <- glpkAPI::setColStatGLPK
glp_set_mat_col <- glpkAPI::setMatColGLPK
glp_set_mat_row <- glpkAPI::setMatRowGLPK
glp_set_obj_coef <- glpkAPI::setObjCoefGLPK
glp_set_obj_dir <- glpkAPI::setObjDirGLPK
glp_set_obj_name <- glpkAPI::setObjNameGLPK
glp_set_prob_name <- glpkAPI::setProbNameGLPK
glp_set_rii <- glpkAPI::setRiiGLPK
glp_set_row_bnds <- glpkAPI::setRowBndGLPK
glp_set_row_name <- glpkAPI::setRowNameGLPK
glp_set_row_stat <- glpkAPI::setRowStatGLPK
glp_set_sjj <- glpkAPI::setSjjGLPK
glp_simplex <- glpkAPI::solveSimplexGLPK
glp_sort_matrix <- glpkAPI::sortMatrixGLPK
glp_std_basis <- glpkAPI::stdBasisGLPK
glp_term_out <- glpkAPI::termOutGLPK
glp_unscale_prob <- glpkAPI::unscaleProbGLPK
glp_version <- glpkAPI::versionGLPK
glp_warm_up <- glpkAPI::warmUpGLPK
glp_write_ipt <- glpkAPI::writeIptGLPK
glp_write_lp <- glpkAPI::writeLPGLPK
glp_write_mip <- glpkAPI::writeMIPGLPK
glp_write_mps <- glpkAPI::writeMPSGLPK
glp_write_prob <- glpkAPI::writeProbGLPK
glp_write_sol <- glpkAPI::writeSolGLPK
\name{addColsGLPK}
\alias{addColsGLPK}
\alias{glp_add_cols}
\title{
Add Columns to a GLPK Problem Object
}
\description{
Low level interface function to the GLPK function \code{glp_add_cols}.
Consult the GLPK documentation for more detailed information.
}
\usage{
addColsGLPK(lp, ncols)
}
\arguments{
\item{lp}{
An object of class \code{"\linkS4class{glpkPtr}"} as returned by
\code{\link{initProbGLPK}}. This is basically a pointer to a GLPK problem
object.
}
\item{ncols}{
The number of columns to add.
}
}
\details{
Interface to the C function \code{addCols} which calls the GLPK
function \code{glp_add_cols}.
}
\value{
The ordinal number of the first new column added to the
problem object is returned.
}
\references{
Based on the package \pkg{glpk} by Lopaka Lee
The GNU GLPK home page at \url{http://www.gnu.org/software/glpk/glpk.html}
}
\author{
Gabriel Gelius-Dietrich
Maintainer: Gabriel Gelius-Dietrich <geliudie@uni-duesseldorf.de>
}
\keyword{ optimize }
\name{addRowsGLPK}
\alias{addRowsGLPK}
\alias{glp_add_rows}
\title{
Add Rows to a GLPK Problem Object
}
\description{
Low level interface function to the GLPK function \code{glp_add_rows}.
Consult the GLPK documentation for more detailed information.
}
\usage{
addRowsGLPK(lp, nrows)
}
\arguments{
\item{lp}{
An object of class \code{"\linkS4class{glpkPtr}"} as returned by
\code{\link{initProbGLPK}}. This is basically a pointer to a GLPK problem
object.
}
\item{nrows}{
The number of rows to add.
}
}
\details{
Interface to the C function \code{addRows} which calls the GLPK
function \code{glp_add_rows}.
}
\value{
The ordinal number of the first new row added to the
problem object is returned.
}
\references{
Based on the package \pkg{glpk} by Lopaka Lee
The GNU GLPK home page at \url{http://www.gnu.org/software/glpk/glpk.html}
}
\author{
Gabriel Gelius-Dietrich
Maintainer: Gabriel Gelius-Dietrich <geliudie@uni-duesseldorf.de>
}
\keyword{ optimize }
\name{advBasisGLPK}
\alias{advBasisGLPK}
\alias{glp_adv_basis}
\title{
Contruct Advanced Initial LP Basis
}
\description{
Low level interface function to the GLPK function \code{glp_adv_basis}.
Consult the GLPK documentation for more detailed information.
}
\usage{
advBasisGLPK(lp)
}
\arguments{
\item{lp}{
An object of class \code{"\linkS4class{glpkPtr}"} as returned by
\code{\link{initProbGLPK}}. This is basically a pointer to a GLPK problem
object.
}
}
\details{
Interface to the C function \code{advBasis} which calls the GLPK
function \code{glp_adv_basis}.
}
\value{
NULL
}
\references{
Based on the package \pkg{glpk} by Lopaka Lee
The GNU GLPK home page at \url{http://www.gnu.org/software/glpk/glpk.html}
}
\author{
Gabriel Gelius-Dietrich
Maintainer: Gabriel Gelius-Dietrich <geliudie@uni-duesseldorf.de>
}
\keyword{ optimize }
\name{bfExistsGLPK}
\alias{bfExistsGLPK}
\alias{glp_bf_exists}
\title{
Check if the basis factorization exists
}
\description{
Low level interface function to the GLPK function \code{glp_bf_exists}.
Consult the GLPK documentation for more detailed information.
}
\usage{
bfExistsGLPK(lp)
}
\arguments{
\item{lp}{
An object of class \code{"\linkS4class{glpkPtr}"} as returned by
\code{\link{initProbGLPK}}. This is basically a pointer to a GLPK problem
object.
}
}
\details{
Interface to the C function \code{bfExists} which calls the GLPK
function \code{glp_bf_exists}.
}
\value{
Returns non-zero if the basis factorization for the specified problem object
exists. Otherwise the routine returns zero.
}
\references{
Based on the package \pkg{glpk} by Lopaka Lee.
The GNU GLPK home page at \url{http://www.gnu.org/software/glpk/glpk.html}.
}
\author{
Gabriel Gelius-Dietrich
Maintainer: Gabriel Gelius-Dietrich <geliudie@uni-duesseldorf.de>
}
\keyword{ optimize }
\name{bfUpdatedGLPK}
\alias{bfUpdatedGLPK}
\alias{glp_bf_updated}
\title{
Check if the basis factorization has been updated
}
\description{
Low level interface function to the GLPK function \code{glp_bf_updated}.
Consult the GLPK documentation for more detailed information.
}
\usage{
bfUpdatedGLPK(lp)
}
\arguments{
\item{lp}{
An object of class \code{"\linkS4class{glpkPtr}"} as returned by
\code{\link{initProbGLPK}}. This is basically a pointer to a GLPK problem
object.
}
}
\details{
Interface to the C function \code{bfUpdated} which calls the GLPK
function \code{glp_bf_updated}.
}
\value{
Returns non-zero if the basis factorization has been updated at least once.
Otherwise the routine returns zero.
}
\references{
Based on the package \pkg{glpk} by Lopaka Lee.
The GNU GLPK home page at \url{http://www.gnu.org/software/glpk/glpk.html}.
}
\author{
Gabriel Gelius-Dietrich
Maintainer: Gabriel Gelius-Dietrich <geliudie@uni-duesseldorf.de>
}
\keyword{ optimize }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment