Better logging

I want to configure whether to write logs iterations and results in algorithms easily.

Edited by Kenta Kabashima