Calculating Costs – Design of Computer Programs

Calculating Costs – Design of Computer Programs


Now, we got rid of the times in the successor function, so we’ve got to put them back in someplace. I’m going to generalize a little bit, and instead of talking about times, I’m going to talk about costs for a path. I’m just thinking of maybe we might want to do some other problems that also have paths in them and that aren’t dealing with optimizing time but are dealing with optimizing some type of cost. What I want you to for me is to define this function pathcost,which takes a path as input and returns the total cost of that path. That’s already stored away. We don’t have to compute anything new. Because we decided that our convention for paths was it was going to be stored there. That is, we said that a path is equal to a state followed by an action and a total cost followed by another state, etc. Here I’ve just said, well, if we don’t have any actions there or if it’s the empty path, then do one thing. Otherwise do something else. Then I also want you to find the bridge cost–bcost is the abbreviation I’ll use. That’s the cost of an individual action. An action in this domain is something like 2, 5, arrow to the right. I want you to figure out what’s the cost of that action.

Leave a Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © 2019 Geted Tabs Online. All rights reserved.