solve_model() interpolates a model with interpolate_model() and solves
it (an already-interpolated scenario passed to it is solved as-is; an
un-interpolated one is interpolated first). solve_scenario() solves a
scenario that was already interpolated with interpolate_model() and
errors otherwise. Both reuse the write / run / read framework
(.executeScenario()); all solver backends (GLPK/GMPL, GAMS, Pyomo, JuMP)
work unchanged. The transitional names solve_mod() / solve_scen() are
deprecated aliases.
Usage
solve_mod(obj, ...)
solve_scen(obj, ...)
solve_model(obj, name = NULL, solver = NULL, ondisk = FALSE, fold = FALSE, ...)
solve_scenario(
obj,
name = obj@name,
solver = NULL,
solver.dir = NULL,
transient = FALSE,
force = FALSE,
kvl = NULL,
variant = NULL,
...,
tmp.dir = NULL,
tmp.del = NULL
)Arguments
- obj
a model object (
solve_model()) or an interpolated scenario object (solve_scenario()).- ...
for
solve_model(), arguments are routed tointerpolate_model()(settings / calendar / horizon / model data) or to the solver run (solver.dir,transient,force,read.solution,wait,echo,run,run.conflict,n.threads, ...). Forsolve_scenario(), arguments are passed to.executeScenario(). Setecho = FALSEfor a quiet run: it silences both the progress messages and the solver's own console output.rundoubles as the run label:TRUE/FALSEkeeps its historical meaning (run the solver or only write the script), while a character value names the run — the solve lands in<scenario>/runs/<run>/(orruns/<variant>/<run>/for an own-problem variant) with arun.ymlprovenance record (default label: the solver directory name, e.g."glpk").run.conflictcontrols an existing recorded run under the same label:"overwrite"(default),"suffix"(append-2,-3, ...),"error". Seescenario_runs()to list runs andread_solution()to switch between them.- name
character name of the scenario to create / return.
- solver
a character or list with solver settings. When
NULL, the scenario's own solver settings orget_default_solver()are used.- ondisk, fold
passed to
interpolate_model(). Defaults (FALSE/FALSE) keep parameters in memory and unfolded, matching the shape the writers expect.- solver.dir
character, an EXTERNAL solver working directory. When set, the solve runs there verbatim and records no run; the default (
NULL) solves into the scenario's own run directoryruns/[<variant>/]<label>/solver/.- transient
logical, use a throwaway timestamp directory deleted after the run (no run record).
- force
logical, re-solve a scenario already solved to optimal.
- variant
character (
solve_scenario()only): declare the scenario's interpolated problem an OWN-PROBLEM VARIANT of this name. Its solves land inruns/<variant>/<solve>/, andsave_scenario()stores the variant's problem (modInp, settings snapshot,variant.yml) underruns/<variant>/— once, shared by all its solves — leaving the scenario-level (base) problem untouched. Switch between problems withread_solution()(run = "<variant>/<solve>"vsrun = "<solve>").- tmp.dir, tmp.del
deprecated aliases of
solver.dir/transient.
