Have a look a sub-plugins: https://docs.moodle.org/dev/Subplugins
That way, each algorithm would be a separate Moodle (sub-)plugins, and so Moodle will manage the install for you.
The only way that might not be good enough is if that is too heavy-weight. However, the overhead for people implementing new algorithms is only putting each class in a separate folder, with a version.php file.
Moodle has some useful helpers, like core_component::get_plugin_list_with_class, and these are backed by data stored in a cache, so are fast.
If that does not work for you, get back to us, and we can try thinking again.