source("utilities.R")
library(dplyr)
#df = generate_instance(8,tw.randomized = F)
# xlsx::write.xlsx(df, "dataR.xlsx")
df$x[4] = 5
text(df$x[2:9], df$y[2:9], 1:8, pos = 3)
tr = c(0,1,4,3,8,6,2,0)+1
dr = matrix(c(2,6,5,
              1,8,2),2,3,byrow = T)
plot_dronetruck(tr, dr)
points(mean(df$x[tr[-c(1,length(tr))]]),
       mean(df$y[tr[-c(1,length(tr))]]), pch = 23, bg = "red", cex = 2)
tr = c(0,1,4,8,6,0)+1
dr = matrix(c(2,6,5,
              1,8,2),2,3,byrow = T)
plot_dronetruck(tr, dr)

tr = c(0,1,4,8,6,0)+1
dr = matrix(c(2,6,5,
              1,8,2,
              5,4,7,
              7,3,1),4,3,byrow = T)
plot_dronetruck(tr, dr)

tr = c(0,1,4,5,8,6,2,0)+1
plot_dronetruck(tr, dr)

tr = c(0,1,4,5,8,6,2,0)+1
dr = matrix(c(1,8,2,
              5,4,6),2,3,byrow = T)
plot_dronetruck(tr, dr)


tr = c(0,1,4,3,8,0)+1
dr = matrix(c(
              1,8,2),1,3,byrow = T)
plot_dronetruck(tr, dr)


points(mean(df$x[tr[-c(1,length(tr))]]),
       mean(df$y[tr[-c(1,length(tr))]]), pch = 23, bg = "red", cex = 2)
tr2 = c(0,7,1,4,8,6,0)+1
plot_dronetruck(tr2, dr)
