Stav dette: Optimal processes in irreversible thermodynamics and microeconomics