| schedule_calendar | R Documentation |
schedule_fieldwork() hands the routes of each base to its teams with a
simple rule (longest route first, one route per team-day). This function
solves that distribution exactly as a small integer programme, through
the highs package (in Suggests), which allows the constraints of real
field work: teams unavailable on some days, routes fixed to a team or a
day, routes that must precede others, a daily limit per team that lets
two short routes share one team-day. The objective finishes as early as
possible: it minimises the last working day of the schedule and, among
schedules with the same end, the sum of the days on which routes are
done.
schedule_calendar(
schedule,
availability = NULL,
fixed = NULL,
before = NULL,
daily_limit = NULL,
time_limit = 10
)
schedule |
A |
availability |
Optional data frame with columns |
fixed |
Optional data frame with columns |
before |
Optional data frame with columns |
daily_limit |
Maximum duration of a team-day (in the unit of the
travel matrix); the routes already respect the |
time_limit |
Seconds allowed to the solver. |
The schedule with its calendar, summary and fits recomputed,
plus solver ("highs"), objective and status. An error when no
calendar satisfies the constraints within days.
set.seed(5)
pts <- data.frame(
unit = c("base1", "base2", paste0("s", 1:30)),
x = c(2, 8, runif(30, 0, 10)), y = c(2, 8, runif(30, 0, 10))
)
m <- travel_matrix(pts, method = "euclidean")
sch <- schedule_fieldwork(m,
units = paste0("s", 1:30), teams = c(base1 = 2, base2 = 1),
days = 5, max_stops = 4, iterations = 30
)
if (requireNamespace("highs", quietly = TRUE)) {
off <- data.frame(team = "base1-1", day = 1, available = FALSE)
schedule_calendar(sch, availability = off)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.