# [closed] Calculating cost for the Final Programming exercise

 1 I've seen the discussions about calculating cost for the programming exercise and I just realized something. If the start and goal cell have the same value then you can use either of two predominant methods with the same result. Imagine a very simple road: [20, 20]. If I move forward (to the goal) and then count the cost of the cell I arrive at I get 1/20. If I count the cost of the cell I'm in (start cell) and then move forward to the goal I get a cost of 1/20 too. In one case I ignore the cost of the start cell and in the other I ignore the cost of the goal cell. Longer paths will simply add cells in the middle for both methods. Likewise lane change costs will be the same for either method. Since the start and goal costs are the same for all of our test cases either method will give the same result. asked 08 Apr '12, 11:00 MCN 4.1k●10●35●81 accept rate: 40%

### The question has been closed for the following reason "Covered in other treads" by MCN 10 Apr '12, 13:11

One Answer:
 0 Yes, although one method suggests (to me at least) that you have to magically teleport out of the init cell rather than traversing it, whereas the other merely suggests that you stop when you reach the goal. But I suppose it could be argued if finishing means you're anywhere in the goal, starting could also mean you're anywhere in the init cell - which suggests either method is logically sound - as are methods where you include both scores or leave them both out. Certainly the way Prof Thrun implemented the algorithms he had something like if (x,y = goal cell): #we're done else: #whatever else  Suggesting that the goal cell wouldn't contribute to the score. But, other possible implementations (using cell cost = 1/r + min(...) for example) will probably do the reverse. As I said in another comment - it doesn't really matter, there's no absolute truth here, it's implementation dependant what you do. Plus, these are the 2 cells that have to form part of any path between them and so it doesn't really matter what their cost is. All paths between init and goal will include them and therefore the optimum path is unaffected by their contribution to the cost (or lack of it) - I'm pretty sure that logic is sound? answered 08 Apr '12, 11:37 Michael F 6.6k●7●30●68 The start and goals costs don't matter if you're only concerned with the optimal path but they do contribute to the final optimal cost (as required in the programming assignment). I discovered this peculiarity because people were talking about using the magic teleport method and it didn't make sense to me. I had used the stop-at-goal method but got the same results so I tried to figure out why. (08 Apr '12, 12:04) MCN

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• link:[text](http://url.com/ "Title")
• image?![alt text](/path/img.jpg "Title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

### Tags:

×5,188
×87
×19
×7

Asked: 08 Apr '12, 11:00

Seen: 304 times

Last updated: 10 Apr '12, 13:11