We propose a general design strategy based on genetic optimization to realize asymmetric reflectivity in periodic and non-periodic planar structures containing dielectric and gain-loss layers. By means of an optimization algorithm, it is possible to design the imaginary (or real) part of the complex permittivity distribution from any given and arbitrary real (or imaginary) permittivity distribution, i.e to create non-Hermitian potentials intended to achieve on-demand light transport for a selected spectral range. Indeed, the asymmetric response of the obtained complex permittivity distribution is directly related to its area in the complex permittivity plane. In particular, unidirectional light reflection can be designed in such a way that it switches from left to right (or vice versa) depending on the operating frequency. Moreover, such controllable unidirectional reflectivity can be realized using a stack of dielectric layers while keeping the refractive index and gain-loss within realistic values.