MAS-td: an approach to termination detection of multi-agent systems