Balancing different optimization goals
Introduction
Planning problems often involve multiple optimization goals. In real-world scenarios, there is not a single "best plan". Instead, optimization must balance different objectives, requiring a normalizing function to weigh the goals against each other.
This challenge is well illustrated in employee rostering, where multiple goals must be optimized simultaneously:
-
Increasing shift coverage (ensuring all necessary shifts are filled)
-
Reducing employee costs (minimizing expenses by avoiding overtime)
-
Maximizing employee satisfaction (ensuring the fair distribution of shifts)
In Timefold models, each of these goals is implemented through one or more constraints. Some constraints naturally optimize for multiple goals — such as matching the preferred skills of employees with tasks, which can enhance both service quality and employee satisfaction. Others might work adversarially — reducing employee costs might lead to more stringent scheduling, negatively impacting employee satisfaction.
In this article we will explain how you can use Timefold to align multiple optimization goals with your business goals, and how to do “goal alignment”.
Measuring the impact of a single optimization goal
Timefold plans include output metrics that reflect the real-world impact of different optimization goals. If minimizing overtime is an objective, the system will track “total overtime hours”. When comparing different plans in the Timefold Platform, these metrics provide transparency into how well each plan aligns with the optimization goal.
Multi-objective optimization and the need for a normalizing function
Multi-objective optimization (or Pareto optimization) involves balancing trade-offs between competing goals. There is no single “best plan”, only different trade-offs depending on business priorities. A plan that is better in each of the aspects is always better then a previously found plan, but more often than not what might be better in one aspect, might be worse in another aspect. To compare plans, a weighted function translates multiple optimization goals into a common scale.
In Timefold, the scoring function serves as this normalizing function. It evaluates each plan based on:
-
Hard constraints (must always be satisfied, e.g., legal shift limits) and the sum of their scores.
-
Medium constraints (try to plan as many shifts as possible, even with limited resources) and the sum of their scores.
-
Soft constraints (nice-to-have preferences, e.g., minimizing travel distance) and the sum of their scores.
Learn more about constraints.
Each constraint contributes to the final score of a plan. A constraint minimizing the travel distance will take into account the total distance required to execute a plan, a constraint minimizing the amount of overtime could use both the total minutes of overtime required to execute a plan and the number of affected employees with overtime. Other constraints might be even more complex and take multiple non-linear approaches. As such, the scoring function will sum different units (e.g. kilometers, minutes, affected employees) to come to a final score. But how does one balance an extra kilometer driven to an extra minute of overtime? Only you as a business know.
In the Timefold Platform, the score graph shows you the evolution of the hard/medium/soft scores, and the score analysis shows you the impact of each constraint on those scores.
Timefold implements its constraints so that multiple optimization goals are balanced as much as possible by default. But of course, every business, and every business case is different, so what we see as good defaults might not be the best defaults for your business.
Read on to understand how our features help with this.
Customizing constraint importance via Configuration Profiles
To allow customization, Timefold supports giving each soft constraint a different weight via Configuration Profiles. By default, all constraints have an equal weight (1), but users can adjust this:
-
Increasing a constraint’s weight to 2 doubles its impact on the plan.
-
Setting a constraint’s weight to 0 will remove its impact on the plan, and remove the corresponding optimization goal.
-
The relative weight is what matters; scaling all weights up or down proportionally has no effect.
For example, if reducing overtime is more important than minimizing travel distance, users can increase the weight of the “minimize overtime” constraint while leaving “minimize travel distance” unchanged. Timefold will then prioritize plans that better align with this preference.
Read more on how to change configuration parameters.
Doubling the importance of the “minimize overtime” constraint, will not result in the amount of overtime being halved. Multi-objective optimization is a complex interplay of different trade-offs, and it’s guaranteed to not be a zero-sum game. So it’s hard to predict the absolute impact on an output metric when changing a related constraint weight. |
By running similar datasets with different constraint weights, plans will be different. By analyzing the metrics across these different plans, users can make informed decisions about which plan best meets their needs.
Practical approach to balancing optimization goals
If you’re interested in balancing the different optimization goals differently, we recommend taking the following approach in the Timefold Platform:
-
Identify the most important metric that needs improvement. Review the output metrics of your current plan and determine which aspect — such as overtime, shift coverage, or employee satisfaction metric — is not meeting expectations.
-
Find the constraints influencing that metric. Examine which constraints contribute most to the undesired metric outcome. For example, if overtime is too high, soft constraints that minimize overtime should be considered.
-
Adjust constraint weights in a Configuration Profile. Modify the weights of relevant constraints. Increasing the weight of a constraint will make it a stronger influencing factor in the plan. Save the combination of weights as a new Configuration Profile.
-
Rerun some datasets with the updated Configuration Profile. Click “re-run” on some of your (representative) datasets, and pick the new Configuration Profile. This will create a new optimized plan using the adjusted constraint weights.
-
Compare the new output metrics to see if the changes led to better results. First, check if the target metric has improved. Then, analyze whether there are any unintended consequences — did another important metric deteriorate significantly? Optimization is a balancing act, and improving one goal might negatively impact another.
-
Continue refining the balance. If the changes bring the plan closer to the desired outcome, but another important metric is now suboptimal, the next step is to refine the second most important metric.
This process of gradual adjustment — running multiple experiments, tweaking constraint weights, and analyzing the trade-offs — is what we call goal alignment.
Why not a cost-based approach?
What if we could just assign a dollar value to each time a constraint is broken? While the cost of an extra kilometer might be easy to express in a currency, the impact on employee satisfaction of that extra kilometer is already harder to quantify. We’re convinced that trying to express every optimization goal in a currency will not greatly improve the experience. Not only because certain constraints (like fairness or employee well-being) are very hard to quantify in monetary terms, but because to do this you need to again define values before seeing their impact, resulting in a process that would still require iterative adjustments, not unlike constraint weighting today. Expressing each constraint in a currency is actually a very similar exercise to figuring out the constraint weights.
What’s next? More intuitive Goal Alignment
While today, tuning optimization goals is a manual and iterative process, we are working on making this easier with:
-
Better comparison of multiple runs, making the impact of different weights clearer via an intuitive Comparison UI.
-
Faster and better goal alignment experiments, allowing users to test configurations on representative datasets instead of full-scale ones, reducing the risk for overfitting, and minimizing the time to get an impact report.
-
Automated hypertuning of constraint weights, where users specify target values for their most important metrics, and Timefold optimizes weights accordingly.
With these improvements, which we plan to tackle in the order above, we think we can gradually make the finetuning process smarter and easier.
Conclusion
Timefold helps businesses navigate the complexity of multi-objective optimization in planning problems. By providing balanced scoring functions and configurable constraint weights, we empower users to find plans that best align with their unique goals — balancing efficiency, cost, and employee satisfaction in a way that fits their needs. By offering a UI that helps to compare the metrics of different plans, you can make more informed decisions.