! Oil Drilling Decision tree from Hillier & Lieberman, Chapter 15;
! Keywords: Decision tree, Petroleum, Hillier & Lieberman, 
   Decisionmaking under uncertainty;
! An oil exploration company faces the sequence of decisions
  and random events:
     SRV = Do a survey, or
     NOS = No survey,
        FAV = Favorable result from survey, or
        UNF = Unfavorable,
           SEL = Sell rather than drill,
           DRL = Drill,
              OIL = Hit Oil, or
              DRY = Dry hole.
 We must decide to make the survey or not, and then drill or sell
so as to maximize expected profits;

! In the model below, each variable of the form ijk
 is the probability of the sequence of events i, j, k, e.g.,
    SRVFAVDRL means: we did the survey, it turned out favorable,
                     and we drilled;
! In the solution, any decision we should take will have a positive
 probability.  E.g., if  SRV > 0 in the solution, it means we should
 take the survey.  If SRVFAVDRL > 0 it means if the survey turns out
 favorable, then we should drill;

!Stage 1 decision. With probability 1, we do something;
  1 = SRV + NOS;  ! Do survey or no survey;

!Stage 1 nature's decision. Prob{Survey unfavorable} = .7;
  SRV*.7 = SRVUNF; ! Do survey, turns out unfavorable;
  SRV*.3 = SRVFAV; ! Do survey, turns out favorable;

! Stage 2, our decision;
   SRVUNF = SRVUNFDRL + SRVUNFSEL; ! Survey unfavorable, either drill or sell;
   SRVFAV = SRVFAVDRL + SRVFAVSEL; ! Survey favorable, either drill or sell;

   NOS = NOSDRL + NOSSEL; ! No Survey, either drill or sell;

! Stage 2 nature's decision;
  !Prob{Hit oil | Survey unfavorable} = .143;
                  !Prob{survey & unfav & drill & hit oil};
   SRVUNFDRL*.143 = SRVUNFDRLOIL;
                  !Prob{survey & unfav & drill & dry}; 
   SRVUNFDRL*.857 = SRVUNFDRLDRY;

   SRVFAVDRL*.5   = SRVFAVDRLOIL;
   SRVFAVDRL*.5   = SRVFAVDRLDRY;

   NOSDRL*.25  = NOSDRLOIL;
   NOSDRL*.75  = NOSDRLDRY;

      ! Expected revenue from oil;
MAX= 800*(SRVUNFDRLOIL + SRVFAVDRLOIL + NOSDRLOIL) 
       ! Expected revenue from selling;
   +  90*(SRVFAVSEL + SRVUNFSEL + NOSSEL)
      ! Cost of survey;
   -  30*SRV 
      ! Expected cost of drilling;
   - 100*(SRVUNFDRL + SRVFAVDRL + NOSDRL);