esa / pygmo2

A Python platform to perform parallel computations of optimisation tasks (global and local) via the asynchronous generalized island model.
https://esa.github.io/pygmo2/
Mozilla Public License 2.0
434 stars 57 forks source link

Fixed tutorial bug. #167

Closed thisandthatuser closed 4 weeks ago

thisandthatuser commented 1 month ago

I was going through the tutorial titled "Coding a simple User Defined Problem" and ran into one error.

The issue seems to be that the jit decorator cannot be applied to classes for the time being.

The fix is simple and is present in the subsequent iteration of the problem (jit_rosenbrock2): applying the jit decorator to a static method (_fitness) that is then called by the class method (fitness).

I tested this by creating the docs myself. Unfortunately, the information for this is a bit lacking and required some tweaking. Perhaps this is something that can be improved.

bluescarni commented 1 month ago

@thisandthatuser thanks for the patch!