## 2 Materials and Methods
The sensor's sensitivity is defined as the displacement of the resonance angle (\(\Delta\theta_{res}\)) with the change of sensing medium's refractive index (\(\Delta n\)):  
\[S=\frac{\Delta\theta_{res}}{\Delta n} \tag{5}\]  
The optimization of the sensor configuration was performed using the non-dominated sorting genetic algorithm II (NSGA II) [33] together with the transfer matrix method [40], a ubiquitous tool in the design of surface plasmon resonance based sensors. A schematic presentation of the NSGA II implementation alongside the TMM is shown in Figure 2.  
The objectives of the problem were to: (i) maximize sensitivity (i.e., even though the algorithm is solving a minimization problem, the sensitivity is maximized by minimizing its negative); (ii) minimize the FWHM, which is related to the overall absorption in the sensor structure (i.e., when the light absorption in the metallic layer and subsequent layers increases, the reflectivity curve broadens); and (iii) minimize level of reflectivity at resonance (assuring a strong coupling between the surface plasmons and the incident light [41]). First, an initial population of 500 random configurations is generated, then the TMM computes the responses (e.g., minimum level of reflectivity, sensitivity, and FWHM) of each configuration. Second, NSGA II ranks the configurations based on their performance (nondomination) and then applies the selection to choose configurations that produce the offspring structures. Crossover (int or real SBX [42]) and mutation (int and real Polynomial [42]) operations are applied to create the offspring population. The two populations (initial and newly created after aplying genetic operations) are then combined into one set. Third, TMM computes the offspring population's responses, then sorts the configurations based on their performance (nondomination) on different fronts to select which configuration is transferred to the new generation. Solutions from the last front are then compared based on the crowding distance in order to select which configuration should be transferred to the new final population. Because NSGA II is an elitist multi-objective genetic algorithm [33], the best solutions are preserved through generations. The final population becomes the initial population from step 1 and the process is repeated until the termination criterion is met. It is worth mentioning that in multi-objective optimization, where the objectives compete with each other, solutions might exist where one objective cannot be improved without degrading the others [43], therefore, a set of optimal configurations can be found. For example, configurations with a greatly enhanced sensitivity could be generated, but they have an FWHM close to the constraint of 10 deg and, conversely, a solution with a narrow FWHM, but a sensitivity close to the imposed lower limit of 200 deg/RIU. Table 1 summarises the sensor parameters considered to be optimized. It is worth mentioning that in order to decrease the parameter space, a mixed problem was solved, where the metallic thickness, semiconductor thickness, and the number of monolayers were considered integer values, while the semiconductor refractive index was considered real. The TMM code was written in Python [44] and for the optimization, the 'pymoo' framework [45] was employed.