aports/community/py3-niapy/numpy2-float.patch
2024-11-08 21:47:02 +00:00

23 lines
1011 B
Diff

From 99cb246ed483d5961d4ff17395732abcb85dced1 Mon Sep 17 00:00:00 2001
From: "Iztok Fister Jr." <iztok@iztok.dev>
Date: Fri, 8 Nov 2024 15:08:37 +0100
Subject: [PATCH] Fix numpy 2.0 compatibility in ILSHADE implementation
---
niapy/algorithms/modified/ilshade.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/niapy/algorithms/modified/ilshade.py b/niapy/algorithms/modified/ilshade.py
index e0f3fd6a..de3d7b28 100644
--- a/niapy/algorithms/modified/ilshade.py
+++ b/niapy/algorithms/modified/ilshade.py
@@ -244,7 +244,7 @@ def post_selection(self, pop, arc, arc_ind_cnt, task, xb, fxb, pbest_factor, **k
max_nfe = task.max_evals
nfe = task.evals
- next_pop_size = np.int_(np.around((((4.0 - self.population_size) / np.float_(max_nfe)) * nfe) + self.population_size))
+ next_pop_size = np.int_(np.around((((4.0 - self.population_size) / np.float64(max_nfe)) * nfe) + self.population_size))
if next_pop_size < 4:
next_pop_size = 4