INTRODUCTION
Stochastic programming has emerged as one of the most prominent operation research
models for optimization involving uncertainty. Refinery planning problems are
subject to uncertainty in many factors, which primarily includes fluctuations
in prices of crude oil and saleable products, market demand for products and
production yields. The risk terms in Khor et al.
(2008) are handled using the metric meanabsolute deviation. After obtaining
the first model with MAD as risk measurement, the second model is developed
in which the risk terms are performed by CVaR. A comparison is performed between
the two models to assess which of these two risk measures is superior, both
computationally and conceptually, in capturing the economic and operating risk
in the planning of a refinery. However, there are large numbers of scenarios
that create difficulty to handle various circumstances. For example, there may
be more than thousands of cases happening. It is hard to predict and control
numerous scenarios. Therefore, it is necessary to find the minimum number of
scenarios to capture all the circumstances. Monte Carlo simulation approach
based on the Sample Average Approximation (SAA) technique is applied in this
work to generate the minimum number of scenarios which present for thousands
cases. The twostage stochastic program with risk management as presented by
Khor et al. (2008) is formulated as:
where, E[z_{0}] is the expectation of the original objective function
z_{0} with random price coefficients; θ_{1} and θ_{3}
are weights representing the risk factors; V(z_{0}) is the sampling
variance of z_{0}; E_{s} is the expected recourse penalty and
W is the MADbased risk measure. In this work, we extend model Eq.
1 by considering MAD as the risk measure in place of variance. Further,
we investigate the viability of the risk measure Conditional ValueatRisk (CVaR),
which has gained wide attention in computational finance, within the domain
of refinery planning. All the uncertain parameters are assumed to be discrete
random variables.
MONTE CARLO SIMULATION APPROACH BASED ON SAMPLE AVERAGE APPROXIMATION (SAA) METHOD
In this study, we adopt the Monte Carlo simulation approach for scenario generation
based on the Sample Average Approximation (SAA) method (You
et al., 2009; Shapiro, 2000; Shapiro
and HomemdeMello, 1998). The procedure involved is as follows:
• 
Step 1: A relatively small number of scenarios (for
example, 50 scenarios) with their associated probabilities are randomly
and independently generated for the uncertain parameters of prices, demands
and yields. This is accomplished by employing the Monte Carlo simulation
approach based on the SAA technique. (This data is otherwise obtained from
plant historical data.) The resulting stochastic model (a linear program)
with the objective function given in Eq. 2 is solved to
determine the optimal stochastic profit with its corresponding material
flowrates: 
where,
and
• 
Step 2: The Monte Carlo sampling variance estimator
is determined using the optimal stochastic profit and flowrates computed
in step 1. 
where,
• 
Step 3: The lower and upperconfidence limits of the
95% confidence interval H of 1α are computed as follows: 
• 
Step 4: The minimum number of scenarios N that is theoretically
required to obtain an optimal solution is determined using the relation
below: 
where, the standard normal random variable z_{α/2} = 1.96 at confidence interval (1α) = 95%.
MODEL FORMULATION OF STOCHASTIC REFINERY PLANNING MODEL WITH MEANABSOLUTE DEVIATION (MAD) AS RISK MEASURE
The risk metric MeanAbsolute Deviation (MAD) is employed as a measure of deviation
from the expected profit (Konno and Yamazaki, 1991).
It is defined as follows:
In this study, the rate of return R in Eq. 6 refers to unit cost of materials (crude oil and refinery products) and the amount of money x_{j} invested in an asset j refers to the refinery production amount. Therefore, the formulation of the MADbased risk measure for price uncertainty becomes:
while for demands and yields uncertainty, it is given by:
FORMULATION OF STOCHASTIC REFINERY PLANNING MODEL WITH CONDITIONAL VALUEATRISK (CVAR) AS RISK MEASURE
CvaR, also termed as mean excess loss, mean shortfall or tail VaR, is a risk
assessment technique that is originally intended to be employed for reducing
the probability that an investment portfolio will incur high losses. It offers
the advantage of a linear programming formulation for determining the optimal
solution of financial planning problems that explicitly minimizes loss or risk.
CVaR is performed by taking the likelihood (at a specific confidence level,
e.g., 0.95 or 0.99) that a specific loss will exceed the metric known as ValueatRisk
(VaR). From a mathematical point of view, CVaR is derived by taking a weighted
average between VaR and the losses exceeding VaR. For a discrete probability
distribution function, CVaR can be defined as follows (Rockafellar
and Uryasev, 2002, 2000):
Using CVaR as the risk metric yields the following form of the objective function:
where, CVaRz_{0} is the risk measure imposed by the recourse costs to handle price uncertainty.
where, CvaR_{ξ} is the risk measure imposed by the recourse costs to handle uncertainty in demands and yields.
Substituting Eq. 10 and 11 into 9, we
obtain a twostage stochastic programming model with meanBrisk objective in
which the risk measures are assessed by CVaR.
NUMERICAL EXPERIMENTS
We illustrate the risk modeling approach proposed in this paper on the numerical
example taken from Khor et al. (2008) and provide
major details on the implementation using GAMS/CONOPT3.
Solving twostage stochastic program with MAD as risk measure: The expectation of the objective function value is given by the original objective function itself: The corresponding expression for expected profit is formulated for the 13 scenarios that has been randomly generated.
Solving twostage stochastic program with CVaR as risk measure: The
following is the procedure for developing a loss distribution in order to determine
the value for the parameter VaR.
• 
Step 1: The objective value of deterministic profit
for each of the 13 scenarios is computed (i.e., multiplication of flowrate
and the corresponding price per unit flowrate) 
• 
Step 2: The probability of each scenario is randomly generated
using Monte Carlo simulation based on pseudorandom number generation 
• 
Step 3: The computed values in step 1 are sorted in ascending order 
• 
Step 4: The plot of cumulative distribution function against the
sorted deterministic profit values is developed to obtain a representation
of the loss distribution. At confidence interval of (1α) = 0.95, we
can read off the value of VaR from the loss distribution plot, as depicted
in Fig. 1 and 2, which represents the
penalty for uncertainty in prices and in both demands and yields, respectively.
The computational statistics and a summary of the main computational results
are provided in Table 1 and 2, respectively 

Fig. 1: 
Loss distribution to determine VaR_{1} 

Fig. 2: 
Loss distribution to determine VaR_{2} 
Table 1: 
Summary of computational results 

Table 2: 
Computational statistics of GAMS implementation for determining
optimal solutions of MAD and CVaRbased meanBrisk stochastic program 

CONCLUSION
In this study, we have proposed a stochastic nonlinear programming model with recourse that incorporates the risk metrics of MAD and CVaR to handle economic and operational risk management in refinery planning problems under uncertainty in prices, demands and yields. The model involves the application of Monte Carlo simulation approach based on the Sample Average Approximation (SAA) method to determine the minimum number of scenarios required to obtain an optimal solution. Therefore, the main idea of this study is to combine the scenario reduction technique of SAA with the novel application of the computationallyattractive risk metric CvaR to refinery planning problems. The model is applied to a representative refinery planning problem in the literature to illustrate its computational performance.
ACKNOWLEDGMENTS
Author is grateful to Universiti Teknologi PETRONAS for the full support of this study and acknowledges Thi Huynh Nga Nguyen, his undergraduate research assistant, for her contribution in the computational work.