Skip to content

Formal implementation of the problem instance generation and simulation experiment conducted for the project.

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

Rosenkrands/zav

Repository files navigation

Zoning for Autonomous Vehicles

The goal of zav (Zoning for Autonomous Vehicles) is to show the implementation of the problem instance generation and simulation experiment conducted for the project.

Installation

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

# install.packages("devtools")
# note that there is a GitHub only dependency
# devtools::install_github("cuhklinlab/SWKM")
devtools::install_github("Rosenkrands/zav")

Instance generation

To generate a problem instance we can utilize the generate_2d_instance function.

library(zav)
library(ggplot2)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

instance <- generate_2d_instance(no_of_points = 100)

plot_point(instance)

Zoning solutions

Weighted K-Means

The below code chunk shows how we can utilize the solve_wkmeans function to generate a solution for our problem instance.

solution_wkm <- solve_wkmeans(instance, no_of_centers = 5, type = "swkm")
plot_bases(solution = solution_wkm)

Genetic Algorithm

The below chunk shows how we can utilize the solve_ga function to generate a solution for our problem instance.

First we need to precalculate centroids to use as input for the GA.

centroids <- grid_centroids(instance, dimension = 5)

Having now the centroids and distances between demand points and centroids, we are able to give this as input for the GA. As a default the GA will have a maximum of 10 iterations for demonstration purposes, in reality we would have a much higher number of iterations.

solution <- solve_ga(instance, centroids, no_of_centers = 5, obj = "SAFE")
plot_bases(solution)

Simulation

Here it is shown how you can make a simulation based on the solution just found.

simulation_result <- simulation(
  solution = solution_wkm,
  seed = 1,
  n_replications = 1,
  flight = "zoned",
  queue = T,
  max_dist = 1000000,
  LOS = 600,
  warmup = 0,
  speed_agent = .25,
  verbose = F
)

About

Formal implementation of the problem instance generation and simulation experiment conducted for the project.

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published