# Reinforcement Learning

By [kokain](https://paragraph.com/@kokain) · 2025-02-22

---

Reinforcement Learning (RL) is a type of machine learning where an **agent** learns to make **sequential decisions** by interacting with an environment. The agent takes actions, receives rewards (or penalties), and adjusts its strategy to maximize cumulative rewards over time.

It's inspired by how humans and animals learn through trial and error.

![Imagine earning $1 for every right decision and losing $1 for a wrong one, with survival depending on maximizing rewards. This is Reinforcement Learning, where challenges shape learning through rewards for success.](https://storage.googleapis.com/papyrus_images/4f68c5c00d236bee8c6db6ad85b52cdfe5bfc804a2e6cbbce64719da05e1e862.png)

Imagine earning $1 for every right decision and losing $1 for a wrong one, with survival depending on maximizing rewards. This is Reinforcement Learning, where challenges shape learning through rewards for success.

#### **Key Components of RL (Reinforcement Learning):**

1.  **Agent** – The learner or decision-maker.
    
2.  **Environment** – The world in which the agent operates.
    
3.  **State (S)** – A representation of the current situation.
    
4.  **Action (A)** – The choice an agent makes at a given state.
    
5.  **Reward (R)** – Feedback from the environment based on an action.
    
6.  **Policy (π)** – A strategy that defines the agent’s behavior.
    
7.  **Value Function (V)** – A measure of how good a state is.
    
8.  **Q-value (Q)** – A measure of how good an action is at a given state.
    

![](https://storage.googleapis.com/papyrus_images/7d10b9c8de7fad506cfe65e2952c9b1c3df586e72f653078b9f81d91876673b4.png)

Each time when the agent takes a action\*\*(A)\*\* and pass a Environment\*\*(E)\*\* successfully, The Environment chances with a new State\*\*(S)\*\* with Reward\*\*(R)\*\* assigned to the Agent for that correct action. **But what are these Policy, Value Function and Q-Value ?**

### \*\*Policy (\*\*π)

A **policy (π)** in Reinforcement Learning defines how an **agent** selects actions in a given **state** to maximize long-term rewards.

![Policy are set of rules which needs to be followed in a Environment by the Agents to receive the Reward for a correct action. ](https://storage.googleapis.com/papyrus_images/903ea17b7f1c5a7e72656470adf62e3cc9c59133ee3f8e68e4dacd9206526c7d.gif)

Policy are set of rules which needs to be followed in a Environment by the Agents to receive the Reward for a correct action.

#### **Types of Policies:**

**Deterministic Policy (π(s))** – Always selects the same action for a given state.

![](https://storage.googleapis.com/papyrus_images/c08afc0e2850ef72e9603dd9a4e048a0983691f4768195ac9e3ce13d973cf422.png)

**Stochastic Policy (π(a|s))** – Assigns probabilities to different actions for a given state.

![](https://storage.googleapis.com/papyrus_images/3ff6f80a70d59c7eb6440db931f181c58556ca431eb24ce6dc8e84a9596993bf.png)

#### **How it Works:**

*   A good policy helps an agent **navigate** the environment efficiently.
    
*   Reinforcement Learning algorithms **improve** policies over time to maximize rewards.
    

### **Value Function (V)**

The **Value Function (V)** represents the **expected long-term reward** an agent can get **from a given state** while following a policy π\\piπ.

![](https://storage.googleapis.com/papyrus_images/b6aacde69468eb94f4c873fa3d7f08b14e60bc189f9d8d584dd3c6a42c5662d1.png)

( V^**π**(s) ) = Expected total reward from state **s**, following policy ( **π** ).

( \\gamma ) = Discount factor (0 to 1) that prioritizes immediate vs. future rewards.

( R\_t ) = Reward at time step **t**.

### **Q-Value (Q)**

Q in RL stands for the **Q-value** (or **Action-Value Function**), which represents the **expected cumulative reward** the agent can get by taking a specific action **A** in a given state **S** and then following an optimal policy.

![Rewards are calculated each time the Agent is in a new Scenario.](https://storage.googleapis.com/papyrus_images/bb0c4083b693251462c205579ea1bdc9ee0c0d10f0157d235f2efb8dfee961ea.png)

Rewards are calculated each time the Agent is in a new Scenario.

![Reward distribution for each Situation.](https://storage.googleapis.com/papyrus_images/1714d7a394fa14c94b15ac47c0b4bc63803f585f57db1595a88c876775699b52.png)

Reward distribution for each Situation.

### **Conclusion**

Reinforcement Learning (RL) is a powerful framework where an agent learns through **trial and error**, optimizing its actions to maximize rewards. With Quantum computers, it will make the decision making Instant for Smart Application built on them.

---

*Originally published on [kokain](https://paragraph.com/@kokain/reinforcement-learning)*
