solve_emr_block: Solve the model

Description Usage Arguments Value Examples

View source: R/solve_emr_block.R

Description

Solve the model

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
solve_emr_block(
  model,
  scale_alpha = NULL,
  alpha_min = 0.1,
  alpha_max = 0.5,
  triter = 100,
  trace = FALSE,
  maxit = 1e+05,
  tol = 1e-07
)

Arguments

model

a named list with params, variables and equations.

scale_alpha

a vector of size 1 or the same number of mcc equations. The values should be between 0 and 1 and will be used as steplength for updating each undefined variable.

alpha_min

a number between 0 and 1 that will be the floor of internally computed steplength if scale_alpha is not provided.

alpha_max

a number between 0 and 1 that will be the ceiling of internally computed steplength if scale_alpha is not provided.

triter

an integer indicating the frequency that the results for convergence will be displayed.

trace

an boolean indicating if convergence numbers should be displayed.

maxit

an integer indicating the maximum number of iterations.

tol

a number indicating the convergence tolerance.

Value

Returns data and information about the model and its solution

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
library(emr)

sa_model <- simple_armington(
  v0 = c(60, 30, 10),
  eps = c(1, 10, 10),
  eta = -1,
  sigma = 4,
  regions = c("dom", "sub", "nsub"),
  t = c(0, 0, 0)
)

# tau is the change of the tariff power
# Increase the tariff in 10 percent for the sub region
sa_model$params$tau$value['sub'] <- 1.1

sol <- solve_emr(sa_model)

sol$variables

paulofelipe/emr documentation built on July 23, 2021, 7:31 p.m.