Pātuhitia tēnei: Optimal processes in irreversible thermodynamics and microeconomics