Principles of optimalizing control systems and an application to the internal combusion engine