macroregion: Constructor for object of class 'macroregion'

Description Usage Arguments Value Methods (by generic) Note Examples

View source: R/macroregion.R

Description

The function macroregion() is the constructor function for the homonymous class.

Usage

 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
30
31
32
## S3 method for class 'macroregion'
get_centers(x, ...)

## S3 method for class 'macroregion'
get_regions(x, ...)

## S3 method for class 'macroregion'
get_all_region(x, ...)

## S3 method for class 'macroregion'
get_state(x, ...)

## S3 method for class 'macroregion'
get_p_accept(x, ...)

## S3 method for class 'macroregion'
get_offered(x, ...)

## S3 method for class 'macroregion'
get_initial_strip(x, ...)

## S3 method for class 'macroregion'
get_current_strip(x, ...)

## S3 method for class 'macroregion'
get_time(x, ...)

macroregion(name, regions, initial_strip = purrr::map_chr(regions,
  "region"))

## S3 method for class 'macroregion'
print(x, ...)

Arguments

x

an object used to select a method.

...

further arguments passed to or from other methods.

name

[chr] the name of the macroregion

regions

[lst] a list of objects of class regions, passed by set_regions(). Note: all the region in a macroregion must be of the same state.

initial_strip

[chr] e sequence of regions' names in the macroregion representing the order in which organs started to be distributed in the macroregion at the beginning of the period. All the listed regions have to be included also in the regions field. Repetition are admitted as well as exculsions.

Value

An object of class macroregion.

Methods (by generic)

Note

exclude a region from the base_strip is the same as include a region with zero get_p_accept parameter. Anyway, in such a case, it is always preferred to set get_p_accept to zero for those region (i.e. for all their centers) and also exclude them from the strip. Note also that if a region is included in a macroregion with a zero get_p_accept parameter and/or not in the strip, it will provide anyway its surplus organ with a priority for the macroregion.

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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
pavia   <- center('Pavia',   'Lombardia', offered = 5, p_accept = 0.6)
bergamo <- center('Bergamo', 'Lombardia', 8)
milano  <- center('Milano',  'Lombardia', 10, 0.8)
lombardia <- region(set_centers(pavia, bergamo, milano), default_p = 0.7)

padova <- center('Padova', 'Veneto', 8, 0.7)
veneto <- region(set_centers(padova))

nitp <- macroregion('NITp',
  regions = set_regions(lombardia, veneto),
  initial_strip = c('lombardia', 'lombardia', 'veneto')
)
get_centers(nitp)
get_regions(nitp)
get_all_region(nitp)
get_state(nitp) # "italy"
pavia   <- center('Pavia',   'Lombardia', offered = 5, p_accept = 0.6)
bergamo <- center('Bergamo', 'Lombardia', 8)
milano  <- center('Milano',  'Lombardia', 10, 0.8)
lombardia <- region(set_centers(pavia, bergamo, milano), default_p = 0.7)

padova <- center('Padova', 'Veneto', 8, 0.7)
veneto <- region(set_centers(padova))

nitp <- macroregion('NITp',
  regions = set_regions(lombardia, veneto),
  initial_strip = c('lombardia', 'lombardia', 'veneto')
)
get_p_accept(nitp)
get_offered(nitp)
get_initial_strip(nitp)
get_current_strip(nitp)
get_time(nitp)
pavia   <- center('Pavia',   'Lombardia', offered = 5, p_accept = 0.6)
bergamo <- center('Bergamo', 'Lombardia', 8)
milano  <- center('Milano',  'Lombardia', 10, 0.8)
lombardia <- region(set_centers(pavia, bergamo, milano), default_p = 0.7)

padova <- center('Padova', 'Veneto', 8, 0.7)
veneto <- region(set_centers(padova))

nitp <- macroregion('NITp',
  regions = set_regions(lombardia, veneto),
  initial_strip = c('lombardia', 'lombardia', 'veneto')
)

UBESP-DCTV/clumpr documentation built on July 3, 2021, 11:23 p.m.