MCPcopy Create free account
hub / github.com/anyoptimization/pymoo / _evaluate_elementwise

Method _evaluate_elementwise

pymoo/core/problem.py:227–248  ·  view source on GitHub ↗
(self, X, out, *args, **kwargs)

Source from the content-addressed store, hash-verified

225 self._evaluate(X, out, *args, **kwargs)
226
227 def _evaluate_elementwise(self, X, out, *args, **kwargs):
228
229 # create the function that evaluates a single individual
230 f = self.elementwise_func(self, args, kwargs)
231
232 # execute the runner
233 elems = self.elementwise_runner(f, X)
234
235 # for each evaluation call
236 for elem in elems:
237 # for each key stored for this evaluation
238 for k, v in elem.items():
239 # if the element does not exist in out yet -> create it
240 if out.get(k, None) is None:
241 out[k] = []
242
243 out[k].append(v)
244
245 # convert to arrays (the none check is important because otherwise an empty array is initialized)
246 for k in out:
247 if out[k] is not None:
248 out[k] = anp.array(out[k])
249
250 def _format_dict(self, out, N, return_values_of):
251

Callers 1

doMethod · 0.95

Calls 2

appendMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected