Last data update: 2014.03.03

R: Function to carry out optimization of fuel model by genetic...
gaRothR Documentation

Function to carry out optimization of fuel model by genetic algorithms

Description

Genetic algorithms (GA) are a technique of machine-based mathematical optimization. The algorithm searches, within user-defined ranges, for values that minimize or maximize a target function. Here, fuel model parameters are searched that minimize root mean square error (RMSE) of forward fire rate of spread predicted by Rothermel (1972) model against observed data. Depends on package "GA" (Scrucca 2013) for the execution of the genetic algorithm; refer to this publication for a full explanation of GA parameters and settings.

Usage

gaRoth (
  w_1h = range(SFM_metric[,-1][,1]),
  w_10h = range(SFM_metric[,-1][,2]) ,
  w_100h = range(SFM_metric[,-1][,3]) , 
  w_Live_Herb = range(SFM_metric[,-1][,4])  ,
  w_Live_Woody = range(SFM_metric[,-1][,5])  ,
  s_1h = range(SFM_metric[,-1][,6])  ,
  s_10h = range(SFM_metric[,-1][,7])  ,
  s_100h = range(SFM_metric[,-1][,8])  ,
  s_Live_Herb = range(SFM_metric[,-1][,9]) , 
  s_Live_Woody = range(SFM_metric[,-1][,10]) , 
  delta = range(SFM_metric[,-1][,11])  ,
  mx.dead = range(SFM_metric[,-1][,12])  ,
  h_1h = range(SFM_metric[,-1][,13])  ,
  h_10h = range(SFM_metric[,-1][,14])  ,
  h_100h = range(SFM_metric[,-1][,15]) , 
  h_Live_Herb = range(SFM_metric[,-1][,16]) , 
  h_Live_Woody = range(SFM_metric[,-1][,17])  ,
  m, u, slope, modeltype, obs,
  method="rmse", maxiter=50, popSize = 20, pcrossover = 0.8, 
  pmutation = 0.1, elitism = base::max(1, round(popSize * 0.05)), 
  ...)

Arguments

w_1h

a vector of minimum and maximum fuel load [t/ha] for fuel class 1-hour; (0,0) if fuel class is absent.

w_10h

a vector of minimum and maximum fuel load [t/ha] for fuel class 10-hour; (0,0) if fuel class is absent.

w_100h

a vector of minimum and maximum fuel load [t/ha] for fuel class 100-hour; (0,0) if fuel class is absent.

w_Live_Herb

a vector of minimum and maximum fuel load [t/ha] for live herbs; (0,0) if fuel class is absent.

w_Live_Woody

a vector of minimum and maximum fuel load [t/ha] for live woody fuels; (0,0) if fuel class is absent.

s_1h

a vector of minimum and maximum surface-to-volume ratio [m2/m3] for fuel class 1-hour; (0,0) if fuel class is absent.

s_10h

a vector of minimum and maximum surface-to-volume ratio [m2/m3] for fuel class 10-hour; (0,0) if fuel class is absent.

s_100h

a vector of minimum and maximum surface-to-volume ratio [m2/m3] for fuel class 100-hour; (0,0) if fuel class is absent.

s_Live_Herb

a vector of minimum and maximum surface-to-volume ratio [m2/m3] for live herbs; (0,0) if fuel class is absent.

s_Live_Woody

a vector of minimum and maximum surface-to-volume ratio [m2/m3] for live woody fuels; (0,0) if fuel class is absent.

delta

a vector of minimum and maximum fuel bed depth [cm].

mx.dead

a vector of minimum and maximum dead fuel moisture of extinction [percent].

h_1h

a vector of minimum and maximum heat content [kJ/kg] for fuel class 1-hour; (0,0) if fuel class is absent.

h_10h

a vector of minimum and maximum heat content [kJ/kg] for fuel class 10-hour; (0,0) if fuel class is absent.

h_100h

a vector of minimum and maximum heat content [kJ/kg] for fuel class 100-hour; (0,0) if fuel class is absent.

h_Live_Herb

a vector of minimum and maximum heat content [kJ/kg] for live herbs; (0,0) if fuel class is absent.

h_Live_Woody

a vector of minimum and maximum heat content [kJ/kg] for live woody fuels; (0,0) if fuel class is absent.

modeltype

select S(tatic) or D(ynamic) Rothermel model.

obs

a vector of observed ROS [m/min].

m

a data frame of percent moisture on a dry weight basis [percent] for fuel classes 1-hour, 10-hour, 100-hour, live herbs and live woody, respectively (5 values or columns; 0 if fuel class is absent).

u

a vector of midflame windspeed [km/h].

slope

a vector of percent site slope [percent].

method

method of forecast error measure, see error.

maxiter

the maximum number of iterations to run before the GA search is halted.

popSize

the population size.

pcrossover

the probability of crossover between pairs of chromosomes. Typically this is a large value and by default is set to 0.8.

pmutation

the probability of mutation in a parent chromosome. Usually mutation occurs with a small probability, and by default is set to 0.1.

elitism

the number of best fitness individuals to survive at each generation. By default the top 5/100 individuals will survive at each iteration.

...

additional arguments to be passed to ga.

Details

The function defaults to a real-valued coded GA. Default values for fuel models are currently extracted from the standard Fuel Models table by Anderson (1982) and Scott and Burgan (2005). GA optimization is calculated from a vector of predicted vs. observed data; therefore, vectors of two or more values must be entered for observations, wind speed, and slope, and a data frame with 5 columns and two or more lines must be entered for fuel moisture (see ros). Since ga defaults to maximizing the fitness function, the opposite of the error metric is computed (i.e., with a negative sign).

Value

Returns an object of class ga-class. The best solution is reported by the S4 slot "solution". The opposite of the fitness value is reported by the slot "fitnessValue".

Author(s)

Giorgio Vacchiano, Davide Ascoli (DISAFA, University of Torino, Italy)

References

Rothermel, R. C. (1972). A mathematical model for fire spread predictions in wildland fires. Research Paper INT-115. Ogden, UT: US Department of Agriculture, Forest Service, Intermountain Forest and Range Experiment Station.

Scrucca, L. (2013). GA: A Package for Genetic Algorithms in R. Journal of Statistical Software, 53(4), 1-37. URL http://www.jstatsoft.org/v53/i04/.

See Also

ros, firexp, SFM_metric

Examples

library (Rothermel)

# Observed site variables and ROS
data (firexp) 
m <- firexp [, 18:22]
u <- firexp [, "u"]
slope <- firexp [, "slope"]
obs <- firexp [, "ros"]
modeltype <- "S"

# GA optimization using minimization of Root mean square error ("rmse")
# Ranges for fuel model parameters after Ascoli et al. (2015)

ga.model <- gaRoth (m=m, u=u, slope=slope, obs=obs, modeltype=modeltype, 
            method="rmse", popSize=20, maxiter=5,
            w_1h = c(1.5,7.24),
            w_10h = c(0,0),
            w_100h = c(0,0), 
            w_Live_Herb = c(0,0),
            w_Live_Woody = c(2.9,10.4),
            s_1h = c(6640,10036),
            s_10h = c(0,0),
            s_100h = c(0,0),
            s_Live_Herb = c(0,0), 
            s_Live_Woody = c(8810,10560), 
            delta = c(19,70),
            mx.dead = c(25,50),
            h_1h = c(18719,19919),
            h_10h = c(0,0),
            h_100h = c(0,0), 
            h_Live_Herb = c(0,0), 
            h_Live_Woody = c(20000,22504)
            )

summary(ga.model)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Rothermel)
Loading required package: GA
Loading required package: foreach
Loading required package: iterators
Package 'GA' version 3.0.2
Type 'citation("GA")' for citing this R package in publications.
Loading required package: ftsa
Loading required package: forecast
Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

Loading required package: timeDate
This is forecast 7.1 

Loading required package: rainbow
Loading required package: MASS
Loading required package: pcaPP
Loading required package: sde
Loading required package: stats4
Loading required package: fda
Loading required package: splines
Loading required package: Matrix

Attaching package: 'fda'

The following object is masked from 'package:forecast':

    fourier

The following object is masked from 'package:graphics':

    matplot

sde 2.0.15
Companion package to the book
'Simulation and Inference for Stochastic Differential Equations With R Examples'
Iacus, Springer NY, (2008)
To check the errata corrige of the book, type vignette("sde.errata")

Attaching package: 'ftsa'

The following objects are masked from 'package:stats':

    median, sd, var

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Rothermel/gaRoth.Rd_%03d_medium.png", width=480, height=480)
> ### Name: gaRoth
> ### Title: Function to carry out optimization of fuel model by genetic
> ###   algorithms
> ### Aliases: gaRoth
> ### Keywords: model
> 
> ### ** Examples
> 
> library (Rothermel)
> 
> # Observed site variables and ROS
> data (firexp) 
> m <- firexp [, 18:22]
> u <- firexp [, "u"]
> slope <- firexp [, "slope"]
> obs <- firexp [, "ros"]
> modeltype <- "S"
> 
> # GA optimization using minimization of Root mean square error ("rmse")
> # Ranges for fuel model parameters after Ascoli et al. (2015)
> 
> ga.model <- gaRoth (m=m, u=u, slope=slope, obs=obs, modeltype=modeltype, 
+             method="rmse", popSize=20, maxiter=5,
+             w_1h = c(1.5,7.24),
+             w_10h = c(0,0),
+             w_100h = c(0,0), 
+             w_Live_Herb = c(0,0),
+             w_Live_Woody = c(2.9,10.4),
+             s_1h = c(6640,10036),
+             s_10h = c(0,0),
+             s_100h = c(0,0),
+             s_Live_Herb = c(0,0), 
+             s_Live_Woody = c(8810,10560), 
+             delta = c(19,70),
+             mx.dead = c(25,50),
+             h_1h = c(18719,19919),
+             h_10h = c(0,0),
+             h_100h = c(0,0), 
+             h_Live_Herb = c(0,0), 
+             h_Live_Woody = c(20000,22504)
+             )
> 
> summary(ga.model)
+-----------------------------------+
|         Genetic Algorithm         |
+-----------------------------------+

GA settings: 
Type                  =  real-valued 
Population size       =  20 
Number of generations =  5 
Elitism               =  1 
Crossover probability =  0.8 
Mutation probability  =  0.1 
Search domain = 
    w_1h w_10h w_100h w_Live_Herb w_Live_Woody  s_1h s_10h s_100h s_Live_Herb
Min 1.50     0      0           0          2.9  6640     0      0           0
Max 7.24     0      0           0         10.4 10036     0      0           0
    s_Live_Woody delta mx.dead  h_1h h_10h h_100h h_Live_Herb h_Live_Woody
Min         8810    19      25 18719     0      0           0        20000
Max        10560    70      50 19919     0      0           0        22504

GA results: 
Iterations             = 5 
Fitness function value = -2.300951 
Solution = 
         w_1h w_10h w_100h w_Live_Herb w_Live_Woody     s_1h s_10h s_100h
[1,] 3.328878     0      0           0     8.257502 8512.762     0      0
     s_Live_Herb s_Live_Woody    delta  mx.dead     h_1h h_10h h_100h
[1,]           0     9913.583 61.54636 44.95239 19853.09     0      0
     h_Live_Herb h_Live_Woody
[1,]           0     20389.63
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>