A closure for shocks involving the mixing of the fluids in two-layer stratified flows is proposed. The closure maximizes the rate of mixing, treating the dynamical hydraulic equations and entropy conditions as constraints. This closure may also be viewed as yielding an upper bound on the mixing rate by internal shocks. It is shown that the maximal mixing rate is accomplished by a shock moving at the fastest allowable speed against the upstream flow. Depending on whether the active constraint limiting this speed is the Lax entropy condition or the positive dissipation of energy, we distinguish precisely between internal hydraulic jumps and bores. Maximizing entrainment is shown to be equivalent to maximizing a suitable entropy associated to mixing. By using the latter, one can describe the flow globally by an optimization procedure, without treating the shocks separately. A general mathematical framework is formulated that can be applied whenever an insufficient number of conservation laws is supplemented by a maximization principle.