Concepts / Greedy and Epsilon-Greedy Action Selection

Greedy and Epsilon-Greedy Action Selection

Heuristic search looks ahead from possible actions and uses backed-up rewards and estimated values to guide a choice.

  • Programming

Choosing with Incomplete Knowledge

An agent often must choose an action using estimates rather than complete knowledge of what will happen. It can inspect possible actions, consider the rewards and estimated future values associated with the resulting states, and compare the actions. The action with the greatest current estimated value is called the greedy action.

Greedy action selection uses current estimates to choose the action that appears best now. It is therefore an exploitation choice.

Comparing Estimated Actions

To identify a greedy action, compare the current estimated values of the available actions. The action with the greatest estimate is greedy. This comparison does not require the estimate to be perfect; it only describes which action currently appears best according to the agent's approximate knowledge.

comparehighestcompareAction Aestimate 4Action Bgreatest estimateAction Bestimate 7Action Cestimate 5
Given several estimated action values, which action is greedy and how does the comparison produce that choice?

Selecting the Current Greedy Action

An agent estimates three available actions as follows: Action A has an estimated value of 4, Action B has an estimated value of 7, and Action C has an estimated value of 5. Which action is greedy?

List the estimates: The current estimates are 4, 7, and 5 for Actions A, B, and C.

Compare the estimates: Action B has the greatest current estimated value.

Choose according to current knowledge: Choosing Action B is greedy because greedy action selection chooses the action with the greatest current estimated value.

Action B is the greedy action in this generated example.

Looking Ahead with Heuristic Search

Heuristic search applies the same general choice idea beyond a single immediate comparison. It begins with an approximate value function and looks ahead from each possible action to possible next states. During that look-ahead, it combines immediate rewards with estimated future values. The resulting backed-up values allow the agent to compare the candidate actions and select the most promising one.

considerconsiderleads toleads toback upback uphighercompareCurrent stateAction AFuture state Areward 4; estimate 6Backed-up value A10Selected actionAction AAction BFuture state Breward 5; estimate 3Backed-up value B8
How do possible actions lead to future states, and how are rewards backed up to compare the actions at the current state?

The numbers in the diagram are illustrative rather than a prescribed calculation rule. The important process is the one described by the source: inspect possible actions, look ahead to possible states, back up rewards and estimated values, and use the resulting values to compare the actions.

Temporary Search Results

Conventional heuristic search uses backed-up values to make the current choice. The search calculation can guide the agent toward the most promising action, but the backed-up values are used temporarily rather than being used to update the approximate value function. In this approach, the search result helps with the decision that is happening now.

guide decisionuse temporarilycontribute to improvementbecomes changed estimatesApproximate valuefunctioncurrent estimatesCurrent actionuse values nowBacked-up valuessearch resultsImproved valuefunctionfuture estimates changed
What happens to backed-up values after a decision when they are used only temporarily versus saved to improve future decisions?

Learning from Search

Search results can also be retained as information for later decisions. When the backed-up values contribute to improving the value function, later choices can use a changed approximate value function instead of relying only on the original estimates. This creates a distinction between calculating values for one decision and using those calculations to improve future decision-making.

choose nowretain informationHeuristic searchlook ahead and back upvaluesCurrent actionvalues used temporarilyChanged valuefunctionsupports later decisions
What changes between a search that uses backed-up values only for the current decision and a search that updates its value function for later decisions?
ApproachRole of backed-up valuesEffect on later decisions
Conventional heuristic searchUsed temporarily to choose the current actionThe approximate value function is not updated with them
Value function improvementCan contribute to improving the value functionLater decisions can use changed estimates

Exploitation and Exploration

Choosing the greedy action is exploitation: the agent uses its current knowledge to seek the best expected one-step reward. Choosing a nongreedy action is exploration: the agent chooses an action that is not currently estimated to be best in order to gather information that may improve later estimates.

use current estimateseek informationaims atmay improveCurrent decisionGreedy actionbest expected one-steprewardImmediate rewardexploitation focusNongreedy actiongather informationFuture rewardpossible improvement
Why can exploiting the best-known action maximize immediate reward while exploring another action produce better information and higher future reward?

The choice is a conflict because one action selection cannot serve both purposes at the same time. Selecting the greedy action uses current knowledge to pursue immediate reward. Selecting a nongreedy action instead creates an opportunity to learn more about that action. Exploration may sacrifice some short-term reward while improving knowledge that can support better choices when many future selections remain.

Reasoning Before Selection

  1. Identify the actions currently available.
  2. Use the current estimates to identify the action with the greatest estimated value.
  3. Recognize that this greatest-estimate action is greedy.
  4. Choose the greedy action when the immediate expected reward is the priority.
  5. Consider a nongreedy action when gathering information may improve later estimates and future choices.
  6. Remember that exploitation and exploration optimize different horizons: immediate reward versus possible long-term improvement.

Choosing Between Immediate Reward and Information

An agent has a current estimate that Action A is best. It can choose Action A, or choose a nongreedy Action B to gather information about B. How should the two choices be understood?

Evaluate exploitation: Choosing Action A uses the current estimate and aims at the best expected one-step reward.

Evaluate exploration: Choosing Action B does not follow the current greatest estimate, but it creates an opportunity to improve the estimate of B.

Consider the time horizon: If the immediate decision is the main concern, exploitation may be preferred. If many future selections remain, the information from exploration may support greater total reward later.

Recognize the trade-off: Neither choice is always better. The choices serve different purposes: exploitation uses current knowledge, while exploration improves knowledge.

The reasoning depends on whether the priority is immediate expected reward or information that may improve future decisions.

Common Selection Mistakes

  • Treating the greedy action as the action that is guaranteed to be best.

    A greedy action is defined by having the greatest current estimated value. The estimate is the agent's current knowledge, not a guarantee about the outcome.

    Fix: Say that the greedy action appears best according to the current estimates.

  • Calling every heuristic-search result a permanent improvement to the value function.

    Conventional heuristic search can use backed-up values temporarily without updating the approximate value function.

    Fix: Ask whether the backed-up values are being used only for the current choice or are being retained to improve future estimates.

  • Treating exploration as automatically better than exploitation.

    Exploration may reveal a better action, but it can sacrifice short-term reward. Exploitation and exploration serve different horizons.

    Fix: Describe exploitation as targeting immediate expected reward and exploration as gathering information that may improve later choices.

  • Describing greedy action selection and heuristic search as completely unrelated.

    Both use value information to compare possible actions. Heuristic search extends the idea by looking ahead to possible next states and backing up rewards and estimated values.

    Fix: Explain the shared comparison idea and then identify the broader look-ahead performed by heuristic search.

Practice the Trade-off

MEDIUM

An agent estimates Action A as better than Action B. Explain what the agent is doing if it chooses A, and explain what purpose it might serve if it chooses B instead. Then state what would happen to the interpretation if the backed-up values from a search were saved to improve later estimates.

Hints
  • The action with the greatest current estimated value is greedy.
  • Choosing the greedy action is exploitation; choosing a nongreedy action is exploration.
  • Temporary use supports the current decision, while retaining search results can support value-function improvement.
  1. Greedy action selection chooses the action with the greatest current estimated value. It is exploitation because it uses current knowledge to pursue the best expected one-step reward. A nongreedy choice is exploration because it gathers information that may improve later estimates. Heuristic search extends value-based action comparison by looking ahead to possible states and backing up rewards and estimated values. Those backed-up values may be used temporarily for one decision, or they may contribute to improving the value function so that future decisions use changed estimates.

Key Takeaways

  • A greedy action has the greatest current estimated value.
  • Exploitation uses current knowledge to target immediate expected reward.
  • Exploration chooses a nongreedy action to gather information that may improve future choices.
  • Heuristic search looks ahead, backs up rewards and estimated values, and compares candidate actions.
  • Backed-up values can guide only the current choice or contribute to improving the value function for later decisions.