Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

The stochastic transportation problem (4.163)–(4.165)

Definition
ShorNonsmooth_Decomposition_StochasticTransport

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

p2o-batch-b23ap2o-gran-per-chapterp2o-plan-bookp2o-v1stochastic-programmingtransportation-problem

There are mmm plants and nnn building sites. Plant iii produces aia_iai​, the unit transportation cost from plant iii to site jjj is cijc_{ij}cij​, the demand of site jjj is a random variable ξj\xi_jξj​ with probability density pjp_jpj​, and rjr_jrj​ is the penalty per unit of unsatisfied demand at site jjj. For t+=max⁡{0,t}t^+ = \max\{0,t\}t+=max{0,t}:

  1. ppp is a probability density if p≥0p \ge 0p≥0, ppp is Lebesgue integrable and ∫p(z) dz=1\int p(z)\,dz = 1∫p(z)dz=1;
  2. the expected shortage of a demand with density ppp at supply level ttt is E(ξ−t)+=∫(z−t)+p(z) dzE(\xi - t)^+ = \int (z-t)^+ p(z)\,dzE(ξ−t)+=∫(z−t)+p(z)dz;
  3. the objective of the problem is
∑i,j=1m,ncijxij+∑j=1nrj E(ξj−∑i=1mxij)+;(4.163)\sum_{i,j=1}^{m,n} c_{ij} x_{ij} + \sum_{j=1}^n r_j\, E\Big(\xi_j - \sum_{i=1}^m x_{ij}\Big)^+ ; \qquad (4.163)i,j=1∑m,n​cij​xij​+j=1∑n​rj​E(ξj​−i=1∑m​xij​)+;(4.163)
  1. the feasible set is ∑j=1nxij≤ai\sum_{j=1}^n x_{ij} \le a_i∑j=1n​xij​≤ai​ for i=1,…,mi = 1,\dots,mi=1,…,m (4.164) and xij≥0x_{ij} \ge 0xij​≥0 (4.165).

The problem minimizes transportation costs plus expected losses from deficits in supply; it is a two-stage stochastic program.

Formalization Note A shipment plan is a function Fin m → Fin n → ℝ. The expectation is written through the density as a Bochner integral; it equals the book's expectation when z p(z)z\,p(z)zp(z) is integrable, which the theorem assumes.

Definition code
import Mathlib

namespace ShorNonsmooth.Decomposition

open MeasureTheory

/-! Shor (1985), §4.6, subsection 4 "The Stochastic Transportation Problem", pp. 131–132:
`m` plants, `n` building sites, shipments `x i j`, costs `c i j`, capacities `a i`, penalties `r j`,
and random demands `ξ_j` with probability densities `p_j`. -/

/-- `p` is a **probability density function** on `ℝ`: nonnegative, Lebesgue integrable, total mass 1. -/
def IsDensity (p : ℝ → ℝ) : Prop :=
  (∀ z, 0 ≤ p z) ∧ Integrable p ∧ ∫ z, p z = 1

/-- p. 132: the **expected shortage** `E(ξ − t)⁺ = ∫ (z − t)⁺ p(z) dz` of a random variable `ξ` with
density `p`, where `t⁺ = max{0, t}`. -/
noncomputable def expectedShortage (p : ℝ → ℝ) (t : ℝ) : ℝ :=
  ∫ z, max (z - t) 0 * p z

/-- p. 131, (4.163): the objective
`Σ_{i,j} c_ij x_ij + Σ_j r_j E(ξ_j − Σ_i x_ij)⁺` of the stochastic transportation problem. -/
noncomputable def stochTransportObjective {m n : ℕ} (c : Fin m → Fin n → ℝ) (r : Fin n → ℝ)
    (p : Fin n → ℝ → ℝ) (x : Fin m → Fin n → ℝ) : ℝ :=
  ∑ i, ∑ j, c i j * x i j + ∑ j, r j * expectedShortage (p j) (∑ i, x i j)

/-- p. 132, (4.164)–(4.165): the feasible set `Σ_j x_ij ≤ a_i` for every plant `i`, `x_ij ≥ 0`. -/
def stochTransportFeasible {m n : ℕ} (a : Fin m → ℝ) : Set (Fin m → Fin n → ℝ) :=
  {x | (∀ i, ∑ j, x i j ≤ a i) ∧ ∀ i j, 0 ≤ x i j}

end ShorNonsmooth.Decomposition
Source
Shor, Minimization Methods for Non-Differentiable Functions, Springer 1985, pp. 131–132, formulas (4.163)–(4.165)

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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me