liveBook · Manning

Locally optimal solution

As explained in Grokking AI Algorithms, Second Edition

A local minimum is a point whose objective value is no greater than that of nearby points, without necessarily being the global minimum.

A locally optimal solution is the best solution within a particular area of the search space. It may still be worse than the global best solution found across the entire search space. section 1.9

Use the distinction to reason about optimization problems:

  • A nearby restaurant can be the best local choice without being the best restaurant in the country or world. section 1.9
  • Packing a car trunk illustrates how many valid arrangements can differ in quality while obeying space and weight constraints. section 1.9
  • Evolutionary algorithms help avoid local optima by exploring multiple areas simultaneously through a population of candidate solutions. section 4.2

Knapsack search

In a knapsack with a 9 kg capacity, selecting items 1, 3, and 7 weighs 9 kg and has value $14. Another combination may look attractive nearby, but the goal is to compare solutions across the wider search space rather than stop at the first good arrangement. section 4.2

Figure 4.4 A simple example Knapsack Problem
04_04

Visualizes the constrained knapsack setup, making the search space and competing candidate solutions easier to inspect. section 4.2

How Grokking AI Algorithms, Second Edition covers it

How deep it goes
Defines local and global bests with analogies but stops short of mathematical tests or search procedures.
Examples
Uses restaurant selection, luggage packing, and constrained knapsack combinations to illustrate local and global quality.
What it assumes
Assumes only an intuitive understanding of valid solutions, constraints, and comparing objective values.
What you can do after
Evaluate/understand why a good nearby solution may not be globally best and why populations can explore alternatives.
How it connects
Ties local optima to optimization problems, global best solutions, evolutionary algorithms, and the knapsack problem.

Also explained in

Compare how 9 books explain locally optimal solution →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking AI Algorithms, Second Edition. The section links point to the parts of the book it draws on.