Optimization has long been one of the primary tools for refinery operations planning because it efficiently solves complex engineering problems involving thousands of variables and constraints. Linear programming is widely used for feedstock allocation, production planning, and blending while maximizing refinery performance under process constraints and operational constraints. For an example of how linear programming can be implemented in AnyLogic using PRL and the ojAlgo optimization solver, see
ojAlgo Solver for AnyLogic: Linear Programming in PRL.
1 Optimization vs. Reality. Every optimization model is an abstraction of a real refinery. To remain computationally efficient, many nonlinear processes behavior are linearized, dynamic effects are simplified, and operational details are omitted. These simplifications are not inherently problematic.
Every model balances accuracy and computational efficiency. The challenge is understanding how each simplification influences the results.In practice, however, model scope is often driven by the capabilities of the optimization framework. If a process can be represented, it is included; if it cannot, it is typically omitted, even though its impact on the quality of the solution may be significant.
2 Optimization vs. Dynamic. Refinery operations are inherently dynamic. Oil and gas continuously flows through interconnected process units, pipelines, tank farms, and loading facilities, while equipment availability, operating modes, residual levels, and product quality requirements change over time. Any calculation cannot be performed independently of the refinery's material flow and process network. The physical configuration of pipelines, process units, and storage facilities defines the feasible operating region available to the optimizer.
3 Flow distribution constrains optimization—not vice versa. This principle deserves closer attention. Although refineries aim to
maximize refinery margin of marketable products, this is rarely their primary operational objective. Most refineries are integrated into upstream supply chains that continuously deliver crude oil, condensate, or intermediate products from production facilities, pipelines, and terminals. These incoming streams are governed by contractual obligations and process continuity, making the refinery's first priority simple:
accept all incoming feedstock whenever physically possible. From an optimization perspective, this objective can be formulated as minimizing unaccepted feedstock. Only after feedstock has been received can the refinery optimize product yields and economic performance. By then, however, many flow-distribution decisions have already been fixed by physical infrastructure, storage availability, and operating constraints. The optimizer therefore searches only within the feasible operating region defined by these constraints. The reverse sequence is rarely realistic. A refinery would not intentionally reject available feedstock simply to improve short-term profitability by directing flows to higher-value processing units. Such a strategy would disrupt the upstream supply chain and violate fundamental operational objectives. For this reason, optimization does not determine material flow. Instead, the physical distribution of material establishes the feasible operating region within which optimization can operate.
Important note: This operating philosophy primarily applies to refineries whose mission is to continuously receive and process all available feedstock from upstream production systems. The situation may differ for merchant or market-oriented refineries that are not obligated to accept the entire incoming crude supply. Such facilities often have greater flexibility to adjust crude intake, select feedstock grades, or intentionally reduce throughput in response to market conditions, refining margins, maintenance schedules, or product demand. In these cases, feedstock acceptance itself becomes an optimization variable, and economic optimization can influence material flow decisions to a much greater extent. Nevertheless, for integrated refinery–upstream systems operating under continuous supply obligations, physical flow distribution remains the dominant constraint, with optimization performed only within the resulting feasible operating envelope. 4 Operational Constraints Beyond Economics. Optimization models usually assume that storage capacity is fully available for economic optimization. In reality, refinery tank farms operate under additional operational constraints that are difficult to represent in linear models. Storage capacity
must be reserved not only for current production, but also to fulfill future shipment plans, maintain minimum operating inventories, support product certification, and accommodate startup, shutdown, and product transition periods. These requirements intentionally reduce the storage available for optimization. As a result, optimization often ignores or oversimplifies these operational constraints, producing solutions that are mathematically optimal but operationally infeasible.
5 Computational Efficiency vs. Model Accuracy. To remain computationally efficient, optimization models inevitably simplify refinery operations. First, time is discretized into planning intervals such as hours, days, or months. Operational changes can occur only at interval boundaries. For example, if a tank farm becomes available at
08:05, a daily optimization model may delay switching a processing unit until the next day, whereas the actual refinery could switch almost immediately. Finer time resolution improves accuracy but significantly increases computational cost. Second, optimization often relies on purely linear formulations. In reality, refinery units exhibit piecewise-linear behavior with minimum stable throughput, maximum capacity, and shutdown states
0 with [min;max]. Representing these operating regimes requires mixed-integer or piecewise-linear optimization, which is substantially more computationally expensive. As a result, many models simplify unit behavior to linear capacity constraints (
< max), reducing operational fidelity. These simplifications make optimization computationally practical but inevitably reduce its ability to represent real refinery behavior accurately.
Despite these limitations, optimization remains one of the most effective tools for refinery planning and production optimization.
The goal is not to replace optimization, but to complement it. Optimization identifies the best solution within a mathematical model, while simulation and digital twins verify that the solution is physically and operationally feasible.
Together, optimization and simulation provide a far more reliable basis for refinery decision-making than either approach alone. Product selection and production planning must therefore be optimized within the physical limits of the refinery rather than assuming that material flows can always be rearranged to satisfy an optimal solution.