Refineries optimization: from Data Science to Financial Engineering
strategic planning

Refineries optimization: from Data Science to Financial Engineering

banner

Optimizing the decision-making of a strategic project under uncertainty


Laying out the theoretical business case

This case study demonstrates the application of various data science techniques, integrated with finance and strategic planning, to improve data-driven decision-making processes. The aim is to recommend the optimal execution of projects, even under uncertain conditions.


Disclaimer: This is a theoretical business case. Production and distribution costs, as well as most expansion projects (excluding Dos Bocas), are random. Details are provided at the end of this post.


A theoretical portfolio of expansion projects is provided in the table below. It consists of expansions at existing facilities (brownfield projects) or new production sites (greenfield projects). Their profitability is to be determined through Mixed Integer Linear Programming and Monte Carlo methods for diverse supply and demand scenarios.


PLANTPROJECT TYPECAPEX (M MXN)CAPACITY (M LITERS PER DAY)
CadereytaBrownfield100,0004.3 (+40%)
CangrejeraBrownfield75,0004.9 (N/A)
Dos BocasGreenfield336,32033.8 (N/A)
MaderoBrownfield100,0001.9 (+30%)
MinatitlanBrownfield75,0002.6 (+40%)
SalamancaBrownfield75,0002.3 (+40%)
Salina CruzBrownfield150,0003.7 (+30%)
TulaBrownfield150,0002.1 (+30%)

Developing the Monte Carlo approach to tackle uncertainty challenges

For each location in Mexico, 1,000 simulations were conducted, considering variables such as demand, price, and supply costs.


Scenarios for price and demand are generated using an Artificial Neural Network (ANN) with an Auto Variational Encoder (AVE) structure that uses machine learning to create new data based on training data.


The figure below includes two graphs: the left graph shows fuel demand, while the right graph displays the price at the pump. These graphs aggregate data for Mexico, derived from estimates across 792 locations over the samples.

Using the Mixed Integer Optimization model to determine profitability

These estimates are fed into the optimization model to determine which projects are executed based on supply and demand conditions for each sample. There are two scenarios for each sample:

  • Base-case: a scenario where the model can NOT execute the expansion project at each plant
  • target-case: a scenario where the model can execute the expansion project at each plant

The optimization model will maximize the Discounted Free Cashflow (DCF) of the system of plants under each of the simulations at each scenario. The result of the optimization model is the production output at each refinery and their supply requirements for each market.


Embedding the CAPEX in the optimization of the DCF is helpful as it enables the model to make the best investment decision on profitable expansions instead of running a business-case for each project on its own to determine if they are profitable under each scenario.


The decision to execute each project under the optimization model is shown in the graph below where it is displayed as the percentage of scenarios where the capacity expansion occurred at each refinery.


Analyzing the profitability of each project with a Discounted Cashflow approach

Each project is evaluated by the optimization model using the DCF method, comparing the Free Cash Flow (FCF) generated by each plant with an expansion versus the base case.


As commented before, each scenario then has a target and a base case, both have the same demand, price and costs but capacity is allowed to increase if the CAPEX is executed in the target-case and it cannot increase in the base case.


This allows for an isolated analysis of the benefits generated by the project under equal market conditions but with increased capacity. The optimization model will execute the expansion whenever it is profitable system-wise for that plant to increase its market-share.


The profitability of the expansion is then retrieved by contrasting the benefits generated by the target-case and subtracting the ones in the base-case.


Below is a violin plot that shows the Net Present Value (NPV) of the FCF generated by each plant when allowed to increase capacity over the simulations.


As shown in the violin plot, sometimes a project will generate negative FCF. This happens because a plant might incur a loss due to increased distribution costs, while other plants reduce their overall costs (production and/or distribution), thereby generating a benefit for the system.


This can be corroborated in the plot below that shows the distribution of the DCF at system level instead for each plant. All values remain positive at system level even when some plants generated less FCF when compared to the base case.


This is what the optimization model achieves, systemic and integral benefits along the value chain.


Leveraging the Real Option valuation on the generated data to enhance the decision-making process


The optimization of 1,000 simulations provides the foundation for robust investment decisions. As shown in previous violin plots and the one below, Some expansions may underperform in unfavorable market conditions, revealing diverse risk profiles which must be strategically considered.



Real Options can help manage the risk associated with each project. This method extends the concept of options from financial derivatives to assess the fair value of a project considering the inherent risk exposure and potential upsides.


Consider the scenario where the company has to decide to purchase the land and spend in engineering studies for the project. These land and studies enable the company to access the future benefits if the project is executed. Through Real Options, a fair value can be calculated so management can allocate resources properly according to expected benefits and current CAPEX estimates.


The benefits were estimated through the DCF analysis over the 1,000 simulations with an expected value (\(S_0\)) and its respective risk (\({\sigma}^2\)). Moreover, the CAPEX for the execution of the project resembles the strike price (\(K\)).


Let’s consider the case were management sets an investment window of five years to decide on the execution of the project, depending on how economic conditions develop.


An American call option resembles this situation where the decision to build the plant can be done within the 5 years. The value of the American option extends the traditional DCF and sets an upperbound for land, engineering and other capital commitments that might arise before the project materializes.


In this case, the value of the project to hedge in the real option (\( S_0 \)) will be defined under a conservative case so the value of the real option does not commit estimated benefits above the \(25^{th}\) percentile.


Below is the plot that shows the expected value, hedged value at \(25^{th}\) percentile and real option value as a ratio to expansion CAPEX for each plant.


PLANTDCF (M MXN)HEDGE (M MXN)OPTION (M MXN)Ext DCF (M MXN)
Cadereyta96,84281,7661,02697,868
Cangrejera114,58396,55021,590136,173
Dos Bocas466,398403,92668,543534,941
Madero-945-5,252-945
Minatitlan10,902-3,53610,902
Salamanca47,23942,377247,241
Salina Cruz3,702-5,3763,702
Tula-1,013-4,061-1,013

Moreover, the table above denotes the value granted by the flexibility to execute the expansion in 5 years instead of committing beforehand.


Dos Bocas has the highest option value of 69 B MXN with a traditional DCF of 466 B MXN and a CAPEX of 336 B MXN. The extended NPV, which considers the real option value, is 535 B MXN.
The company should not spend more than the real option value on land and engineering, as doing so would jeopardize the value of flexibility and commit FCF beyond the \(25^{th}\) threshold.


Hedging the projects through financial options


Continuing with the analysis, Dos Bocas, Cangrejera, Cadereyta and Salamanca were found to execute their projects on more than 75% of the simulations.
If the company were to commit to build these expansions, benefits generated by capacity expansions could be seen through a symbolic stock performance. This could help devise a financial hedge on the stock.


Assuming an all-equity firm, the \(\text{DCF}_{t}\) at each timestep accounting for perpetuity will be divided by a symbolic amount of 130 B stocks (1,000 per mexican), this yields an increase of +6.9 MXN/stock (+3.1%, +902 B DCF) to current valuation.


ScenarioNow5y10y15y20y
Base case2,220.72,323.92,734.43,436.83,677.1
Optimized2,227.62,336.22,746.33,448.53,688.5
Delta6.912.311.911.711.4

Investors willing to inject capital into this pool of projects (586 B MXN) could hedge through an option on the stock.
Executing a put option with a strike price at 2,336.2 \(\frac{\text{MXN}}{\text{share}}\) with ~20 B positions would hedge the expected premium on the DCF of +902 B MXN derived from expansion projects upon reaching comisioning in year 5.

$$ \text{20 B} = \frac{ \text{902 B MXN} }{ \text{2,336.2 MXN/share} - \text{2,320.7 MXN/share} - \text{70.4 MXN/share}} $$

where 70.4 \(\frac{\text{MXN}}{\text{share}}\) is the fair value of a put option under Black-Scholes model.

The challenge is that the 20 B value represents 15% of floating stocks.


If management could settle 20 B positions, and the stock reaches the expected value of of 2,336.2 \(\frac{\text{MXN}}{\text{share}}\) in 5 years. This would generate 902 B MXN which replicates the expected incremental DCF over the lifetime of the projects if executed.


Wrapping up


Throughout the business case, the retrieval of data and forecasting of multiple scenarios using Machine Learning laid the foundation for a robust analysis. The use of optimization techniques to assess the value of assets under potential expansions revealed their contribution and dependence within the system.


Translating these contributions into financial performance highlighted their attractiveness and risk profile. In particular, the value of flexibility through Real Options helped determine a fair valuation in expanding the understanding of the project through land aquisition, feasibility, and engineering expenses.


Moreover, the use of financial options helped hedge capital exposure for the projects and revealed the stress reflected in the market.


Large capital projects like these require nimble strategic and financial analysis. Coordination between public and private efforts is essential to ensure their success, particularly when innovating on investment vehicles and incentives to democratize access to energy. These complex financial structures—such as tax incentives attracting tax-equity investors and loan syndication—emerge throughout the life of the project.

Disclaimer: This is a theoretical business case.

  1. Historical demand and prices were retrieved from CRE data repository
  2. Demographic data was retrieved from INEGI’s 2020 census
  3. Capacities are approximated with the production of 2020
  4. Dos Bocas capacity was retrieved from the official site
  5. All operationg costs (variable, fixed) are trivial and defined as a percentage of revenues.
  6. Freight costs are estimated through a cost per liter-kilometer basis and using the distiance of each refinary to locations of consumption
  7. Dos bocas CAPEX was retrieved from official site
  8. All other CAPEX costs are trivial defined per current plant capacity

Deep dive:


If you are interested in replicating a simpler version of this analysis head to my Github repo and begin with Session 0 notebook.


More on Real Options:


Black and Scholes model

Real Options

Real Options Analysis by Johnathan Mun Book Web page