Question

What is the difference between a cost function and a constraint? Mention an example of each to make your explanation more clear.

Fig: 1