# Expected cost calculation

The following

$$\sum_i \sum_j h_id_{ij} Y_{ij}(1-q_j)$$

represents the expected transportation cost, where $$i$$ represents the customers and $$j$$ represents the suppliers. $$h_i$$ represents the demand of customer $$i$$ and $$d_{ij}$$ represents the transportation cost between customer $$i$$ and supplier $$j$$. $$Y_{ij}$$ is a binary variable equal to 1 if customer $$i$$ has been assigned to supplier $$j$$ and 0 otherwise. $$q_j$$ is the probability failure of supplier $$j$$ and it is randomly generated using U[0,0.05]

I don't have much background in statistics but I am not sure why we did not use $$q_j$$ in the formula since we are calculating expected value. Usually to calculate the expected value we use $$x\cdot p(x) + x\cdot (1-p(x))$$. I got confused, especially since the $$q_j$$ values are not adding up to 1.

• If $q_j$ is the probability the supplier fails, then $1-q_j$ is the probability he delivers. Presumably, the customer doesn't pay unless he delivers, so this makes sense. – saulspatz Mar 19 at 0:00
• I understand this. But sometimes we use both q and (1-q) in the formula of the cost. When and whey do we do that? – user321821 Mar 19 at 0:10
• You would have to show us the example for us to try to explain it. – saulspatz Mar 19 at 0:13
• Expected value of rolling a die is equal to 1*1/6+2*1/6+3*1/6+4*1/6+5*1/6+6*1/6=3.5 So the sum of probabilites should add up to one but this is not the case in my question – user321821 Mar 19 at 0:24
• Because when the supplier fails, the cost is zero, so there is no need to add in those terms. You can add them if you like, but the answer doesn't change. – saulspatz Mar 19 at 0:37