| schedule_fieldwork | R Documentation |
Solves the assignment of the units to bases (depots) and their routing
jointly, as one multi-depot problem: every route (one team-day) leaves
from and returns to one base, each base may send at most teams * days
routes, and the objective is the total travel plus the per_route cost of
the cost model for every route opened. The routes of each base are then
distributed over its teams and the days available, longest routes first,
so that the teams finish as evenly as possible. The result is a calendar:
which team visits which units on which day, and whether the work fits.
schedule_fieldwork(
matrix,
units,
teams,
days,
bases = NULL,
max_length = Inf,
max_stops = Inf,
service_time = 0,
cost_model = NULL,
iterations = 200,
time_limit = NULL,
alpha = 0.3,
seed = 1,
engine = c("fieldopt", "vrpr"),
region = NULL
)
matrix |
A |
units |
Names of the units to visit, or a |
teams |
Named vector: number of teams per base (names are units of
the matrix that act as bases). A single unnamed number with one base is
accepted when |
days |
Number of working days available. |
bases |
Optional names of the bases when |
max_length, max_stops, service_time |
Daily limits of a route, as in
|
cost_model |
Optional |
iterations, time_limit, alpha, seed, engine |
Solver settings of
|
region |
Optional data frame with columns |
When the team-days of the bases are not enough, the routes are solved
without the limit per base and the calendar reports how many days each
base would need (fits is FALSE).
An object of class fieldopt_schedule: calendar (a tibble with
one row per route: base, team, day, route, stops, travel,
duration, and units as a list column), assignment (unit, base),
routes (the route_fieldwork() solution of each base), summary
(per base: units, teams, routes, days needed, days available, whether
it fits), fits and cost.
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 = 4, max_stops = 4, iterations = 30
)
sch
sch$calendar
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.