On a K-unstable toric variety we show the existence of an optimal destabilising convex function. We show that if this is piecewise
linear then it gives rise to a decomposition into semistable pieces analogous to the Harder-Narasimhan filtration of an unstable vector
bundle. We also show that if the Calabi flow exists for all time on a toric variety then it minimizes the Calabi functional.
In this case the infimum of the Calabi functional is given by the supremum of the normalized Futaki invariants over all destabilising
test-configurations, as predicted by a conjecture of Donaldson.