Nonsmooth mechanics and convex optimization. (©2011)