Abstract:Arbitrary pattern formation (\textsc{Apf}) is a well-studied problem in swarm robotics. The problem has been considered in two different settings so far; one is in a plane and another is in an infinite grid. This work deals with the problem in an infinite rectangular grid setting. The previous works in literature dealing with \textsc{Apf} problem in infinite grid had a fundamental issue. These deterministic algorithms use a lot of space in the grid to solve the problem mainly because of maintaining the asymmetry of the configuration or to avoid a collision. These solution techniques can not be useful if there is a space constraint in the application field. In this work, we consider luminous robots (with one light that can take two colors) to avoid symmetry, but we carefully designed a deterministic algorithm that solves the \textsc{Apf} problem using minimal required space in the grid. The robots are autonomous, identical, and anonymous and they operate in Look-Compute-Move cycles under a fully asynchronous scheduler. The \textsc{Apf} algorithm proposed in [WALCOM'2019] by Bose et al. can be modified using luminous robots so that it uses minimal space but that algorithm is not move-optimal. The algorithm proposed in this paper not only uses minimal space but also asymptotically move-optimal. The algorithm proposed in this work is designed for an infinite rectangular grid but it can be easily modified to work in a finite grid as well.