  Reconfigurable intelligent metasurfaces have been proposed as an efficient
solution for improving wireless telecommunication systems in multiple
scattering or reverberating media. Concurrently, topology optimization has been
successfully employed as an inverse design technique in many fields, and
particularly in electromagnetics. In this work, we apply a gradient-based
topology optimization for tuning the binary elements of a metasurface for a
focusing goal in a complex environment. First, the metasurface unit-cells are
approximated as point sources and, then, the optimization problem is
formulated. Afterwards, the proposed method is applied to find the optimal
parameter sets on three distinct environments of an ascending complexity and
the resulting focus for each case is demonstrated via simulations. The
combination of reverberating cavity and a metasurface inside the latter reveals
very powerful since everything can be solved analytically for focusing outside
the cavity.
