assert cost obj

my computer froze b/c i passed to the algo an obj that wasn't really a
cost obj.