knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%",
  dpi = 300
)

Dynamic Zoning

r badger::badge_repostatus("Active")

The goal of dz is to showcase algorithms developed to handle dynamic zoning applications for the team-orienteering problem.

Installation

You can install the development version of dz from GitHub with:

# install.packages("devtools")
devtools::install_github("Rosenkrands/dz")

We can then load the library with the following command:

library(dz)

Test instances

There are 7 seven test instances included in the package. They can be accessed with dz::test_instances.

length(test_instances)
set.seed(123)
inst <- test_instances$p7_chao

plot(inst, delaunay = T)

Clustering

With the clustering function we are able to decompose an instance into a number of disjoint sets (disregarding the source node).

As of now there are two methods to perform the clustering; the greedy approach and a local search approach. Below we can see the resulting clusters from the greedy approach.

variances <- generate_variances(inst, bounds = c("min" = 10, "max" = 100))
info <- generate_information(inst, r = 20)

clust_gr <- clustering(
  inst = inst,
  k = 4,
  L = 80,
  eps = 0,
  variances = variances,
  info = info,
  cluster_method = "greedy"
)

plot(clust_gr)

The local search approach tries to improve on the greedy approach using an insertion operator. Resulting clusters from the local search approach are shown below.

set.seed(33)
suppressMessages(
  clust_ls <- clustering(
    inst = inst,
    k = 4,
    L = 80,
    eps = 0,
    variances = variances,
    info = info,
    cluster_method = "local_search",
    alpha = 1
  )
)

# saveRDS(clust_ls, file = "clust_ls.rds")

plot(clust_ls)

In the below animation we can see how the initial clustering in iteratively improved using the local search approach.

The animation is created using animate_local_search(clust_ls).

Routing based clustering

# TODO...


Rosenkrands/dz documentation built on June 26, 2022, 10:43 p.m.