I have prepared the following reproducible example showing that lpSolve in R crashes with example 2 and I'm needing some help to identify why so it doesn't crash R.
The data and constraints were a bit large so I placed those on github and they can be read in for the example. The only difference between the one that works and the one that crashes R is the objective function values. Same constraints used in both but the values in the vector f.obj1 and f.obj2 differ.
Now I believe example 2 is infeasible. However, in smaller examples lpSolve returns to the user a solution is infeasible. In this case, it's simply crashing but I'm not certain why. Perhaps there is a setting in lpSolve that might stop this from crashing R?
Thank you in advance for any help on this problem.
library(lpSolve)
f.con <- as.matrix(read.csv('https://raw.githubusercontent.com/hdoran/Blog/master/SOData/f.con.csv'))
dat <- read.csv('https://raw.githubusercontent.com/hdoran/Blog/master/SOData/dat.csv')
constraintMat <- structure(list(constraint = c("total", "strand1", "strand2",
"strand3", "strand4", "tminus1min", "tminus1max", "at0min", "at0max",
"tplus1min", "tplus1max"), value = c(100L, 25L, 25L, 25L, 25L,
5L, 8L, 22L, 26L, 40L, 45L), direction = c("=", "=", "=", "=",
"=", ">=", "<=", ">=", "<=", ">=", "<=")), class = "data.frame", row.names = c(NA,
-11L))
K <- 2000
f.dir <- c(constraintMat$direction, rep("<=",K))
f.rhs <- c(constraintMat$value,rep(1,K))
result <- lp("max", dat$f.obj1, f.con, f.dir, f.rhs, all.bin=TRUE) # Works
result <- lp("max", dat$f.obj2, f.con, f.dir, f.rhs, all.bin=TRUE) # Crashes R 4.2.0