Choose the feasible subset with maximum value. This is a small deterministic example, not solver engineering.

Example

Choose the feasible subset with maximum value. Among the packings that fit within the weight limit, the winner is the one whose items sum to the greatest total value. Because every candidate here already respects the capacity, the decision reduces to a straight comparison of totals, and the highest is the optimal knapsack for this instance.

highlighted = computed this step

Step 1 — Best value

Compute the highlighted combinatorics value.

best value18\begin{array}{c|c}\text{best value}&\hlmath{\text{18}}\end{array}

Step 2 — Best subset

Compute the highlighted combinatorics value.

chosen subset(A, D)\begin{array}{c|c}\text{chosen subset}&\hlmath{\text{(A, D)}}\end{array}

Step 3 — Verdict

Compute the highlighted combinatorics value.

verdictbest feasible subset\begin{array}{c|c}\text{verdict}&\hlmath{\text{best feasible subset}}\end{array}
combinatorics-search Every row is intentionally ordered and pinned to the lesson specification.