Add BaseAlgorithm class.