schedule: Generate a Scheduling Object

View source: R/schedule-methods.R

scheduleR Documentation

Generate a Scheduling Object

Description

Resource convenience function to generate a scheduling object from a timetable specification.

Usage

schedule(timetable, values, period = Inf)

Arguments

timetable

absolute points in time in which the desired value changes.

values

one value for each point in time.

period

period of repetition.

Value

Returns a schedule object.

See Also

add_resource.

Examples

# Schedule 3 units from 8 to 16 h
#          2 units from 16 to 24 h
#          1 units from 24 to 8 h
capacity_schedule <- schedule(c(8, 16, 24), c(3, 2, 1), period=24)

env <- simmer() %>%
  add_resource("dummy", capacity_schedule)

# Composition of schedules
sch1 <- schedule(c(8, 16), c(3, 0), period=24)
sch2 <- schedule(c(16, 24), c(2, 1), period=24)
all.equal(sch1 + sch2, capacity_schedule)


simmer documentation built on Sept. 28, 2024, 1:07 a.m.