The first two algorithms are perfect, but the third one has a major issue: since the fitness consists of two elements (valid and cost), you need to account for non-valid solutions. The variable df compares only the cost part of the fitness, as you need a value to compute the exponential. As a result, non-valid solutions can be accepted as better than the current solution, leading to a final result where the cost is 0 (the solution that selects 0 sets).
I propose a solution by modifying the fitness function to assign a very bad fitness score to non-valid solutions.
Additionally, I suggest an improvement regarding the constant cooling rate: experiment with adaptive or non-linear cooling schedules that adjust based on the progress of the search.
The idea is to combine the self-adaptive strength approach from RMHC with simulated annealing. In the following solution, I introduce a self-adaptive mutation for the cooling rate based on how much the fitness has changed over the last 100 steps.
The first two algorithms are perfect, but the third one has a major issue: since the fitness consists of two elements (valid and cost), you need to account for non-valid solutions. The variable df compares only the cost part of the fitness, as you need a value to compute the exponential. As a result, non-valid solutions can be accepted as better than the current solution, leading to a final result where the cost is 0 (the solution that selects 0 sets).
I propose a solution by modifying the fitness function to assign a very bad fitness score to non-valid solutions.
Additionally, I suggest an improvement regarding the constant cooling rate: experiment with adaptive or non-linear cooling schedules that adjust based on the progress of the search.
The idea is to combine the self-adaptive strength approach from RMHC with simulated annealing. In the following solution, I introduce a self-adaptive mutation for the cooling rate based on how much the fitness has changed over the last 100 steps.