community/py3-mealpy: fix tests with numpy 2.0
Update numpy ptp()
function to fix failed tests. Rebuild error found on the 3.21 builders (error log).
list_fitness = array([218.7586253 , 171.72733885, 233.40347259, 442.70814095,
100.83268922, 253.5196244 , 457.55837116, 170.45...32393, 264.05407671,
134.28810168, 219.71994452, 209.16796685, 225.74575111,
377.59826666, 84.63354317])
def get_index_roulette_wheel_selection(self, list_fitness: np.array):
"""
This method can handle min/max problem, and negative or positive fitness value.
Args:
list_fitness (nd.array): 1-D numpy array
Returns:
int: Index of selected solution
"""
if type(list_fitness) in [list, tuple, np.ndarray]:
list_fitness = np.array(list_fitness).flatten()
> if list_fitness.ptp() == 0:
E AttributeError: `ptp` was removed from the ndarray class in NumPy 2.0. Use np.ptp(arr, ...) instead.
mealpy/optimizer.py:625: AttributeError