Home > src > BN_pol_rec > Hsand > makeNewDBN_Cell.m

makeNewDBN_Cell

PURPOSE ^

SYNOPSIS ^

function [DBN_Mx_Cell, soft_ev_cell] = makeNewDBN_Cell

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 
0002 
0003 function [DBN_Mx_Cell, soft_ev_cell] = makeNewDBN_Cell
0004                 
0005 load namesOfNodes;
0006 N = ObsFormation13 ;
0007 soft_ev_cell = cell(1,N);
0008 
0009 unit_grph = zeros(N,N);
0010 unit_grph(Prev_Discovered, Discovered) = 1;
0011 unit_grph(Prev_PolicyCompany, PolicyCompany) = 1;
0012 unit_grph(Prev_PolicyPlatoon1, PolicyPlatoon1) = 1;
0013 unit_grph(Prev_PolicyPlatoon2, PolicyPlatoon2) = 1;
0014 unit_grph(Prev_PolicyPlatoon3, PolicyPlatoon3) = 1;
0015 unit_grph(Prev_Formation21, Formation21) = 1;
0016 unit_grph(ForceBalance, PolicyCompany) = 1;
0017 unit_grph(Visibility,Discovered) = 1;
0018 unit_grph(Distance, Discovered) = 1;
0019 unit_grph(Discovered, PolicyCompany) = 1;
0020 unit_grph(PolicyCompany, Formation21) = 1;
0021 unit_grph(PolicyCompany, PolicyPlatoon1) = 1;
0022 unit_grph(PolicyCompany, PolicyPlatoon2) = 1;
0023 unit_grph(PolicyCompany, PolicyPlatoon3) = 1;
0024 %---- Platoon one -----------
0025 %<-----------------------CHANGE------------------------------------------
0026 unit_grph(PolicyPlatoon1, PlatoonDirection11) = 1;
0027 unit_grph(PolicyPlatoon1, Time11) = 1;
0028 unit_grph(PolicyPlatoon1, costChange11) = 1;
0029 %------------------------------------------------------------------------>
0030 unit_grph(T1, JM1) = 1;
0031 unit_grph(T2, JM1) = 1;
0032 unit_grph(T3, JM1) = 1;
0033 unit_grph(JM1, P1atoon1Manuverability ) = 1;
0034 unit_grph(Carrying, P1atoon1Manuverability) = 1;
0035 unit_grph(PolicyPlatoon1 , Formation11) = 1;
0036 unit_grph(PolicyPlatoon1, DirOfGuns1) = 1;
0037 unit_grph(Formation11, Velocity1) = 1;
0038 unit_grph(Cover, Formation11) = 1;
0039 unit_grph(P1atoon1Manuverability, Formation11 ) = 1;
0040 unit_grph(Formation11, ObsFormation11) = 1;
0041 %---- Platoon two -------------
0042 %<-----------------------CHANGE------------------------------------------
0043 unit_grph(PolicyPlatoon2, PlatoonDirection12) = 1;
0044 unit_grph(PolicyPlatoon2, Time12) = 1;
0045 unit_grph(PolicyPlatoon2, costChange12) = 1;
0046 %------------------------------------------------------------------------>
0047 unit_grph(T4, JM2) = 1;
0048 unit_grph(T5, JM2) = 1;
0049 unit_grph(T6, JM2) = 1;
0050 unit_grph(JM2, P1atoon1Manuverability2 ) = 1;
0051 unit_grph(Carrying2, P1atoon1Manuverability2) = 1;
0052 unit_grph(PolicyPlatoon2 , Formation12) = 1;
0053 unit_grph(PolicyPlatoon2, DirOfGuns2) = 1;
0054 unit_grph(Formation12, Velocity2) = 1;
0055 unit_grph(Cover2, Formation12) = 1;
0056 unit_grph(P1atoon1Manuverability2, Formation12 ) = 1;
0057 unit_grph(Formation12, ObsFormation12) = 1;
0058 %---- Platoon three -----------
0059 %<-----------------------CHANGE------------------------------------------
0060 unit_grph(PolicyPlatoon3, PlatoonDirection13) = 1;
0061 unit_grph(PolicyPlatoon3, Time13) = 1;
0062 unit_grph(PolicyPlatoon3, costChange13) = 1;
0063 %------------------------------------------------------------------------>
0064 unit_grph(T7, JM3) = 1;
0065 unit_grph(T8, JM3) = 1;
0066 unit_grph(T9, JM3) = 1;
0067 unit_grph(JM3, P1atoon1Manuverability3 ) = 1;
0068 unit_grph(Carrying3, P1atoon1Manuverability3) = 1;
0069 unit_grph(PolicyPlatoon3 , Formation13) = 1;
0070 unit_grph(PolicyPlatoon3, DirOfGuns3) = 1;
0071 unit_grph(Formation13, Velocity3) = 1;
0072 unit_grph(Cover3, Formation13) = 1;
0073 unit_grph(P1atoon1Manuverability3, Formation13 ) = 1;
0074 unit_grph(Formation13, ObsFormation13) = 1;
0075 %-------------------------------------------
0076 dag = unit_grph;
0077 node_sizes = [2 5 4 4 4 4 3 3 2 2 5 4 4 4 4 3 2 2 2 2 2 2 2 4 3 3 2 3 4 3 2 2 2 2 2 2 2 4 3 3 2 3 4 3 2 2 2 2 2 2 2 4 3 3 2 3 4]; 
0078 
0079 bnet = mk_bnet(dag, node_sizes);
0080 %draw_graph(bnet.dag);
0081 %--------------------------------------------------------------------------
0082 %  Formulate CPD
0083 %----------------------------------------------------------------------------
0084   
0085   % Start values for time dependent variables
0086   bnet.CPD{Prev_Discovered} = tabular_CPD(bnet, Prev_Discovered, [0.5 0.5]);
0087   bnet.CPD{Prev_PolicyCompany} = tabular_CPD(bnet, Prev_PolicyCompany, [0.2 0.2 0.2 0.2 0.2]);
0088   bnet.CPD{Prev_PolicyPlatoon1} = tabular_CPD(bnet, Prev_PolicyPlatoon1, [0.25 0.25 0.25 0.25]);
0089   bnet.CPD{Prev_PolicyPlatoon2} = tabular_CPD(bnet, Prev_PolicyPlatoon2, [0.25 0.25 0.25 0.25]); 
0090   bnet.CPD{Prev_PolicyPlatoon3} = tabular_CPD(bnet, Prev_PolicyPlatoon3, [0.25 0.25 0.25 0.25]);
0091   bnet.CPD{Prev_Formation21} = tabular_CPD(bnet, Prev_Formation21, [0.25 0.25 0.25 0.25]);
0092   
0093   % Input nodes
0094   bnet.CPD{ForceBalance} = tabular_CPD(bnet, ForceBalance, [0.33 0.34 0.33]);
0095   bnet.CPD{Distance} = tabular_CPD(bnet, Distance, [0.33 0.34 0.33]);
0096   bnet.CPD{Visibility} = tabular_CPD(bnet, Visibility , [0.5 0.5]);
0097   
0098   % Inference nodes
0099   bnet.CPD{Discovered} = tabular_CPD(bnet, Discovered, [0.99 0.8 0.9 0.65 0.8 0.4 0.9 0.7 0.8 0.4 0.6 0.15 0.01 0.2 0.1 0.35 0.2 0.6 0.1 0.3 0.2 0.6 0.4 0.8]);
0100   attackFrontal = [0.75 0.37 0.25 0.2 0.5 0.455 0.24 0.24 0.19 0.25 0.2 0.1 0.1 0.1 0.1 0.4 0.1 0.1 0.05 0.1 0.25 0.1 0.05 0.05 0.05 0.1 0.05 0.05 0.05 0.02];
0101   attackFrontFlange = [ 0.21 0.585 0.23 0.295 0.2 0.25 0.44 0.165 0.19 0.35 0.1 0.2 0.1 0.1 0.1 0.1 0.4 0.1 0.05 0.1 0.15 0.25 0.05 0.05 0.05 0.05 0.1 0.05 0.05 0.05];
0102   delayBat = [0.03 0.03 0.5 0.2 0.1 0.15 0.165 0.44 0.25 0.18 0.495 0.495 0.595 0.395 0.3 0.13 0.13 0.3 0.1 0.1 0.17 0.12 0.3 0.1 0.1 0.27 0.27 0.3 0.2 0.08];
0103   defence = [0.005 0.01 0.015 0.3 0.1 0.14 0.15 0.15 0.35 0.12 0.2 0.2 0.2 0.4 0.2 0.07 0.07 0.1 0.6 0.1 0.13 0.13 0.1 0.3 0.1 0.28 0.28 0.2 0.3 0.1];
0104   march = [0.005 0.005 0.005 0.005 0.1 0.005 0.005 0.005 0.02 0.1 0.005 0.005 0.005 0.005 0.3 0.3 0.3 0.4 0.2 0.6 0.3 0.4 0.5 0.5 0.7 0.3 0.3 0.4 0.4 0.75];
0105   bnet.CPD{PolicyCompany} = tabular_CPD(bnet, PolicyCompany, [attackFrontal attackFrontFlange delayBat defence march]);
0106   leadComp = [ 0.2 0.1 0.01 0.01 0.05 0.01 0.03 0.01 0.05 0.1 0.01 0.01 0.1 0.05 0.01 0.01 0.8 0.4 0.7 0.5];
0107   compactComp = [0.1 0.2 0.05 0.01 0.01 0.15 0.01 0.01 0.1 0.3 0.01 0.01 0.1 0.1 0.2 0.05 0.1 0.2 0.01 0.01];
0108   spreadComp = [0.3 0.4 0.24 0.1 0.39 0.6 0.7 0.1 0.4 0.4 0.55 0.43 0.5 0.55 0.29 0.3 0.07 0.3 0.24 0.4];
0109   verySpreadComp = [0.4 0.3 0.7 0.88 0.55 0.24 0.26 0.88 0.45 0.2 0.43 0.55 0.3 0.3 0.5 0.64 0.03 0.1 0.05 0.09];  
0110   bnet.CPD{Formation21} = tabular_CPD(bnet, Formation21, [leadComp compactComp spreadComp verySpreadComp]);
0111   attack_pl = [0.95 0.88 0.93 0.9 0.87 0.74 0.69 0.8 0.5 0.45 0.3 0.35 0.4 0.1 0.05 0.01 0.15 0.01 0.01 0.01];
0112   defend_pl =[0.02 0.1 0.01 0.06 0.07 0.1 0.01 0.1 0.4 0.45 0.3 0.25 0.49 0.7 0.79 0.85 0.05 0.2 0.05 0.01];
0113   reconn_pl = [0.02 0.01 0.05 0.01 0.05 0.15 0.25 0.03 0.05 0.05 0.33 0.3 0.1 0.13 0.15 0.1 0.25 0.29 0.4 0.15];
0114   march_pl = [0.01 0.01 0.01 0.03 0.01 0.01 0.05 0.07 0.05 0.05 0.07 0.1 0.01 0.07 0.01 0.04 0.55 0.5 0.54 0.83];
0115   bnet.CPD{PolicyPlatoon1} = tabular_CPD(bnet,PolicyPlatoon1 , [attack_pl defend_pl reconn_pl march_pl]);
0116   bnet.CPD{PolicyPlatoon2} = tabular_CPD(bnet,PolicyPlatoon2 , [attack_pl defend_pl reconn_pl march_pl]);
0117   bnet.CPD{PolicyPlatoon3} = tabular_CPD(bnet,PolicyPlatoon3 , [attack_pl defend_pl reconn_pl march_pl]);
0118   
0119   %----------------------------------------------Platoon one ------
0120   % Input nodes
0121   bnet.CPD{DirOfGuns1} = tabular_CPD(bnet, DirOfGuns1, [0.25 0.25 0.33 0.1 0.7 0.5 0.34 0.8 0.05 0.25 0.33 0.1]);
0122   bnet.CPD{T1} = tabular_CPD(bnet, T1, [0.5 0.5]);
0123   bnet.CPD{T2} = tabular_CPD(bnet, T2, [0.5 0.5]);
0124   bnet.CPD{T3} = tabular_CPD(bnet, T3, [0.5 0.5]);
0125   
0126   % Inference node
0127   bnet.CPD{JM1} = tabular_CPD(bnet, JM1 , [0.99 0.66 0.66 0.34 0.66 0.34 0.34 0.1 0.01 0.34 0.34 0.66 0.34 0.66 0.66 0.9]);
0128   
0129    % Input nodes
0130   bnet.CPD{Carrying} = tabular_CPD(bnet,Carrying , [0.5 0.5]);
0131   bnet.CPD{Cover} = tabular_CPD(bnet, Cover, [0.5 0.5]);
0132   
0133   
0134   % Inference nodes
0135   bnet.CPD{P1atoon1Manuverability} = tabular_CPD(bnet, P1atoon1Manuverability, [0.99 0.2 0.8 0.08 0.01 0.8 0.2 0.992]);
0136   lead_pl = [0.15 0.15 0.35 0.5 0.1 0.1 0.3 0.4 0.2 0.2 0.3 0.4 0.2 0.2 0.2 0.4];
0137   battleLine_pl = [0.5 0.35 0.2 0.11 0.6 0.4 0.3 0.2 0.4 0.3 0.13 0.15 0.3 0.2 0.4 0.15];
0138   stare_pl = [0.2 0.35 0.25 0.21 0.1 0.35 0.35 0.2 0.2 0.3 0.47 0.15 0.2 0.5 0.2 0.25];
0139   triangle_pl = [0.15 0.15 0.2 0.18 0.2 0.15 0.05 0.2 0.2 0.2 0.1 0.3 0.3 0.1 0.2 0.2];
0140   bnet.CPD{Formation11} = tabular_CPD(bnet, Formation11 , [lead_pl battleLine_pl stare_pl triangle_pl]);
0141   bnet.CPD{Velocity1} = tabular_CPD(bnet, Velocity1, [0.8 0.05 0.4 0.5 0.15 0.15 0.4 0.3 0.05 0.8 0.2 0.2]);
0142   bnet.CPD{PlatoonDirection11} = tabular_CPD(bnet,PlatoonDirection11, [0.5 0.2 0.3 0.3 0.3 0.3 0.4 0.5 0.2 0.5 0.3 0.2]);
0143   bnet.CPD{Time11} = tabular_CPD(bnet,Time11, [0.8 0.5 0.7 0.3 0.2 0.5 0.3 0.7]);
0144   bnet.CPD{costChange11} = tabular_CPD(bnet,costChange11, [0.5 0.2 0.3 0.3 0.3 0.3 0.4 0.5 0.2 0.5 0.3 0.2]);
0145   
0146   %Observation nodes
0147    bnet.CPD{ObsFormation11} = tabular_CPD(bnet, ObsFormation11, [0.8 0.01 0.1 0.1 0.01 0.8 0.2 0.01 0.09 0.09 0.69 0.2 0.1 0.1 0.01 0.69]);
0148  %----------------------------------------------Platoon two ------
0149    bnet.CPD{DirOfGuns2} = tabular_CPD(bnet, DirOfGuns2, [0.25 0.25 0.33 0.1 0.7 0.5 0.34 0.8 0.05 0.25 0.33 0.1]);
0150   bnet.CPD{T4} = tabular_CPD(bnet, T4, [0.5 0.5]);
0151   bnet.CPD{T5} = tabular_CPD(bnet, T5, [0.5 0.5]);
0152   bnet.CPD{T6} = tabular_CPD(bnet, T6, [0.5 0.5]);
0153   
0154   % Inference node
0155   bnet.CPD{JM2} = tabular_CPD(bnet, JM2 , [0.99 0.66 0.66 0.34 0.66 0.34 0.34 0.1 0.01 0.34 0.34 0.66 0.34 0.66 0.66 0.9]);
0156   
0157    % Input nodes
0158   bnet.CPD{Carrying2} = tabular_CPD(bnet,Carrying2 , [0.5 0.5]);
0159   bnet.CPD{Cover2} = tabular_CPD(bnet, Cover2, [0.5 0.5]);
0160   
0161   
0162   % Inference nodes
0163   bnet.CPD{P1atoon1Manuverability2} = tabular_CPD(bnet, P1atoon1Manuverability2, [0.99 0.2 0.8 0.08 0.01 0.8 0.2 0.992]);
0164   bnet.CPD{Formation12} = tabular_CPD(bnet, Formation12 , [lead_pl battleLine_pl stare_pl triangle_pl]);
0165   bnet.CPD{Velocity2} = tabular_CPD(bnet,Velocity2  , [0.8 0.05 0.4 0.5 0.15 0.15 0.4 0.3 0.05 0.8 0.2 0.2]);
0166   bnet.CPD{PlatoonDirection12} = tabular_CPD(bnet,PlatoonDirection12, [0.5 0.2 0.3 0.3 0.3 0.3 0.4 0.5 0.2 0.5 0.3 0.2]);
0167   bnet.CPD{Time12} = tabular_CPD(bnet,Time12, [0.8 0.5 0.7 0.3 0.2 0.5 0.3 0.7]);
0168   bnet.CPD{costChange12} = tabular_CPD(bnet,costChange12, [0.5 0.2 0.3 0.3 0.3 0.3 0.4 0.5 0.2 0.5 0.3 0.2]);
0169   
0170   %Observation nodes
0171    bnet.CPD{ObsFormation12} = tabular_CPD(bnet, ObsFormation12, [0.8 0.01 0.1 0.1 0.01 0.8 0.2 0.01 0.09 0.09 0.69 0.2 0.1 0.1 0.01 0.69]);
0172   %----------------------------------------------Platoon three ------
0173     bnet.CPD{DirOfGuns3} = tabular_CPD(bnet, DirOfGuns3, [0.25 0.25 0.33 0.1 0.7 0.5 0.34 0.8 0.05 0.25 0.33 0.1]);
0174   bnet.CPD{T7} = tabular_CPD(bnet, T7, [0.5 0.5]);
0175   bnet.CPD{T8} = tabular_CPD(bnet, T8, [0.5 0.5]);
0176   bnet.CPD{T9} = tabular_CPD(bnet, T9, [0.5 0.5]);
0177   
0178   % Inference node
0179   bnet.CPD{JM3} = tabular_CPD(bnet, JM3 , [0.99 0.66 0.66 0.34 0.66 0.34 0.34 0.1 0.01 0.34 0.34 0.66 0.34 0.66 0.66 0.9]);
0180   
0181    % Input nodes
0182   bnet.CPD{Carrying3} = tabular_CPD(bnet,Carrying3 , [0.5 0.5]);
0183   bnet.CPD{Cover3} = tabular_CPD(bnet, Cover3, [0.5 0.5]);
0184   
0185   
0186   % Inference nodes
0187   bnet.CPD{P1atoon1Manuverability3} = tabular_CPD(bnet, P1atoon1Manuverability3, [0.99 0.2 0.8 0.08 0.01 0.8 0.2 0.992]);
0188   bnet.CPD{Formation13} = tabular_CPD(bnet, Formation13 , [lead_pl battleLine_pl stare_pl triangle_pl]);
0189   bnet.CPD{Velocity3} = tabular_CPD(bnet,Velocity3  , [0.8 0.05 0.4 0.5 0.15 0.15 0.4 0.3 0.05 0.8 0.2 0.2]);
0190   bnet.CPD{PlatoonDirection13} = tabular_CPD(bnet,PlatoonDirection13, [0.5 0.2 0.3 0.3 0.3 0.3 0.4 0.5 0.2 0.5 0.3 0.2]);
0191   bnet.CPD{Time13} = tabular_CPD(bnet,Time13, [0.8 0.5 0.7 0.3 0.2 0.5 0.3 0.7]);
0192   bnet.CPD{costChange13} = tabular_CPD(bnet,costChange13, [0.5 0.2 0.3 0.3 0.3 0.3 0.4 0.5 0.2 0.5 0.3 0.2]);
0193   
0194   %Observation nodes
0195    bnet.CPD{ObsFormation13} = tabular_CPD(bnet, ObsFormation13, [0.8 0.01 0.1 0.1 0.01 0.8 0.2 0.01 0.09 0.09 0.69 0.2 0.1 0.1 0.01 0.69]);
0196 
0197   DBN_Mx_Cell = bnet;
0198   DBN_Mx_Cell;
0199   
0200

Generated on Wed 16-Mar-2005 09:17:47 by m2html © 2003