Solving linear Diophantine constraints