rLindo: R interface to LINDO API.

Description Details References Examples

Description

R interface to LINDO API functions. For more information, please refer to LINDO API User Manual.

Details

In R interface all function names use the convention of 'r' + LINDO API function name. E.g, function rLScreateEnv in R corresponds to LScreateEnv in LINDO API.

References

LINDO SYSTEMS home page at www.lindo.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#solve an LP

#load the package
library(rLindo)

#create LINDO enviroment object
rEnv <- rLScreateEnv()

#create LINDO model object
rModel <- rLScreateModel(rEnv)

#load LP data
nVars = 4
nCons = 4
nDir = 1
dObjConst = 0.
adC = c(1., 1., 1., 1.)
adB = c( 20., 20., 40., 10.)
acConTypes = "EGEG"
nNZ = 9
anBegCol = c( 0 , 2 , 5 , 7 , 9)
adA = c( 3.0, 4.0, 6.0, 5.0, 7.0, 8.0, 1.0, 2.0, 9.0)
anRowX = c( 0 , 2 , 1 , 2 , 3 , 2 , 3 , 0 , 1 )
pdLower = c(2, 1, -1.0E+30, -1.0E+30)
pdUpper = c(5, 1.0E+30, 10, 1.0E+30)
rLSloadLPData(rModel , nCons, nVars, nDir, dObjConst, adC, adB, acConTypes, 
              nNZ, anBegCol, NULL, adA, anRowX, pdLower, pdUpper)

#solve the model
rLSoptimize(rModel,0)

#get primal solution
rLSgetPrimalSolution(rModel)

#get dual solution
rLSgetDualSolution(rModel)

#retrieve information
rLSgetDInfo(rModel,LS_DINFO_POBJ)
rLSgetIInfo(rModel,LS_IINFO_MODEL_STATUS)

#get basis
rLSgetBasis(rModel)

#delete enviroment and model objects
#free memory
rLSdeleteModel(rModel)
rLSdeleteEnv(rEnv)

rLindo documentation built on May 1, 2019, 10:11 p.m.