Optimization is to search for parameters that will achieve a specific desired effect such as minimizing loss. A manufacturing firm may want to minimize the cost of defect parts, or an airline company may want to maximize their ticket prices and therefore minimize any lost revenue possibilities.

And this specific desired effect can be measured by a loss function.