You are on page 1of 5

Problem 1: Rational Traffic Lights and Pedestrian Crossing

Task Environment Specification

PEAS Description Traffic Light System

Performance Measure Minimize traffic congestion for cars and waiting time for pedestrians

Environment Traffic intersections

Actuators Traffic lights

Sensors Cameras, vehicle detectors, pedestrian detectors, and timers

Task Environment Dynamic, continuous, multi-agent


Agent Function Specification

Percept Sequence Action

Current state of traffic and


Determine the appropriate time intervals for each traffic light phase
pedestrian flow

Switch the traffic lights to the appropriate phase (e.g. green for cars, red for
Timer
pedestrians) at the determined time interval

Camera and vehicle detectors Adjust the duration of each phase based on real-time traffic conditions

Give priority to pedestrian crossings when necessary, and ensure pedestrian


Pedestrian detectors
safety by providing adequate crossing time

Current and predicted traffic Optimize the overall flow of traffic by coordinating with neighboring traffic

patterns lights
Algorithm:

1. Initialize the traffic light system and set the initial phase (e.g. green for one
direction, red for the other).
2. Monitor real-time traffic conditions through cameras and vehicle detectors.
3. Adjust the duration of each phase based on the current traffic flow to minimize
congestion.
4. Use pedestrian detectors to give priority to pedestrians and ensure their safety by
providing adequate crossing time.
5. Predict future traffic patterns based on historical data and adjust the traffic light
cycle accordingly to optimize overall traffic flow.
6. Repeat steps 2-5 continuously for the duration of the traffic light system's
operation.
Problem 2 :

1. Apply the DFS, BFS and UCS and find out the order in which states are expanded and
provide the final path.

DFS : S->A->B->G

S->A->B->G

S->A->B->D

S->A->B

S->A

S->D

S
Stack
BFS : S->A->B->G

S->A

S->D

S->A->B

S->D->E

S->D->C

S->A->B->G

S->D->E->G

S->D->C->S
Queue

UCS : S->D->E->G with cost : 7

Path Cost

S 0

S->A 2

S->D 3

S->A->B 5

S->D->E 4

S->D->C 5

S->D->E->G 7
2. Which search algorithm will ensure the lowest cost?
UCS guarantees the lowest cost because it expands nodes in order of increasing path
cost.

3. Discuss each algorithm whether if it is complete and optimal and please justify your
answer.
DFS :
● It is completeness because in the end it gets me to the goal regardless of the
path, but it is not the perfect solution because it is not the lowest cost
BFS :
● It is completeness because in the end it gets me to the goal regardless of the
path, but it is not the perfect solution because it is not the lowest cost
UCS :
● is complete, as it is guaranteed to find a solution if one exists. In this graph, UCS
finds the optimal path S ->D ->E ->G, which has a total cost of 7.

Problem 3 :
Agent Position :
● Food count : 39 dots
● Gost Position : 39 pos
● Agent Facing :NSWE

P(x)2^39 X 39 X 39^2 X 4

You might also like