I'am doing solve the linear program by lpSolveAPI and I want to substitute object function's variable for subject to's variable.
for example, i mimic orignal my lp like this
x5 <- x1 + x2
x6 <- x2 + x3 + x4
object funtion
min x5 + x6
subject to
x1 + x2 <= 2
x3 + x4 <= 5
x2 + x4 <= 3
x1, x2, x3, x4 = binary
x5, x6 = integer
to do this by lpSolveAPI, I try it like below
lprec <- make.lp(3, 4) # make.lp
var_lp <- matrix(c( rep(1, 12)), nrow = 3) # variable as var_lp
set.column(lprec, 1, var_lp[1,1], indices = 1) # s.t.
set.column(lprec, 2, c(var_lp[1,2], var_lp[3,2], indices = c(1,3))
set.column(lprec, 3, var_lp[2,3], indices = 2)
set.column(lprec, 4, c(var_lp[2,4], var_lp[3,4], indices = c(2,3))
i don't know any more how to express x5, x6 at lpSolveAPI
Thank you for your leading. i hope someone give me a answer about that
*plus, my orignal data has about 5,000 constraint. is it possible to analyze by lpSolveAPI??