Optimization uses an objective function to evaluate a schedule (that is, the dates or sequence and resource assignment of operations and activities).
The objective function is the sum of differently weighted times and costs that are especially critical for planning. During optimization, the system tries to reduce the value of the objective function, that is, find a schedule in which the different times and costs – based on their weighting – are as small as possible.

This example shows the following:
The top chart (1) shows the order status after the production planning run. The setup times are not optimized and accumulate again each time due to a product change on a resource.
The middle chart (2) shows the result with the optimized setup times.
The third chart (3) shows a curve of the effects of adherence to deadlines against setup times between the two previous schedule examples.

When optimizing orders / operations, even "more minor" scheduling problems are complex.
Optimization Algorithm for Detailed Scheduling
To get a good solution within a limited processing time, algorithms are needed that reduce the complexity of scheduling problems. How suitable an optimization algorithm is in finding a good solution, depends on the scheduling problem.
The following optimization algorithm is used for the detailed scheduling optimization:
Genetic Algorithm: This procedure is suitable for planning problems for which the planner can find a feasible solution, but not a good solution. A typical use for this algorithm is to establish an optimal sequence based on the setup of operations.
Note
There used to be support in the DS optimizer for an algorithm called Constraint Propagation. This has however been discontinued by SAP.The optimization algorithm and weighting of optimization criteria you use to obtain good solutions is dependent on the scheduling situation and the company goals. You decide on the quality of the solutions by setting the processing time for the optimization. The rules of thumb are as follows:
The more time you have, the better the solution will be.
The more extensive and complex the problem is, the more time you require.