shortest path with the 5 parameters considered