Skip to content

Commit d64ee9e

Browse files
committed
more argument in solve
1 parent b40d503 commit d64ee9e

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

R/compileCodeProduce.r

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ sm_compile_model <- function(obj,
9999
echo <- arg$echo
100100
arg <- arg[names(arg) != 'echo', drop = FALSE]
101101
} else echo <- TRUE
102+
if (any(names(arg) == 'show.output.on.console')) {
103+
show.output.on.console <- arg$show.output.on.console
104+
arg <- arg[names(arg) != 'show.output.on.console', drop = FALSE]
105+
} else show.output.on.console <- TRUE
106+
if (any(names(arg) == 'invisible')) {
107+
arg_invisible <- arg$invisible
108+
arg <- arg[names(arg) != 'invisible', drop = FALSE]
109+
} else arg_invisible <- TRUE
102110
#####################################################################################
103111
# Fill data to Code produce
104112
#####################################################################################
@@ -475,7 +483,8 @@ LL1 <- proc.time()[3]
475483
if(echo) cat('Preprocessing time: ', round(pp2 - pp1, 2), 's\n', sep = '')
476484
tryCatch({
477485
setwd(tmpdir)
478-
rs <- system(paste('gams mdl.gms', gamsCompileParameter))
486+
rs <- system(paste('gams mdl.gms', gamsCompileParameter), invisible = arg_invisible,
487+
show.output.on.console = show.output.on.console)
479488
setwd(BEGINDR)
480489
if (rs != 0) stop(paste('Solution error code', rs))
481490
}, interrupt = function(x) {
@@ -566,14 +575,16 @@ LL1 <- proc.time()[3]
566575
# rs <- system('glpsol -m glpk.mod -d glpk.dat --log log.csv') #, mustWork = TRUE)
567576
# rs <- system('glpsol -m glpk.mod -d glpk.dat --log log.csv --xcheck') #, mustWork = TRUE)
568577
## =======
569-
rs <- system(paste('glpsol.exe -m glpk.mod -d glpk.dat --log log.csv', glpkCompileParameter))
578+
rs <- system(paste('glpsol.exe -m glpk.mod -d glpk.dat --log log.csv', glpkCompileParameter),
579+
invisible = arg_invisible, show.output.on.console = show.output.on.console)
570580
} else {
571581
rs <- system(paste("cbc glpk.mod%glpk.dat -solve", cbcCompileParameter))
572582
}
573583
} else {
574584
if (solver == 'GLPK') {
575585
rs <- system(paste('glpsol -m glpk.mod -d glpk.dat --log log.csv',
576-
glpkCompileParameter)) #, mustWork = TRUE)
586+
glpkCompileParameter), invisible = arg_invisible,
587+
show.output.on.console = show.output.on.console) #, mustWork = TRUE)
577588
#>>>>>>> 00e795fd76161408e7b5782a3aaf58177d36e20e
578589
} else {
579590
rs <- system(paste("cbc glpk.mod%glpk.dat -solve", cbcCompileParameter))

0 commit comments

Comments
 (0)