Consider a physics problem, where one has to find such a configuration of a system that minimizes its energy while keeping entropy positive (or at least nonnegative).
If you consider this problem from the optimization point of view, which physical function will be an objective function? Which one will be a suitable constraint?