lpmethod。R


lpmethod。R


# #解决一个模型的不同值的方法参数狗万app足彩;#显示哪个值给出了最短的求解时间。args <- commandArgs(trailingOnly = TRUE) if (length(args) < 1) {stop('Usage: Rscript lpmethod. ');R filename\n')} #读取模型cat('Reading model',args[1],'…#用不同值的方法params <- list() bestTime <- Inf最佳方法<- 1 for (i in 0:4) {params . list(方法<- I res <- gurobi(模型,参数)如果(res状态== 'OPTIMAL'){最佳方法<- i最佳时间<- res运行时参数TimeLimit <- bestTime}} #报告哪个方法最快如果(bestMethod == -1) {cat('Unable to solve this model\n')} else {cat('Solved in', bestTime, 'seconds with method:', bestMethod, ' n')} rm(params, model)