transform (Statei, State2,Plan) - transform(State1, State2, ). Thus, if your program is given the input amount as 75 cents and the limit on the maximum number of coins you can use as 6 (A = 75, M = 6), then some of the possible solutions are: 3 quarters 2 quarters, 2 dimes and 1 nickel 2 quarters, 1 dime and 3 nickels Thus, calculate/3 takes 2 inputs (A and M) and produces one output, a four element list that tells us how many each of pennies, nickels, dimes and quarters were used to make up the amount A such that the total number of coins used is less than M.ΔΆ68 Chapter 14 transform(State 1, State2,Plan) - Plan is a plan of actions to transform Statel into State2. Write a predicate (in Prolog) called calculate/3 that will tell you how many of each type of coins should you pick to make up a given amount, A, given a restriction on the maximum number, M, of coins you can use. Assume that the supply of these coins in each bin is unlimited. Suppose you have 4 bins each containing pennies, nickels, dimes and quarters. Rewrite the block's world program in the textbook incorporating this additional constraint on weights of blocks stated above. However, if, say, X weighs 7.5 ounces, and Y weighs 4 ounces, then X cannot be placed on top of Y (Y can be placed on top of X though). For example, if X weighs 6 ounces and Y weighs 4 ounces, then block X can be placed on top of block Y. Suppose we have the constraint that a block X cannot be placed on top of another block Y if the weight of X exceeds that of Y by 3 ounces or more. %weight of block a is 2.2 ounces weight(b, 6.1). This weight information is given as a set of facts, e.g., weight(a, 2.2). Suppose we are also given the weight of each block. Transcribed image text: Consider the block's world problem in HW#3 (problem is described in Section 14.2 (page 267] of the The Art of Prolog book]).
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |