A variational method for optimal staging.