change fitness from list to array

optimize the code of reproduction.
This commit is contained in:
wls2002
2023-05-11 08:14:58 +08:00
parent b271a56827
commit 299ff1f8f1
4 changed files with 37 additions and 34 deletions

View File

@@ -19,7 +19,7 @@ class FunctionFittingProblem(Problem):
outs = pop_batch_forward(self.inputs)
outs = jax.device_get(outs)
fitnesses = -np.mean((self.target - outs) ** 2, axis=(1, 2))
return fitnesses.tolist()
return fitnesses
def draw(self, batch_func):
outs = batch_func(self.inputs)