Solve the model

solve_emr(model, start = NULL, method = "BB", ...)

Arguments

model

a named list with params, variables and equations.

start

a vector with start values for undefined variables. If NULL, the currente value will be used.

method

the solver to be used: BB or nleqslv

...

the other arguments to be passed into the solver control argument.

Value

Returns data and information about the model and its solution

Examples

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") ) # tau is the power tariff change # Increase the tariff in 10 percent for the sub region sa_model$params$tau$value['sub'] <- 1.1 sol <- solve_emr(sa_model)
#> Iteration: 0 ||F(x0)||: 0.3547567 #> iteration: 10 ||F(xn)|| = 0.001085224 #> iteration: 20 ||F(xn)|| = 4.766864e-07
sol$variables
#> $p #> dom sub nsub #> 1.021240 1.078515 1.007535 #> #> $q_d #> dom sub nsub #> 1.0212404 0.8209848 1.0779533 #> #> $q_s #> dom sub nsub #> 1.0212404 0.8209848 1.0779532 #> #> $P #> P #> 1.035651 #> #> $Q #> Q #> 0.9655765 #>