A stigmergic algorithm for solving inverse thermal systems