Q-Learning in Artificial Intelligence
Definition: Q-learning is a model-free reinforcement learning algorithm that learns the optimal
action-value function to maximize cumulative reward.
Q-Learning Formula:
Q(s,a) = Q(s,a) + α [r + γ max Q(s',a') - Q(s,a)]
Algorithm Steps:
1. Initialize Q-table with zeros
2. Observe current state
3. Choose action using ε-greedy
4. Take action and receive reward
5. Update Q-value
6. Move to next state
7. Repeat until goal is reached
Flowchart:
Start
|
Initialize Q-table
|
Observe State (s)
|
Choose Action (ε-greedy)
|
Take Action → Reward → Next State
|
Update Q(s,a)
|
Goal reached?
| Yes → End
| No → Repeat