Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

p. 16 — filling the knapsack with the largest positive utilities solves the unit-weight knapsack problem (9)

Proved
ConstrNestedLogit.Card.greedy_solves_9

by mikedeng1 · Oct 7, 2026 · Mathlib 0df444a (Lean v4.33.1)

assortment-optimizationgreedyknapsackp2o-batch-pfp2ap2o-gran-per-chapterp2o-plan-paperp2o-v1

Fix a nest iii, a cardinality limit ci∈Nc_i \in \mathbb{N}ci​∈N and u∈Ru \in \mathbb{R}u∈R, and write fij(u)=vij(rij−u)f_{ij}(u) = v_{ij}(r_{ij}-u)fij​(u)=vij​(rij​−u) for the utility of product jjj. Let S⊆NS \subseteq NS⊆N satisfy

  1. ∣S∣≤ci|S| \le c_i∣S∣≤ci​;
  2. fij(u)>0f_{ij}(u) > 0fij​(u)>0 for every j∈Sj \in Sj∈S;
  3. fik(u)≤fij(u)f_{ik}(u) \le f_{ij}(u)fik​(u)≤fij​(u) for every j∈Sj \in Sj∈S and every k∉Sk \notin Sk∈/S;
  4. if ∣S∣<ci|S| < c_i∣S∣<ci​, then fik(u)≤0f_{ik}(u) \le 0fik​(u)≤0 for every k∉Sk \notin Sk∈/S.

These are the sets produced by ordering the products by utility and filling the knapsack from the largest utility as long as the utility is positive. Then SSS is an optimal solution of problem (9):

∑j∈Sfij(u)=max⁡{∑j∈Nvij(rij−u) xij:∑j∈Nxij≤ci, xij∈{0,1} ∀j∈N}.\sum_{j \in S} f_{ij}(u) = \max\Bigl\{ \sum_{j\in N} v_{ij}(r_{ij}-u)\,x_{ij} : \sum_{j\in N} x_{ij} \le c_i,\ x_{ij}\in\{0,1\}\ \forall j \in N \Bigr\}.j∈S∑​fij​(u)=max{j∈N∑​vij​(rij​−u)xij​:j∈N∑​xij​≤ci​, xij​∈{0,1} ∀j∈N}.

The result shows that an optimal solution of (9) is read off from the ordering and the signs of the utilities.

Formalization Note The 0/1 vector xix_ixi​ is the indicator of a Finset (Fin n). Ties among utilities are allowed; any tie-breaking of the greedy order gives an optimal set.

Preamble
import Mathlib
import Definitions.Def_NestedLogitVariants_LP_Model
import Definitions.Def_ConstrNestedLogit_Card_Knapsack

open NestedLogitVariants.LP
Formal statement
namespace ConstrNestedLogit.Card

/-- Greedy solves the knapsack problem (9) (p. 16): a set `S` with `|S| ≤ c_i` whose products all
have positive utility `f_ij(u) > 0`, such that no product outside `S` has larger utility than a
product in `S`, and such that, if `|S| < c_i`, every product outside `S` has utility `≤ 0`,
is an optimal solution of (9) at `u`. -/
theorem greedy_solves_9 {ι : Type*} {n : ℕ} (I : Instance ι n) (c : ι → ℕ) (i : ι) (u : ℝ)
    (S : Finset (Fin n)) (hcard : S.card ≤ c i)
    (hpos : ∀ j ∈ S, 0 < utility I i j u)
    (horder : ∀ j ∈ S, ∀ k ∉ S, utility I i k u ≤ utility I i j u)
    (hrest : S.card < c i → ∀ k ∉ S, utility I i k u ≤ 0) :
    IsKnapsackOptimal I c i u S := by sorry

end ConstrNestedLogit.Card
Source
Gallego & Topaloglu, Constrained Assortment Optimization for the Nested Logit Model, Management Science (2014), DOI 10.1287/mnsc.2014.1931; authors' manuscript of Sept. 11, 2013, p. 16, discussion of problem (9)
Human review
  • Endorsed by Shuze Chen · Oct 8, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 8, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me