Need for Simulation
If the mathematical model set up could always be optimized by the analytical approach, then, there would be no need for simulation. Only when interrelationships are too complex or there is uncertainty regarding the values that could be assumed by the variables or both, we would have to resort to simulation.
Example
Let us try to introduce some uncertainty in the illustration which we have already seen. As before, the competition price is Rs.10 and the firm is considering three alternative prices, namely, Rs.8, Rs.10 and Rs.12. However, for each price chosen by the firm, the sales volume is uncertain. The following table gives the possible values of sales for each price and also the corresponding cost of production and profit.
Firms' Price
(Rs. per unit)

Competition Price (Rs. per unit)

Qty.Sold
(Nos.)

Revenue (Rs.)

Cost (Rs.)

Profit (Rs.)

8
8
8
10
10
10
12
12
12

10
10
10
10
10
10
10
10
10

10,000
15,000
20,000
8,000
10,000
12,000
4,000
7,500
11,000

80,000
1,20,000
1,60,000
80,000
1,00,000
1,20,000
48,000
90,000
1,32,000

80,000
95,000
1,50,000
78,000
80,000
84,000
40,000
75,000
88,000

0
25,000
10,000
2,000
20,000
36,000
8,000
15,000
44,000

The table shows that if the firm chooses a price of Rs.8, its sales can take any one of the three values, namely, 10,000, 15,000 or 20,000 units. So also at prices Rs.10 and Rs.12.
If we try to use the analytical approach to solve the problem, assuming that the objective is to maximize profits, we may say that the firm should try to charge Rs.12 per unit.
This would bring in Rs.44,000 as profits. However, this is not a straight forward solution as the amount of profits can be earned, if and only if the quantity sold is 11,000. We know that when the price is Rs.12, the quantity sold could be 4,000 or 7,500 or 11,000. If only 4,000 were sold, the actual profit earned would be only Rs.8,000.
One way to solve problems involving uncertainty is to assign probabilities of occurrence for each sales quantity and then find the price which maximizes the expected profit.
We would still use the analytical approach for the modified version of the illustration by assigning probabilities. Let us complicate the illustration further to approximate it to a reallife situation.
Suppose the competition price is not known with certainty. However, it is known that it could be anywhere between Rs.8 and Rs.12. We could describe the competition price as a random variable which is uniformly distributed between 8 and 12. The firm is considering three pricing strategies as before:

Price equal to that of competition

Price two rupees below competition

Price two rupees above competition.
Let us further assume that given the firm's price P and the competition price P_{c}, the firm's sales volume is a normally distributed random variable with mean given by Q_{M} = 18,000  500P + 100P_{c} and standard deviation 2,000.
If, for instance, the competition price is Rs.10 and the firm's price is Rs.8, substituting these values in the above equation, the mean or expected sales quantity will be 15,000. However, the actual sales quantity is distributed normally with mean 15,000 and standard deviation 2,000.
Let us further assume that the costs are also uncertain. For any production volume Q, the mean unit cost is Rs.7, the actual unit cost is normally distributed with mean 7 and standard deviation of Re.1. Uncertainty in costs may be due to the break down of machinery, uncertain supplies and prices of some raw materials, etc.
Since we express the behavior of the variables in terms of a distribution, the model is called stochastic model of the system. This model is based on the following assumptions.

There is a probability distribution for the average selling price of competitors.

The mean sales volume is related to the firm's price and competition price and there is a probability distribution of the actual sales volume around this mean.

There is a probability distribution of unit cost.
Optimizing a model, which sets relationships of random variables through analytical approach is extremely difficult. Though our basic mathematical model of profit = PQ  CQ has not altered, P, Q and C are all random variables. The alternative is to arrive at the solution through simulation. However, to carry out simulation we need to know something about random number generation.