Implementation of Solution.add_object()