aimacode / aima-exercises

Exercises for the book Artificial Intelligence: A Modern Approach
Other
879 stars 530 forks source link

Solution for Ex 2 in '3-Solving-Problems-By-Searching' #911

Closed arjun-kshirsagar closed 1 month ago

arjun-kshirsagar commented 2 months ago

Problem Formulations for AIMA Problems

Issue: #853

This pull request introduces complete problem formulations for four specific problems described in the book "Artificial Intelligence: A Modern Approach". The formulations are designed to be precise enough for implementation.

Key Changes:

  1. Formulation for the Glass Boxes and Banana Problem:

    • State Representation: A tuple indicating the lock status of each box.
    • Actions: Unlock the next box if the current one is unlocked.
    • Goal: Unlock all boxes to reach the banana.
  2. Formulation for the Sequence Transformation Problem:

    • State Representation: A string composed of characters A, B, C, and E.
    • Actions: Apply transformations based on given rules (AC = E, AB = BC, BB = E, and E$x$ = $x$).
    • Goal: Transform the sequence into a single E.
  3. Formulation for the Grid Painting Problem:

    • State Representation: Current position on the grid and the painted/unpainted state of each square.
    • Actions: Paint the current square or move to an adjacent unpainted floor square.
    • Goal: Paint all non-pit squares.
  4. Formulation for the Container Ship Unloading Problem:

    • State Representation: A 3D grid representing the containers and the crane's position.
    • Actions: Move the crane, pick up a container, and unload it.
    • Goal: Empty the grid of containers.

Highlights:

Benefits:

Checklist:

Examples:

  1. Glass Boxes and Banana Problem:

    • Initial State: ('unlocked', 'locked', 'locked', 'locked', 'locked', 'locked')
    • Action: Unlock the next box.
    • Goal: Reach ('unlocked', 'unlocked', 'unlocked', 'unlocked', 'unlocked', 'unlocked').
  2. Sequence Transformation Problem:

    • Initial State: "ABABAECCEC"
    • Action: Apply transformation rule.
    • Goal: Reach the sequence "E".
  3. Grid Painting Problem:

    • Initial State: (Position, Grid)
    • Action: Paint or move.
    • Goal: All non-pit squares painted.
  4. Container Ship Unloading Problem:

    • Initial State: Full grid, crane at (0, 0).
    • Action: Pick up and unload containers.
    • Goal: Empty the grid.