A global pet food manufacturer wanted to lower gas, steam, and electricity costs on its dry food extrusion line without putting product quality at risk. C&F built a real-time optimizer that recommends the lowest-cost process settings to operators and lets them test a change before they make it.
Key achievements:
- Projected utility cost reduction of more than 5% per production line on average, and over 10% in the base case
- Real-time setpoint recommendations for the preconditioner, extruder, and dryer in a plant that makes more than 200 products
- Recommendations, a what-if tool, and live cost monitoring in one operator web application, plus a virtual sensor for moisture, gelatinization, and density
- A faster optimization algorithm after moving from the COBYLA to the SLSQP solver on linearized models
- Deployed and tested on live production batches inside the client’s isolated factory network
About the client: A global pet food manufacturer and part of a multinational CPG group. The project covered one of its dry pet food plants in Europe, which produces more than 200 different cat and dog food products.
Industry: CPG, pet food manufacturing
Technology: Azure, Databricks, machine learning models (neural networks, XGBoost), SLSQP solver, MongoDB, PostgreSQL, QuestDB, Redis, FastAPI, Celery, Azure DevOps
The challenge
Dry pet food is made by extrusion. Every recipe passes through a preconditioner, an extruder, and a dryer, and each step uses gas, steam, or electricity. The client’s plant produces more than 200 different dry cat and dog food products, so the process settings change with every product.
The savings sat in the gap between where the process ran and where it could safely run. Closing that gap by hand is risky: change the wrong parameter and product quality drifts, which means waste. The client wanted a system that would recommend the most cost-efficient settings in real time, keep quality within defined limits, and let operators virtually test a change before making it. The method also had to be generic, with other lines and plants in view from day one.
The conditions were demanding. Production data was confidential, access to it was limited, and it lived across several systems with different owners. No test environment mirrored the plant, and the application had to run inside the isolated factory network, where every deployment step is controlled. An earlier attempt to solve the problem had not succeeded, so expectations were high.
The solution
A shared data foundation first
We started with the data. Production, laboratory, raw material, and utility meter data sat in separate systems with different owners. Before training any model, our team worked with the client’s teams to understand where each signal came from, what it meant, and how to merge it. The result was a complete, agreed-upon dataset that every team on the project worked from.
We built within the client’s constraints. Optimizer development ran on Databricks on Azure, the platform the client had approved for it. Because no test environment mirrored the plant, we set up a dedicated Azure virtual machine configured to match the target environment, so the full application could be tested before it reached the factory. Configuration is versioned in Azure DevOps.
An optimizer that keeps quality within specification
The Factory Optimizer runs inside the plant network and reads process data from the plant’s production control systems every few seconds. For the preconditioner, extruder, and dryer, it takes the current settings, the process constraints, and the cost of each utility, then uses machine learning models to predict how a change will affect quality and consumption. Each model is corrected against the latest laboratory quality measurement, so predictions stay anchored to what the lab actually sees. A constrained optimization solver then finds the lowest-cost settings that keep the product within specification.
The first version used the COBYLA solver. Our team then linearized the nonlinear models around the current operating point, which made it possible to switch to SLSQP (Sequential Least Squares Programming). The change made the optimization algorithm faster.
Four capabilities for operators
Operators work with the results in a web application and decide which recommendations to apply. Next to the setpoint recommendations, the application includes a what-if tool that shows what happens if a given condition changes, before anyone changes it. Cost monitoring shows the current utility cost of the line in real time, and a virtual sensor estimates product moisture, gelatinization, and density.

Simplified architecture of the Factory Optimizer
Tested on the factory floor
Several teams were building separate components of one system, so coordination mattered as much as code. We kept a short communication loop through regular calls and shared channels.
The final stretch happened on the factory floor. Client and C&F engineers worked on site during deployment, talked with operators, and watched the application run on live production batches. The team fixed issues found during a batch across the backend and frontend, and operator feedback shaped the next round of changes to both the optimizer and the interface.
The result
The optimizer is projected to reduce total utility costs by more than 5% per production line on average, and by over 10% in the base case. The savings come from running the process closer to its limits while product quality stays under control.
The value goes beyond energy. Operators get recommendations they can check against their own experience, and the what-if tool gives less experienced staff a safe way to learn how the process reacts during onboarding. Running closer to the process limits, with quality under control, is designed to make output more predictable and reduce waste.
The client also has a proven method for applying the same approach across other production lines and plants.