There are many methods to account the constraints violations in solving economic dispatch problems and similar ones. The best one based on my work is the Self-Adaptive Penalty functions. In such methods, no need for assuming weight factors or parameters during optimization process.
Considering penalty factor is a modelling issue of optimization problem. It can be applied in solving any type of optimization problem if there is some constraint violations.
You may find how objection function is penalized in the following two articles shared on RG.