Description Usage Arguments Examples
Solves an AMPL model remotely using the NEOS Server
1 2 3 4 5 | ampl.run.neos(name = "", category = "cp", solver = "PATH",
path = getwd(), wait = TRUE, mod.file = paste(path, "/", name, ".mod",
sep = ""), dat.file = paste(path, "/", name, ".dat", sep = ""),
run.file = paste(path, "/", name, ".run", sep = ""),
log.file = paste(path, "/log_", name, "_", solver, ".txt", sep = ""))
|
name |
the model name |
category |
category of the optimization problem, call neos.ampl.solvers() for an overview |
solver |
desired solver, call neos.ampl.solvers() for a list |
path |
path in which mod.file, dat.file and run.file can be found |
wait |
default=TRUE shall R wait until NEOS returns the solution (may take some time) |
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 | ## Not run:
# Model of power plant investments and dispatch included in package
mod.file = paste(.path.package(package = "rampl"),"/data/cournot.mod",sep="")
dat.file = paste(.path.package(package = "rampl"),"/data/cournot.dat",sep="")
run.file = paste(getwd(),"/cournot.run",sep="")
ampl.make.run.file(name="cournot", neos=TRUE, mod.file=mod.file,dat.file=dat.file,run.file=run.file, options=c(""))
ret = ampl.run.neos(name="cournot", category="nco", solver="MINOS", mod.file=mod.file, dat.file=dat.file, run.file=run.file)
ret
# Solve for different parameter values
n = 2
sets = list(N=1:n)
param = list(a=1,b=1,c=c(0.1,0.1))
dat.file = paste(getwd(),"/cournot.dat",sep="")
run.file = paste(getwd(),"/cournot.run",sep="")
solve.cournot = function(c1=0,c2=0, neos=FALSE) {
param$c = c(c1,c2)
ampl.make.dat.file(mod.file=mod.file,dat.file=dat.file,sets = sets, param=param)
if (!neos) {
ampl.make.run.file(name="cournot", options=c("option solver minos;"), mod.file=mod.file,dat.file=dat.file,run.file=run.file)
ret = ampl.run.local(name="cournot", display=FALSE, run.file=run.file)
} else {
ampl.make.run.file(name="cournot", neos=TRUE, mod.file=mod.file,dat.file=dat.file,run.file=run.file, options=c(""))
ret = ampl.run.neos(name="cournot", category="nco", solver="MINOS", mod.file=mod.file, dat.file=dat.file, run.file=run.file)
}
t(ret$q)
}
solve.cournot(c1=0.1,c2=0, neos=TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.