Abstract In this paper, we combine two main topics in mechanics and optimal control theory: contact Hamiltonian systems Pontryagin maximum principle. As an important result, among others, develop a principle that permits to deal with problems dissipation. We also consider the Herglotz problem, which is simultaneously generalization of variational problem. An application study thermodynamic syst...