Back to Blog
AI

Forecasts Don't Make Decisions: Automating Allocation, Blending, and Ordering with Mathematical Optimization (MILP)

An accurate forecast doesn't pay off if allocation, blending, and ordering decisions are still made by hand in Excel. This post covers how mixed-integer linear programming (MILP) turns forecasts into actionable decisions, from building the model and choosing a solver to running it in production and rolling it out step by step.

POLYGLOTSOFT Tech Team2026-11-307 min read7
Mathematical OptimizationMILPDecision AutomationOperations OptimizationPredictive Analytics

Your Forecast Is Accurate, but Decisions Still Happen in Excel

Here is a familiar scene at companies that have adopted demand forecasting. The system produces next week's sales forecast for every store. Then a planner spends hours in a spreadsheet working out how many cases to ship from which warehouse to which store. However accurate the forecast is, the decision on the floor stays the same.

  • Forecasting answers "what will happen?" For example, store A will need 120 units next week.
  • Optimization answers "so what should we do?" It finds the lowest-cost allocation that respects warehouse stock, truck capacity, and order multiples all at once.
  • This gap is usually where machine learning projects stall. The step that turns predictions into decisions is still done by hand.

    Where Mathematical Optimization Fits Best

    Mixed-integer linear programming (MILP) works especially well for recurring decisions like these:

  • Inventory allocation: splitting stock across stores from several distribution centers
  • Blending: choosing the cheapest ingredient mix that still meets composition specs
  • Order quantities: planning purchases around minimum order quantities, lead times, and storage capacity
  • Staff and vehicle assignment: building schedules that obey labor rules and driving-time limits
  • What these problems share is a long list of constraints and options that grow combinatorially. With just 3 DCs, 40 stores, and 200 SKUs, you already have 3 × 40 × 200 = 24,000 allocation variables. A planner can find a reasonable answer in Excel, but there's no way to know whether a better one exists.

    Three Building Blocks of a Model

    Every optimization model has three parts.

  • Decision variables: the values you need to choose, such as the quantity of SKU k shipped from DC i to store j
  • Objective function: what you minimize or maximize, such as freight cost + stockout penalty + holding cost
  • Constraints: the rules that must hold, such as shipments from each DC ≤ on-hand stock and load per truck ≤ 18 pallets
  • Some business rules are easy to miss when you turn them into constraints. A minimum order quantity often means "order in whole case multiples, and either order nothing or order at least 500 units." That calls for a binary variable. Exception suppliers and customers bring rules like "this vendor only delivers on Tuesdays" or "this store ships only from its assigned DC," and those rules often live only in a planner's head. When a model returns an unrealistic plan, a missing rule like this is usually the cause.

    Choosing a Solver and Managing Run Time

    Solvers fall into two broad camps:

  • Open source: HiGHS, SCIP, CBC, Google OR-Tools, and others. They handle problems with thousands to tens of thousands of variables well, with no license fees.
  • Commercial: Gurobi, CPLEX, FICO Xpress, and others. On large or hard integer problems they are often much faster, and they come with vendor support.
  • We recommend building the model on an open-source solver first and measuring solve times on real data. Look at commercial solvers only if the problem can't be solved within your operating window.

    In production, getting a good-enough solution within a fixed time matters more than proving mathematical optimality. A rule such as "stop at 120 seconds or once the MIP gap is under 1%" keeps results reliable even in a daily early-morning batch.

    Connecting Forecasts to Optimization

    If you feed the optimizer a single point forecast, it treats that number as certain and allocates stock too tightly. There are two common ways to account for uncertainty:

  • Scenarios: include low, base, and high demand scenarios and minimize expected cost.
  • Safety stock: use the standard deviation of forecast error to set safety stock for a target service level (say, 95%) and build it into the constraints.
  • The results screen matters just as much. Planners should be able to approve or adjust recommendations and record why they made a change. Frequent overrides point to rules the model is missing, so that log is where model improvement begins.

    Start Small

  • Pick one recurring decision. Weekly store allocation is a good candidate: it happens often and its outcome can be measured in cost.
  • Run it alongside the current process for 4–8 weeks and compare freight cost, stockout rate, and planner hours.
  • Once the benefit is clear, expand to related decisions such as ordering or blending.
  • POLYGLOTSOFT supports the full build of data and optimization systems, from demand forecasting models to MILP-based optimization engines and the screens where planners review and approve results. If you already have forecasts but your decisions still happen in Excel, let's start by modeling one recurring decision together.