<% mySQL = "SELECT * FROM D_time" set rstime=Conn.Execute(mySQL) mySQL = "SELECT * FROM cost" set rscost=Conn.Execute(mySQL) mySQL = "SELECT * FROM env" set rsenv=Conn.Execute(mySQL) mySQL = "SELECT * FROM con" set rscon=Conn.Execute(mySQL) mySQL = "SELECT * FROM Decision" set rsdecision=Conn.Execute(mySQL) myans=request("myans") dim C_11, C_16, U_11, U_16 C_11=cdbl(request("C_11")) C_16=cdbl(request("C_16")) U_11=cdbl(request("U_11")) U_16=cdbl(request("U_16")) dim C_11_h, C_11_m, C_11_l, C_16_h, C_16_m, C_16_l, U_11_h, U_11_m, U_11_l, U_16_h, U_16_m, U_16_l C_11_h=cdbl(request("C_11_h")) C_11_m=cdbl(request("C_11_m")) C_11_l=cdbl(request("C_11_l")) C_16_h=cdbl(request("C_16_h")) C_16_m=cdbl(request("C_16_m")) C_16_l=cdbl(request("C_16_l")) U_11_h=cdbl(request("U_11_h")) U_11_m=cdbl(request("U_11_m")) U_11_l=cdbl(request("U_11_l")) U_16_h=cdbl(request("U_16_h")) U_16_m=cdbl(request("U_16_m")) U_16_l=cdbl(request("U_16_l")) dim C_11_h_e, C_11_m_e, C_11_l_e, C_16_h_e, C_16_m_e, C_16_l_e, U_11_h_e, U_11_m_e, U_11_l_e, U_16_h_e, U_16_m_e, U_16_l_e C_11_h_e=cdbl(request("C_11_h_e")) C_11_m_e=cdbl(request("C_11_m_e")) C_11_l_e=cdbl(request("C_11_l_e")) C_16_h_e=cdbl(request("C_16_h_e")) C_16_m_e=cdbl(request("C_16_m_e")) C_16_l_e=cdbl(request("C_16_l_e")) U_11_h_e=cdbl(request("U_11_h_e")) U_11_m_e=cdbl(request("U_11_m_e")) U_11_l_e=cdbl(request("U_11_l_e")) U_16_h_e=cdbl(request("U_16_h_e")) U_16_m_e=cdbl(request("U_16_m_e")) U_16_l_e=cdbl(request("U_16_l_e")) dim hh_w, hm_w, hl_w, mh_w, mm_w, ml_w, lh_w, lm_w, ll_w, hh_i, hm_i, hl_i, mh_i, mm_i, ml_i, lh_i, lm_i, ll_i, hh_b, hm_b, hl_b, mh_b, mm_b, ml_b, lh_b, lm_b, ll_b hh_w=cdbl(request("hh_w")) hm_w=cdbl(request("hm_w")) hl_w=cdbl(request("hl_w")) mh_w=cdbl(request("mh_w")) mm_w=cdbl(request("mm_w")) ml_w=cdbl(request("ml_w")) lh_w=cdbl(request("lh_w")) lm_w=cdbl(request("lm_w")) ll_w=cdbl(request("ll_w")) hh_i=cdbl(request("hh_i")) hm_i=cdbl(request("hm_i")) hl_i=cdbl(request("hl_i")) mh_i=cdbl(request("mh_i")) mm_i=cdbl(request("mm_i")) ml_i=cdbl(request("ml_i")) lh_i=cdbl(request("lh_i")) lm_i=cdbl(request("lm_i")) ll_i=cdbl(request("ll_i")) hh_b=cdbl(request("hh_b")) hm_b=cdbl(request("hm_b")) hl_b=cdbl(request("hl_b")) mh_b=cdbl(request("mh_b")) mm_b=cdbl(request("mm_b")) ml_b=cdbl(request("ml_b")) lh_b=cdbl(request("lh_b")) lm_b=cdbl(request("lm_b")) ll_b=cdbl(request("ll_b")) dim worst, inter, best worst=cdbl(request("worst")) inter=cdbl(request("inter")) best=cdbl(request("best")) If myans="yes" Then mySQL="UPDATE D_time SET " mySQL=mySQL & " C_11 = " & C_11 mySQL=mySQL & ", C_16 = " & C_16 mySQL=mySQL & ", U_11 = " & U_11 mySQL=mySQL & ", U_16 = " & U_16 'mySQL=mySQL & " WHERE D_number = 1" set rsEdit1=Conn.execute(mySQL) set rsEdit1 = Nothing mySQL="UPDATE cost SET " mySQL=mySQL & " C_11_h = " & C_11_h mySQL=mySQL & ", C_11_m = " & C_11_m mySQL=mySQL & ", C_11_l = " & C_11_l mySQL=mySQL & ", C_16_h = " & C_16_h mySQL=mySQL & ", C_16_m = " & C_16_m mySQL=mySQL & ", C_16_l = " & C_16_l mySQL=mySQL & ", U_11_h = " & U_11_h mySQL=mySQL & ", U_11_m = " & U_11_m mySQL=mySQL & ", U_11_l = " & U_11_l mySQL=mySQL & ", U_16_h = " & U_16_h mySQL=mySQL & ", U_16_m = " & U_16_m mySQL=mySQL & ", U_16_l = " & U_16_l set rsEdit2=Conn.execute(mySQL) set rsEdit2 = Nothing mySQL="UPDATE env SET " mySQL=mySQL & " C_11_h = " & C_11_h_e mySQL=mySQL & ", C_11_m = " & C_11_m_e mySQL=mySQL & ", C_11_l = " & C_11_l_e mySQL=mySQL & ", C_16_h = " & C_16_h_e mySQL=mySQL & ", C_16_m = " & C_16_m_e mySQL=mySQL & ", C_16_l = " & C_16_l_e mySQL=mySQL & ", U_11_h = " & U_11_h_e mySQL=mySQL & ", U_11_m = " & U_11_m_e mySQL=mySQL & ", U_11_l = " & U_11_l_e mySQL=mySQL & ", U_16_h = " & U_16_h_e mySQL=mySQL & ", U_16_m = " & U_16_m_e mySQL=mySQL & ", U_16_l = " & U_16_l_e set rsEdit3=Conn.execute(mySQL) set rsEdit3 = Nothing mySQL="UPDATE con SET " mySQL=mySQL & " hh_w = " & hh_w mySQL=mySQL & ", hm_w = " & hm_w mySQL=mySQL & ", hl_w = " & hl_w mySQL=mySQL & ", mh_w = " & mh_w mySQL=mySQL & ", mm_w = " & mm_w mySQL=mySQL & ", ml_w = " & ml_w mySQL=mySQL & ", lh_w = " & lh_w mySQL=mySQL & ", lm_w = " & lm_w mySQL=mySQL & ", ll_w = " & ll_w mySQL=mySQL & ", hh_i = " & hh_i mySQL=mySQL & ", hm_i = " & hm_i mySQL=mySQL & ", hl_i = " & hl_i mySQL=mySQL & ", mh_i = " & mh_i mySQL=mySQL & ", mm_i = " & mm_i mySQL=mySQL & ", ml_i = " & ml_i mySQL=mySQL & ", lh_i = " & lh_i mySQL=mySQL & ", lm_i = " & lm_i mySQL=mySQL & ", ll_i = " & ll_i mySQL=mySQL & ", hh_b = " & hh_b mySQL=mySQL & ", hm_b = " & hm_b mySQL=mySQL & ", hl_b = " & hl_b mySQL=mySQL & ", mh_b = " & mh_b mySQL=mySQL & ", mm_b = " & mm_b mySQL=mySQL & ", ml_b = " & ml_b mySQL=mySQL & ", lh_b = " & lh_b mySQL=mySQL & ", lm_b = " & lm_b mySQL=mySQL & ", ll_b = " & ll_b set rsEdit4=Conn.execute(mySQL) set rsEdit4 = Nothing mySQL="UPDATE Decision SET " mySQL=mySQL & " worst = " & worst mySQL=mySQL & ", inter = " & inter mySQL=mySQL & ", best = " & best set rsEdit5=Conn.execute(mySQL) set rsEdit5 = Nothing '****************** conditional marginal probability distribution (Cost) ******************* cost_h_cs = C_11 * C_11_h + C_16 * C_16_h cost_m_cs = C_11 * C_11_m + C_16 * C_16_m cost_l_cs = C_11 * C_11_l + C_16 * C_16_l cost_h_us = U_11 * U_11_h + U_16 * U_16_h cost_m_us = U_11 * U_11_m + U_16 * U_16_m cost_l_us = U_11 * U_11_l + U_16 * U_16_l '****************** conditional marginal probability distribution (Env) ******************* env_h_cs = C_11 * C_11_h_e + C_16 * C_16_h_e env_m_cs = C_11 * C_11_m_e + C_16 * C_16_m_e env_l_cs = C_11 * C_11_l_e + C_16 * C_16_l_e env_h_us = U_11 * U_11_h_e + U_16 * U_16_h_e env_m_us = U_11 * U_11_m_e + U_16 * U_16_m_e env_l_us = U_11 * U_11_l_e + U_16 * U_16_l_e '****************** conditional marginal probability distribution (when cost=fixed) ******************* '****************** conditional marginal probability distribution (CS) ******************* time_11_h_cs = C_11_h*C_11/cost_h_cs time_16_h_cs = C_16_h*C_16/cost_h_cs env_h_cs1 = time_11_h_cs * C_11_h_e + time_16_h_cs * C_16_h_e env_m_cs1 = time_11_h_cs * C_11_m_e + time_16_h_cs * C_16_m_e env_l_cs1 = time_11_h_cs * C_11_l_e + time_16_h_cs * C_16_l_e time_11_m_cs = C_11_m*C_11/cost_m_cs time_16_m_cs = C_16_m*C_16/cost_m_cs env_h_cs2 = time_11_m_cs * C_11_h_e + time_16_m_cs * C_16_h_e env_m_cs2 = time_11_m_cs * C_11_m_e + time_16_m_cs * C_16_m_e env_l_cs2 = time_11_m_cs * C_11_l_e + time_16_m_cs * C_16_l_e time_11_l_cs = C_11_l*C_11/cost_l_cs time_16_l_cs = C_16_l*C_16/cost_l_cs env_h_cs3 = time_11_l_cs * C_11_h_e + time_16_l_cs * C_16_h_e env_m_cs3 = time_11_l_cs * C_11_m_e + time_16_l_cs * C_16_m_e env_l_cs3 = time_11_l_cs * C_11_l_e + time_16_l_cs * C_16_l_e '****************** conditional marginal probability distribution (US) ******************* time_11_h_us = U_11_h*U_11/cost_h_us time_16_h_us = U_16_h*U_16/cost_h_us env_h_us1 = time_11_h_us * U_11_h_e + time_16_h_us * U_16_h_e env_m_us1 = time_11_h_us * U_11_m_e + time_16_h_us * U_16_m_e env_l_us1 = time_11_h_us * U_11_l_e + time_16_h_us * U_16_l_e time_11_m_us = U_11_m*U_11/cost_m_us time_16_m_us = U_16_m*U_16/cost_m_us env_h_us2 = time_11_m_us * U_11_h_e + time_16_m_us * U_16_h_e env_m_us2 = time_11_m_us * U_11_m_e + time_16_m_us * U_16_m_e env_l_us2 = time_11_m_us * U_11_l_e + time_16_m_us * U_16_l_e time_11_l_us = U_11_l*U_11/cost_l_us time_16_l_us = U_16_l*U_16/cost_l_us env_h_us3 = time_11_l_us * U_11_h_e + time_16_l_us * U_16_h_e env_m_us3 = time_11_l_us * U_11_m_e + time_16_l_us * U_16_m_e env_l_us3 = time_11_l_us * U_11_l_e + time_16_l_us * U_16_l_e '****************** conditional marginal probability distribution (consequences) ******************* consequence_w_cs = hh_w*cost_h_cs*env_h_cs1+hm_w*cost_h_cs*env_m_cs1+hl_w*cost_h_cs*env_l_cs1+mh_w*cost_m_cs*env_h_cs2+mm_w*cost_m_cs*env_m_cs2+ml_w*cost_m_cs*env_l_cs2+lh_w*cost_l_cs*env_h_cs3+lm_w*cost_l_cs*env_m_cs3+ll_w*cost_l_cs*env_l_cs3 consequence_i_cs = hh_i*cost_h_cs*env_h_cs1+hm_i*cost_h_cs*env_m_cs1+hl_i*cost_h_cs*env_l_cs1+mh_i*cost_m_cs*env_h_cs2+mm_i*cost_m_cs*env_m_cs2+ml_i*cost_m_cs*env_l_cs2+lh_i*cost_l_cs*env_h_cs3+lm_i*cost_l_cs*env_m_cs3+ll_i*cost_l_cs*env_l_cs3 consequence_b_cs = hh_b*cost_h_cs*env_h_cs1+hm_b*cost_h_cs*env_m_cs1+hl_b*cost_h_cs*env_l_cs1+mh_b*cost_m_cs*env_h_cs2+mm_b*cost_m_cs*env_m_cs2+ml_b*cost_m_cs*env_l_cs2+lh_b*cost_l_cs*env_h_cs3+lm_b*cost_l_cs*env_m_cs3+ll_b*cost_l_cs*env_l_cs3 consequence_w_us = hh_w*cost_h_us*env_h_us1+hm_w*cost_h_us*env_m_us1+hl_w*cost_h_us*env_l_us1+mh_w*cost_m_us*env_h_us2+mm_w*cost_m_us*env_m_us2+ml_w*cost_m_us*env_l_us2+lh_w*cost_l_us*env_h_us3+lm_w*cost_l_us*env_m_us3+ll_w*cost_l_us*env_l_us3 consequence_i_us = hh_i*cost_h_us*env_h_us1+hm_i*cost_h_us*env_m_us1+hl_i*cost_h_us*env_l_us1+mh_i*cost_m_us*env_h_us2+mm_i*cost_m_us*env_m_us2+ml_i*cost_m_us*env_l_us2+lh_i*cost_l_us*env_h_us3+lm_i*cost_l_us*env_m_us3+ll_i*cost_l_us*env_l_us3 consequence_b_us = hh_b*cost_h_us*env_h_us1+hm_b*cost_h_us*env_m_us1+hl_b*cost_h_us*env_l_us1+mh_b*cost_m_us*env_h_us2+mm_b*cost_m_us*env_m_us2+ml_b*cost_m_us*env_l_us2+lh_b*cost_l_us*env_h_us3+lm_b*cost_l_us*env_m_us3+ll_b*cost_l_us*env_l_us3 'response.write consequence_w_us decision_index_cs = consequence_w_cs*worst + consequence_i_cs*inter + consequence_b_cs*best decision_index_us = consequence_w_us*worst + consequence_i_us*inter + consequence_b_us*best end if %>

Bayesian Artificial Intelligence

- Bayesian Decision Network

Possible Systems (S)
1. Conventional system (CS)
2. Unconventional system (US)

- Input Discrete Probability Values

Drilling time (T) P(T|S)
Drilling systems CS US
11 days "> ">
16 days "> ">

Total cost (DC) P(DC|T,S)
Drilling systems CS US
Drilling time 11 days 16 days 11 days 16 days
High "> "> "> ">
Moderate "> "> "> ">
Low "> "> "> ">

Environmental impact (DE) P(DE|T,S)
Drilling systems CS US
Drilling time 11 days 16 days 11 days 16 days
High "> "> "> ">
Moderate "> "> "> ">
Low "> "> "> ">

Consequences (C) P(C|DC, DE)
Total cost High Moderate Low
Environmental impact High Moderate Low High Moderate Low High Moderate Low
Worst "> "> "> "> "> "> "> "> ">
Intermediate "> "> "> "> "> "> "> "> ">
Best "> "> "> "> "> "> "> "> ">

Consequences Worst Intermediate Best
Utility value, U(C) "> "> ">

- Conditional Marginal Probability Distributions

Total cost P(DC|S)
Drilling systems CS US
High <%=round(cost_h_cs,3)%> <%=round(cost_h_us,3)%>
Moderate <%=round(cost_m_cs,3)%> <%=round(cost_m_us,3)%>
Low <%=round(cost_l_cs,3)%> <%=round(cost_l_us,3)%>
Environmental impact P(DE|S)
Drilling systems CS US
High <%=round(env_h_cs,3)%> <%=round(env_h_us,3)%>
Moderate <%=round(env_m_cs,3)%> <%=round(env_m_us,3)%>
Low <%=round(env_l_cs,3)%> <%=round(env_l_us,3)%>
Consequences P(C|S)
Drilling systems CS US
Worst <%=round(consequence_w_cs,3)%> <%=round(consequence_w_us,3)%>
Intermediate <%=round(consequence_i_cs,3)%> <%=round(consequence_i_us,3)%>
Best <%=round(consequence_b_cs,3)%> <%=round(consequence_b_us,3)%>
<% if decision_index_cs > decision_index_us then %> <%else%> <%end if%>
Drilling systems CS US
Decision Risk Index <%=round(decision_index_cs,3)%> <%=round(decision_index_us,3)%> <%=round(decision_index_cs,3)%> <%=round(decision_index_us,3)%>