## 3 Solution Approach
### General Overview of the Stochastic Variable Neighborhood Algorithm
Since again \(p_{\mathrm{swap}}=1.0\) was the value giving the best results, we further experimented, setting \(p_{\mathrm{swap}}\) equal to 0.995, 0.996, 0.997, 0.998 and 0.999. Although, once again \(p_{\mathrm{swap}}=1.0\) was the value giving the best results, we decided to use \(p_{\mathrm{swap}}=0.99995\), since a value of \(p_{\mathrm{swap}}=1.0\) would make the execution of swaps deterministic and not stochastic. Using \(p_{\mathrm{swap}}=1.0\) would lead the algorithm to poor diversification and big intensification. To conclude, we noticed that for all instances, setting \(p_{\mathrm{swap}}\) to a big value causes big intensification, while setting \(p_{\mathrm{swap}}\) to a small value causes big diversification. After setting the parameters' values, the initialization of each individual of the proposed algorithm's population takes place. This is done at random with respect to the working requirements of each day. Next, the first phase of the algorithm, which deals with the assignment of nurses to working days, is executed. After the first phase is completed, the best individual found is copied to all individuals of the population, and shift types are randomly assigned to them. Therefore, the input to the second phase of the algorithm is a population of individuals, all of them being equivalent, by means of workings, to the best individual found by the first phase, with shift types randomly assigned to them. Finally, the second phase of the algorithm, which deals with the assignment of nurses to shift types, is executed, leading to the near optimal solution found by the proposed algorithm. Since the seven nurse rostering input instances, to which the proposed algorithm is applied, are totally different cases of nurse rostering problems, there are significant differences, between them, in nature, structure, philosophy and type of hard and soft constraints. As a result, a different evaluation function is used for each different input instance taking into account different constraints and having different weight values. The specific constraints and the weight values used for each different constraint for each different input instance are the ones presented in [38]. However, a general form of the evaluation function applied to all instances can be presented as follows:  
\[ \begin{array}{l}\textit{Weight\_function}(\textit{Weight\_of\_1 st\_Constraint})\times\textit{Times\_1 st\_Constraint\_is\_violated}+...+\\ \textit{Weight\_function}(\textit{Weight\_of\_nth\_Constraint})\times\textit{Times\_nth\_Constraint\_is\_violated}\end{array}  \tag{1}\]  
where the _ith Constraint_ is different for each different input instance, _Weight_of_ith_Constraint_ is the weight of the _ith Constraint_ (which is different for each different input instance) and _Times_ith_Constraint_is_violated_ is the number of times the _ith Constraint_ is violated. In addition, _Weight_function_(_Weight_of_ith_Constraint_) equals _Weight_of_ith_Constraint_, if the _ith Constraint_ is assumed linear, while _Weight_function_(_Weight_of_ith_Constraint_) equals _Weight_of_ith_Constraint_\(\times\textit{Weight\_of\_ith\_Constraint}\) if the _ith Constraint_ is assumed quadratic. Whether a constraint is assumed linear or quadratic depends, once again, on the input instance, and it is explicitly stated. At this point, we have to mention that for all input instances, the evaluation function takes into account only constraints concerning working days and day offs in the first phase of the algorithm, while it takes into account all kinds of constraints in the second phase of the algorithm.