Subscribe via Email

Monday, May 9, 2016

morris_AIMA [#5]: Vacuum World - Simple Reflex Agent

With much time and effort, the Vacuum World simulation for Russel and Norvig's Artificial Intelligence: A Modern Approach, is complete. Here is an outline/solution approach for question 2.8 of the books 3rd edition. I'll expand further into the follow up question in a future post. This post here is more so to briefly demo my software

Problem Statement 

Given a 2x1 tiled environment, implement a simple vacuum-cleaner agent that cleans a square if it is dirty and moves to the adjacent square if it is not.


  • The performance measure awards one point for each clean square at each time step, over a “lifetime” of 1000 time steps
  • The “geography” of the environment is known apriori but the dirt distribution and the initial location of the agent are not. 
  • Clean squares stay clean and sucking cleans the current square. 
  • The Left and Right actions move the agent left and right except  
when this would take the agent outside the environment, in which case the agent remains where it is.
  • The only available actions are Left,Right, and Suck
  • The agent correctly perceives its location and whether that location contains dirt

Implementation using Morris_AIMA Software

You will be prompted to select one of the possible 8 configurations for this world.
Upon making a selection the simulation will play. 

Example simulation #4, 1 vacuum and 2 dirt objects.
After the simulation is complete, the output will be written to simulation_results.txt

Given the simulation run using 1000 cycles, here are the results for each of the possible
8 initial configurations. (P.measure refers to the Performance Measure)

  • #1: Vacuum [0,0], Dirt: NONE   P.measure: 2000
  • #2: Vacuum [0,0], Dirt: [0,0] P.measure: 1999
  • #3: Vacuum [0,0], Dirt: [1,0] P.measure: 2000
  • #4: Vacuum [0,0], Dirt: {0,0] & [1,0]: P.measure: 1997
  • #5: Vacuum [1,0], Dirt: NONE: P.measure: 2000
  • #6: vacuum [1,0, Dirt [0,0]: P.measure = 1999
  • #7 Vacuum [1,0], dirt [1,0] P.measure: 1999
  • #8 Vacuum [1,0], Dirt [1,0] & [0,0] P.measure: 1997

Average performance: 1998.875

Try it Out Yourself!
You can get the project from github here
Make sure it's that specific version if you want to run the simulation as is. Upon doing updates to my project 
I can't promise I'll keep legacy code the same.

Future Updates
I plan on doing a followup to this simulation through the AIMA book, I'll publish those results once complete, along with my solution set for chapter 1 & 2.
Also note there are very few details in the simulation results summary, and they are 
kind of just thrown together. I plan on adding more elborate info both to that, and the
visualizer, when needed.
Keeping things only bare minimum to do the questions first, until more analysis is needed.

No comments:

Post a Comment

Please feel free to give feedback/criticism, or other suggestions! (be gentle)

Subscribe to Updates via Email