-
مسئله water jug با ++C
سلام بچه ها
من تو نوشتن یه برنامه با ++C که بتونه مسئله water jug رو حل کنه دچار مشکل شدم .
برای جستجوی آگاهانه نمی دونم چه مکاشفه ای در نظر بگیرم.
به جز استفاده از روشهاي آگاهانه، آيا روشي به نظر شما مي رسه که بتونه اجراي برنامه رو بهتر کنه؟
ممنون میشم اگه کمک کنید.
-
-
اینجا
کد:
http://www.dave-reed.com/csc550.S02/HW/HW4.html
که تو تکلیف استاده پیشنهاد کرده که از این روش استفاده کنن و نتیجشو بدن!:
کد:
compare informed approaches using the following heuristic: take the sum of the differences in jug
contents in the current state versus the goals state, then negate it and divide by 2.
For example, suppose the contents of the large and small jugs in a given state are 4 and 1, respectively.
Assuming the goal state specifies 2 and 0, the differences in volumes in the large and small jugs
are |4-2| = 2 and |1-0| = 1, respectively.
Adding these two values and dividing by two yields the heuristic value -1.5.