  This paper considers the problem of designing the user trajectory in a
device-to-device communications setting. We consider a pair of pedestrians
connected through a D2D link. The pedestrians seek to reach their respective
destinations while using the D2D link for data exchange applications such as
file transfer, video calling, and online gaming. In order to enable better D2D
connectivity, the pedestrians are willing to deviate from their respective
shortest paths, at the cost of reaching their destinations slightly late. A
generic trajectory optimization problem is formulated and solved for the case
when full information about the problem in known in advance.
  Motivated by the D2D user's need to keep their destinations private, we also
formulate a regularized variant of the problem that can be used to develop a
fully online algorithm. The proposed online algorithm is quite efficient, and
is shown to achieve a sublinear \emph{offline} regret while satisfying the
required mobility constraints exactly. The theoretical results are backed by
detailed numerical tests that establish the efficacy of the proposed algorithms
under various settings.
