English subtitles

← 04-12 Bridge Successors Solution

dummy description

Get Embed Code
1 Language


Showing Revision 1 created 05/06/2012 by Amara Bot.

  1. Here's my solution.
  2. I've got to say that my solution came out a little bit more complicated than I expected it to.
  3. I think maybe I made a bad choice for the representation.
  4. I threw in the flashlight along with the set of people,
  5. because I figured you want one set to represent everything that's on one side.
  6. But I'm think now after this came out the way that it did
  7. that maybe I should have had the flashlight be a separate part of the state.
  8. In other words, have the state be a 4-tuple, not of things that are here or there
  9. but of people that are here or there, then the time,
  10. and then a fourth element being the flashlight saying where is the flashlight.
  11. That could either be true or false, saying it is it here,
  12. or it could be a character string, saying it's there or here,
  13. or it could be a integer--0 or 1.
  14. I think it might've been easier if I'd chosen one of those representations.
  15. But it didn't bother me enough to go back and make a change.
  16. If you want to, you could spend time refractoring and change that.
  17. I'm going to just push ahead. Here's what I did.
  18. I said if the light is here, then let's look at all the people in here.
  19. We'll look at all the pairs of people--A and B.
  20. To make sure that they're people, I have to say that they're not the light.
  21. For all pairs of people A and B,
  22. we can generate a successor state,
  23. which is the set of people that were here
  24. minus the two people and the light, because the light is going to move from here to there.
  25. The second part of the successor state is everything
  26. that was already over on the other side on there
  27. unioned with the things that are coming over,
  28. which are people A and B and the light.
  29. Then the time is the time plus the maximum time that it took for A and B to get over.
  30. Then I know it says in the specification here that the action is represented just by an arrow.
  31. If I want to get the problem right I would do that, but then I decided
  32. later on that maybe the action should be more than just the arrow.
  33. Maybe the action should also tell who went across.
  34. I have the option of doing thing.
  35. If I want to just solve the problem the way it was specified
  36. then I would return just the arrow to represent the action,
  37. and I would do the same thing over here.
  38. One subtlety of this that worked out well in my favor--
  39. it's a little bit messy dealing with frozen sets.
  40. I don't like the idea of that the name is so long,
  41. but I didn't have to consider separately the idea of one person going across
  42. and two persons going across.
  43. Because we were dealing with sets, the set of people a, b when a is equal to b is equal to 1 person.
  44. I get the 1 person crossing for free. That's one nice thing about my representation.
  45. But notice that everything is in flux here.
  46. I'm trying to choose a good representation.
  47. I'm changing my mind as I go along.
  48. Should the actions be represented by a single arrow or should they be
  49. represented by an arrow along with the names of the people that are going?
  50. That's all up in flux.
  51. I should say that that type of flux is okay as long as it remains contained.
  52. If you have uncertainties that are going to cross barriers
  53. between lots of different functions, then probably you want to nail them down.
  54. If you think that they're contained, then it's okay to have some uncertainty
  55. and be able to explore the exact options later.