
Write scenario object as a Python, Julia, GAMS, or MathProg script with data files to a directory
Source:R/write.R
write.RdWrite scenario object as a Python, Julia, GAMS, or MathProg script with data files to a directory
Usage
write_script(object, solver.dir = NULL, solver = NULL, ...)
write_sc(x, solver.dir = NULL, solver = NULL, ...)Arguments
- object
scenario object, must be interpolated
- solver.dir
character, an external directory to write into; default (
NULL) writes into the run'ssolver/directory under the scenario (tmp.diris the deprecated alias).- solver
list of character with solver specification.
- ...
additional solver parameters
- x
scenario object, as
scen(thewrite_sc()spelling).
See also
solve() to run the script, solve the scenario. read_solution to read model solution.
Examples
if (FALSE) { # \dontrun{
open_project(tempdir())
topia_elc <- topia$modules$electricity
mod <- newModel("TOPIA", data = topia_elc$repo,
calendar = topia$modules$calendars$s4_h24,
region = topia_elc$regions,
horizon = topia$modules$horizons$BY2025_50_by10,
discount = 0.05)
mod <- setGeoscale(mod, topia_elc$geoscale)
scen <- interpolate_model(mod, name = "BASE")
# write the backend's model and data files without solving, to read them
# or to run the solver by hand
write_script(scen, solver = solver_options$glpk, solver.dir = tempdir())
} # }