Using Weighted Constraints To Build Tutoring Systems: A Study Case in Logic Programming