measurementsResult: General cost function by plume-wise summary of values at...

Description Usage Arguments Details Value Author(s) Examples

View source: R/measurementsResultMap.R

Description

It evaluates values at locations plume-wise and summarises the result by calls to simulationsApply.

Usage

1
2
measurementsResult(simulations, locations, kinds, 
  fun_p = NA, fun_Rp = NA, fun_pl = NA, fun_Rpl = NA)

Arguments

simulations

Simulations object

locations

indices of locations, i.e. rows of simulations@values to be taken into account; if nothing indicated, all rows are used (invalid)

kinds

index or name of the layer of simulations@values to be used

fun_p

function for plume-wise summary; forwarded to simulationsApply – see there for details

fun_Rp

function to summarise the result of fun_p; forwarded to simulationsApply – see there for details

fun_pl

function for value-wise summary; forwarded to simulationsApply – see there for details

fun_Rpl

function to summarise the result of fun_pl; forwarded to simulationsApply – see there for details

Details

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.

Value

"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.

Author(s)

Kristina B. Helle, kristina.helle@uni-muenster.de

Examples

 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)

sensors4plumes documentation built on May 1, 2019, 10:27 p.m.