aimacode/aima-javascript

2-Intelligent-Agents

redblobgames opened this issue · 7 comments

Chapter 2 already has a visualization of an algorithm; what are the concepts that we can visualize? My first thoughts:

  1. Table driven agent: show a table of the percepts and the resulting action. Given the state of the world, show which table entries would be activated.
  2. Rule driven agent: show a sequence of rules and the resulting action. Given the state of the world, show which rules would be activated. Follow the action from the first matching rule.
  3. Model driven agent: show the internal model of the world also. I'm not sure if there's something meaningful with the vacuum cleaner agent though.

I don't know if these visualizations will be useful or interesting but I would like to try them and see.

From what I understand both 1 and 2 both are essentially Finite State Automatas. 3 would be similar to Getting in the shoes of a Search Agent from Chapter 3 or online search from later chapters.

My point is, perhaps we put this chapter on the backburner?

Chapter 2 is mostly about introducing the concepts independent of the problem being solved (search, planning, learning, etc.). I'm hoping there's some way to show these concepts with the vacuum cleaner example, but the example may be too simple for many of the concepts.

Other possible concepts to show:

  • the line between agents vs environments
  • sensors and percepts
  • actuators
  • partially observable vs fully observable state (but as you say, the "Getting in the shoes of a search agent" shows this)
  • success metrics (run the agent on a hundred different scenarios and calculate the metric, or run all the different rule sets for agents against scenarios to show which rules work best)
  • success metrics based on action vs result

I'm looking for a chapter where I can provide examples for future contributors of how to structure code for implementing different types of visualizations (e.g. animation, reader driven, rewindable, multiple-instance, comparisons, etc.). I picked chapter 2 because it has more general concepts and I was hoping there would be more possibilities for visualizations, using extensions of the vacuum cleaner example. Do you have suggestions of other chapters that would be more suitable for this goal?

I'm looking for a chapter where I can provide examples for future contributors

Ok that makes sense, nevermind me then.

I'm looking for a chapter where I can provide examples for future contributors

Ok that makes sense, nevermind me then.

Sorry about that! I should've explained the goal from the beginning. If chapter 2 turns out not to be a great fit then I may put these examples outside of any chapter just so that we have some templates/examples to work with. (That would also make it easier for me to provide one version with two.js, one version with d3.js, one version with processing, etc.)

Ch 2 turned out not to be a great fit :-( and I made some examples outside of AIMA to show how to write interactive diagrams (here)

I implemented some of the diagrams for ch 2 but the user interaction and animation sometimes interfere with each other.

  • If the user chooses an action for the agent but there is an animation already playing, we need to queue up the action. But if there is no animation playing, the action should run right away. I implemented this but am hoping there is a cleaner way.
  • If the user changes the world state (clicking on the floor to make it dirty) while there is an animation to clean the floor, what should happen? I attempted to make the floor dirty again.
  • If the user changes the world state while the agent has already displayed its percept, when should the percept update? Right now the agent only updates its percept when it's about to take an action but maybe it would be better to update at any time.
  • Right now the user can choose actions and the user can also change the world state. It would probably be cleaner if diagram 1 was the user choosing agent actions and the world state updating on its own, and diagram 2 was the user choosing the world state and the agent acting on its own.

Future work:

  • Is there a cleaner implementation that handles the user changing the world or agent at the same time as the animation is playing?
  • A diagram could demonstrate the concept of metrics to evaluate an agent, by showing a line chart with the current metric. It may be useful to compare several different metrics and show how a poorly chosen metric may lead to anomalous agent behavior.
  • A diagram could show many different agents acting on the same world state, and then we could show the metric for each. That would let the reader see how a system might evaluate multiple agents in order to decide which set of rules is best.

@redblobgames I'm not sure but it looks like that the status of this chapter should be "Partially completed" or "Mostly complete".

@nervgh Yes, you're right — I'll update it!