This guide runs a small,
deterministic model through the supported GEModelR workflow. It creates
the TABLO text and input arrays locally, so the example does not need
external HAR files or GTAP data.
Prepare a small model
Create the model object, parse its TABLO equations, define the
closure, and load the in-memory data with the sparse engine.
fixture = makeFirstSimulationFixture()
model = GEModelR::GEModel$new()
model$loadTablo(fixture$tabloPath)
model$setClosure("tax")
model$loadData(fixture$inputData, engine = "sparse")
Apply a shock and solve
The indexed shock changes the tax variable in the south region. The
example selects the supported Matrix sparse backend explicitly and
disables post-simulation updates so the reported values are only the
solver result.
model$setShocks(setNames(4, 'tax["south"]'))
model$solveModel(
iter = 1,
steps = 1,
engine = "sparse",
postsim = FALSE,
diagnostics = TRUE,
output = "full",
backend = "Matrix",
reduction = "off"
)
Inspect the result
The solution follows the fixture’s region order. The diagnostics
envelope records which engine and backend handled the solve.
data.frame(
region = fixture$regions,
solution = unname(model$solution)
)
#> region solution
#> 1 north 0
#> 2 south 6
#> 3 east 0
model$lastDiagnostics[c("status", "engine", "requested_backend")]
#> $status
#> [1] "succeeded"
#>
#> $engine
#> [1] "sparse"
#>
#> $requested_backend
#> [1] "Matrix"