Julia syntax for calculating a scenario

To calculate a scenario with NEMO, you use the calculatescenario function. The only required argument is dbpath; NEMO provides a default value for all other arguments.

NemoMod.calculatescenarioFunction
calculatescenario(dbpath; jumpmodel = Model(solver = GLPKSolverMIP(presolve=true)),
varstosave = "vdemandnn, vnewcapacity, vtotalcapacityannual,
    vproductionbytechnologyannual, vproductionnn, vusebytechnologyannual,
    vusenn, vtotaldiscountedcost",
numprocs::Int = 0, targetprocs = Array{Int, 1}(), restrictvars = true,
reportzeros = false, continuoustransmission = false, quiet = false)

Calculates a scenario specified in a scenario database. Returns a Symbol indicating the solve status reported by the solver (e.g., :Optimal).

Arguments

  • dbpath::String: Path to the scenario database (must be a SQLite version 3 database).
  • jumpmodel::JuMP.Model: JuMP model object specifying the MIP solver to be used. Examples: Model(solver = GLPKSolverMIP(presolve=true)), Model(solver = CplexSolver()), Model(solver = CbcSolver(logLevel=1, presolve="on")). Note that the solver's Julia package (Julia wrapper) must be installed. See the documentation for solver Julia packages for information on how to configure solver options.
  • varstosave::String: Comma-delimited list of output variables whose results should be saved in the scenario database.
  • numprocs::Int: Number of Julia processes to use for parallelized operations within the scenario calculation. Ignored if targetprocs is specified. Should be a positive integer or 0 for half the number of logical processors on the executing machine (i.e., half of Sys.CPU_THREADS). When numprocs is in effect, NEMO selects processes for parallel operations from Distributed.procs(). Processes are taken in the order they appear in this array. If there are not enough processes defined in Distributed.procs(), NEMO adds processes on the local host as needed.
  • targetprocs::Array{Int, 1}: Identifiers of Julia processes that should be used for parallelized operations within the scenario calculation.
  • restrictvars::Bool: Indicates whether NEMO should conduct additional data analysis to limit the set of model variables created for the scenario. By default, to improve performance, NEMO selectively creates certain variables to avoid combinations of subscripts that do not exist in the scenario's data. This option increases the stringency of this filtering. It requires more processing time as the model is built, but it can substantially reduce the solve time for large models.
  • reportzeros::Bool: Indicates whether results saved in the scenario database should include values equal to zero. Specifying false can substantially improve the performance of large models.
  • continuoustransmission::Bool: Indicates whether continuous (true) or binary (false) variables are used to represent investment decisions for candidate transmission lines. Not relevant in scenarios that do not model transmission.
  • quiet::Bool: Suppresses low-priority status messages (which are otherwise printed to STDOUT).

To access calculatescenario within Julia, you must first tell Julia you want to use NEMO. This is done with the using command.

julia> using NemoMod

julia> NemoMod.calculatescenario("c:/temp/scenario_db.sqlite")

If you want to provide a value for the jumpmodel argument, make sure to include JuMP and your solver's Julia package in the using command. For example:

julia> using NemoMod, JuMP, CPLEX

julia> NemoMod.calculatescenario("c:/temp/scenario_db.sqlite"; jumpmodel = Model(solver = CplexSolver()), restrictvars = true)