AI added KArrive algorithm