January 17, 2020

Constrained Optimization: How to Do More with Less

Chang Liu

Artificial Intelligence, Constrained Optimization

Many rolled metal sheets.

What is Constrained Optimization?

Constrained optimization is a field of study in applied mathematics. You can use the tools it provides wherever you need to allocate scarce resources efficiently in complex, dynamic and uncertain situations. Think of it as the mathematical solution to the question: how do you do more with less?

For instance, have you ever wondered how you would make the best product recommendation to an individual customer? You might have 10,000 products and 10,000 customers. On top of that, each customer has their own preferences and you have limited inventory for each product. This is the type of problem where constrained optimization shines.

In these types of problems, there are three components:

  1. Variables: which product gets recommended to which customer?
  2. Constraints: each customer has their own preferences and each product has limited inventory.
  3. An objective: how to maximize total customer satisfaction.

Depending on the variables, constraints and objectives, there are different methods, with commercial and open-source solutions available for each. They’re often categorized under linear programming (LP), quadratic programming (QP), mixed integer programming (MIP), constraint programming (CP) and others.

Constrained Optimization vs. Machine Learning

Constrained optimization is not machine learning. Here’s how the two differ:

  • Constrained optimization helps with making decisions while machine learning helps with making inferences
  • Constrained optimization does not learn from data
  • Constrained optimization does not depend on the amount of data, but on the availability of information

How Constrained Optimization Helps in a SaaS Company

Everyone knows the value of data and how, with machine learning, you can augment the user experience with relevant insights. However, making decisions using those insights requires a lot of effort and the decision taken is often not the best one.

For example, in sports analytics, there are tons of stats around games and players. You can track so many different attributes for each player. However, even with this data, it’s hard to say for sure what the best line-up is to play against a particular opposition, what the best player to sign would be, given a specific budget, what contract termination fees to agree to, what new location to move a team to, how to deal with player tiffs, etc.

In this scenario, constrained optimization would help to turn these decisions into mathematical programs and provide provable optimal solutions. For example, the output of the problems above would be: given the resources at hand, this is likely the best team; this is the best player to sign with that budget, etc.

As you can see, constrained optimization is a powerful tool that allows companies to automate and optimize many business decisions. Let’s take a look at some use cases and how constrained optimization can impact SaaS metrics.

Increase in Gross Margin


Constrained optimization can help to automate decision making. Take, for example, a security center. Security alerts come through the door all day long, and a handful of security analysts must prioritize the organization’s response to each one. You could use constrained optimization in this scenario to assign alerts more efficiently, minimizing the queue and maximizing the efficiency of the entire support center.

Another similar example is matching sales leads to sales reps. For instance, software companies may generate leads through their marketing campaigns. Often, they are handled manually. However, if there are thousands of leads coming in every day with hundreds of reps, efficiently assigning leads is very difficult. Under first come first serve, leads fall through the cracks. This could happen if a lead does not align with a rep’s objectives or if an individual rep is underwater with existing leads. With constrained optimization, you can find the optimal solution, giving better results and leading to more closed deals.

Operating Spend Efficiency

Expense Reduction

Large corporations have saved millions of dollars by investing in these techniques to help drive more efficient use of resources. It has helped to optimize problems such as:

  • How to reach more targeted users within a specific budget
  • How to automate marketing expense allocations

If you are a SaaS business in asset maintenance, supply chain or healthcare, these opportunities to apply constrained optimization are particularly relevant.

A famous example of using constrained optimization to increase operating spend efficiency is the cutting-stock problem. The idea is to find ways to cut large pieces of stock material such as paper rolls or sheet metal into specific smaller irregular pieces while minimizing the material wasted. The solution minimizes the waste of raw materials and, in turn, lowers operating expenses.

Increase in User Retention

Churn Reduction

Recommender systems are a great tool to drive user behavior. But it’s important to create a tool that makes unbiased recommendations to meet everyone’s objectives. For instance, you might want to put limits on the items that are recommended to achieve this. Again, constrained optimization can help.

Uber Eats is a good example. There are three sides to the marketplace – restaurants, customers, and drivers. Each of these parties has different objectives. The Uber team modeled this problem as a quadratic program to keep everyone happy. Thanks to this, users can discover new restaurants while each restaurant gets a fair amount of exposure to attract new customers, even when they’re new to the platform. In other words, Uber can recommend customers and restaurants to each other in a smart way.

Stitch Fix provides another example. The company offers a personal styling service that sends individually selected clothing and accessory items for a one-time styling fee. Stitch Fix uses constrained optimization to recommend fashion stylists to customers, helping them to match supply and demand fairly and efficiently. Thanks to this matching optimization, they reported a 59% increase in overall customer satisfaction compared to the random model.

Revenue Generating Products


Similar to machine learning upsell products, if you gather enough data from a customer, there are many opportunities to identify scarce resources and optimize them.

On top of optimizing internal operations and minimizing expenses, you can add additional products such as pricing optimization, logistics planning and scheduling as upsell software features for your customers using constrained optimization.

Increase in LTV

The insights provided by optimization algorithms present an opportunity for SaaS companies to differentiate themselves. In the security operations center example, better matching can directly help reduce the number of undetected threats, thus improving customer outcomes as well as creating a more reliable product. Constrained optimization can create efficiencies, reduce friction and increase the stickiness of your product, thus improving customer lifetime value.

Constrained Optimization in Enterprise

There are many examples of enterprises using constrained optimization. Take a look at the examples here:

HP Logo
  • HP transformed its product portfolio management, achieving over $500M in profit improvements across several business units.
  • Marriott developed a dynamic, real-time pricing system for group customers, improving revenue for hotels by at least $47M annually.
MSKCC logo
  • MSKCC devised optimization modeling and computational techniques for prostate cancer therapeutics that offer safer treatment, saving an estimated $459M annually.
  • UPS plans and schedules its overnight air operation using constrained optimization, ensuring that shipments are delivered on time while reducing operational costs.
PG Logo
  • P&G implemented a multi-level inventory optimization solution that achieved nearly 100% service levels while reducing inventory.


However, most of these problems are very complex – NP-hard, to use the mathematical term 🤓 – and very computationally expensive to solve. Only a limited number of people are able to create the mathematical programs required. Many of the open-source solvers are not well-supported, so it’s hard to get started. Translating your business values into numerical values is also complex. Machine learning can help here. Look for someone with experience to guide you when you’re tackling this type of problem for the first time.


Constrained optimization complements and augments predictive tools such as machine learning and other analytics. It can provide optimized, fair and efficient decision-making capabilities.

Many startups don’t think about optimization as of yet, but all large firms are employing it. If you have a problem where you need to optimize your use of limited resources, constrained optimization could be right for you.

If you want to discuss a constrained optimization, I’d love to hear from you.

Growth insights
in your inbox

Join our community of thousands of tech entrepreneurs to get actionable insights from our monthly newsletter.