gugarosa / opytimizer

🐦 Opytimizer is a Python library consisting of meta-heuristic optimization algorithms.
https://opytimizer.readthedocs.io
Apache License 2.0
599 stars 40 forks source link

Storing the best agent index at each iteration #2

Closed lzfelix closed 5 years ago

lzfelix commented 5 years ago

This PR proposes storing the index (i.e. the number of the agent) that achieved the best fitness value during each iteration. This allows the user to recover information stored by the agents in the disk after the optimization procedure, for instance, to reload the top kbest neural networks.

Previously history.best returned a list of tuples in the format [(agent-finess_0, agent-position_0), ... (agent-fitness_n, agent-position_n)]. This PR replaces this format by [(agent-finess_0, agent-position_0, agent-index_n), ... (agent-fitness_n, agent-position_n, agent-index_n)], thus mantaining backward compatibility.

Further, some unused imports were also removed.