Description Usage Arguments Details Value Author(s) Examples
View source: R/measurementsResultMap.R
It evaluates values at locations plume-wise and summarises the result by calls to simulationsApply. 
| 1 2 | measurementsResult(simulations, locations, kinds, 
  fun_p = NA, fun_Rp = NA, fun_pl = NA, fun_Rpl = NA)
 | 
| simulations | 
 | 
| locations | indices of locations, i.e. rows of  | 
| kinds | index or name of the layer of  | 
| fun_p | 
 | 
| fun_Rp | 
 | 
| fun_pl | 
 | 
| fun_Rpl | 
 | 
It is a general cost function, after specifying some parameters via replaceDefault with type = "costFun" it can be used as costFun in optimiseSD. Examples are cost functions related to plume detection as given in measurementsResultFunctions.
"cost": result of fun_Rp (must be a single value in order to qualify as costFun in optimiseSD)
"costPlumes": result of fun_p, a matrix where each row represents a plume.
Kristina B. Helle, kristina.helle@uni-muenster.de
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | demo(radioactivePlumes_addProperties)
  
# sensor locations
sampleLocations1 = sample.int(nLocations(radioactivePlumes), 10)
# modify 'measurementsResult' to cost function 'singleDetection' 
singleDetection = replaceDefault(measurementsResult, newDefaults = list(
  kinds = "detectable",
  fun_p = function(x, nout = 1){
    y = 1 - max(x)
    if (length(x) == 0){
      y = 1
    }
    return(y)
    },
  fun_Rp = function(x, weight = 1, nout = 1){
    mean(x * weight$totalDose)/mean(weight$totalDose)
  }),
  type = "costFun.optimiseSD")[[1]]  
# compute cost for sensors at 'sampleLocations1'
  singleDetection1 = singleDetection(
    simulations = radioactivePlumes,
    locations = sampleLocations1) 
    
# results
# global cost: fraction of non detected plumes, weighted by their total dose:
singleDetection1[["cost"]] 
singleDetection1[["costPlumes"]] # for each plume if it is detected (0) or not (1)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.