Closed pedro-andrade-inpe closed 6 years ago
-- @example Fire in the forest example using multiple runs repeateated strategy.
if not isLoaded("ca") then
import("ca")
end
Random{seed = 70374981}
import("calibration")
local m = MultipleRuns{
model = Fire,
repetition = 30,
parameters = {
empty = Choice{min = 0.2, max = 0.9, step = 0.1},
dim = 30
}},
summary = function(result)
-- chamado apos as 30 repeticoes para uma determinada configuracao de parametros
-- 30 resultados de 0.2
-- 30 resultados de 0.3
-- ...
local sum = 0
max = -math.huge
min = math.huge
forEachElement(df.forest, function(_, value)
sum = sum + value
if max < value then
max = value
end
if min > value then
min = value
end
end)
return {
average = sum / m.repetition,
max = max,
min = min
}
end,
forest = function(model)
return model.cs:state().forest or 0
end
}
local sum = 0
forEachElement(m.output, function(_, value)
sum = sum + value.forest
end)
average = sum / m.repetition
print("Average forest in the end of "..m.repetition.." simulations: "..average)
Chart{
target = m.summary,
select = "average",
xDim = "empty"
}
Implement a function
output
to be executed after a set of repeated simulations. Update the fire example with the following function. The output of