Skip to content

Add Smart Traffic Light AI agents (Group 1 assignment)#66

Draft
MrCoolGh with Copilot wants to merge 2 commits into
mainfrom
copilot/implement-agents-smart-traffic-light
Draft

Add Smart Traffic Light AI agents (Group 1 assignment)#66
MrCoolGh with Copilot wants to merge 2 commits into
mainfrom
copilot/implement-agents-smart-traffic-light

Conversation

Copilot AI commented Mar 10, 2026

Copy link
Copy Markdown

Implements all four required intelligent agent types for the Smart Traffic Light environment in SWI-Prolog, plus a self-contained interactive HTML demo for presentation.

Prolog agents (agents/)

  • simple_reflex_agent.pl — pure condition-action rules; no state. Priority order: emergency override → pedestrian signal → set_green(Dir) when vehicles present → set_red.
  • model_based_agent.pl — tracks current_green/1, phase_timer/1, wait_count/2 via dynamic facts. Enforces min (10) / max (30) green phase durations; switches to most-congested waiting direction.
  • goal_based_agent.pl — goal: no direction waits > 20 steps. Builds a sorted action plan each cycle, promoting directions near threshold to the front.
  • utility_based_agent.pl — scores every candidate action and picks the max:
% Named weight constants make tuning explicit
weight_throughput(3).  weight_fairness(2).
weight_emergency(100). weight_pedestrian(50).  weight_phase_change(-5).

compute_utility(Percepts, set_green(Dir), Utility) :-
    % throughput + fairness (wait time) + emergency bonus + phase-change penalty
    Utility is Wt*Count + Wf*WaitTime + Emg + PhaseCost.

Interactive demo (agents/smart_traffic_light_agents.html)

Single-file HTML+JS that mirrors the Prolog logic in the browser: tabbed UI per agent, live percept sliders, intersection visualiser with signal colours, utility bar chart, and a Prolog code reference tab. No build step — open directly in a browser.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel

vercel Bot commented Mar 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
matchars-car-rental Ready Ready Preview, Comment Mar 10, 2026 10:31pm

…tive HTML demo

Co-authored-by: MrCoolGh <159566068+MrCoolGh@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement four types of intelligent agents for smart traffic light Add Smart Traffic Light AI agents (Group 1 assignment) Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants