← Documentation
ADS-IDAC Engine 5.0.0
HumanFailureEventsBBN.cpp
Go to the documentation of this file.
2#include <boost/serialization/export.hpp>
3
4#ifdef ENABLE_HCL
5#include "../../HCL/smile/smile.h"
6#else
10#endif
11#include<iostream>
12#include <boost/archive/binary_oarchive.hpp>
13#include <boost/archive/binary_iarchive.hpp>
14BOOST_CLASS_EXPORT_IMPLEMENT(HumanFailureEventsBBN)
15using namespace std;
16
19 information_load = 0.0;
23 task_complexity = 0.0;
24 expertise = 0.0;
25 stress = 0.0;
26 fatigue = 0.0;
28 // Deterministic cached posteriors until the first inference fills them.
30 gather_info_mode = 0.0;
32 gather_new_info = 0.0;
33 diagnosis = 0.0;
35 goal_selection = 0.0;
39 mental_procedure = 0.0;
41 procedure_step = 0.0;
42 maneuver_action = 0.0;
43
44#ifdef ENABLE_HCL
46
47 gather_state_info = getFailurePosteriorProbability(net, gatherStateInfoNode);
48 gather_info_mode = getFailurePosteriorProbability(net, gatherInfoModeNode);
49 perceive_state_info = getFailurePosteriorProbability(net, perceiveStateInfoNode);
50 gather_new_info = getFailurePosteriorProbability(net, gatherNewInfoNode);
51 diagnosis = getFailurePosteriorProbability(net, diagnosisNode);
52 strategy_selection = getFailurePosteriorProbability(net, strategySelectionNode);
53 goal_selection = getFailurePosteriorProbability(net, goalSelectionNode);
54 strategy_communication = getFailurePosteriorProbability(net, strategyCommunicationNode);
55 goal_communication = getFailurePosteriorProbability(net, goalCommunicationNode);
56 procedure_transfer = getFailurePosteriorProbability(net, procedureTransferNode);
57 mental_procedure = getFailurePosteriorProbability(net, mentalProcedureNode);
58 procedure_interpretation = getFailurePosteriorProbability(net, procedureInterpretationNode);
59 procedure_step = getFailurePosteriorProbability(net, procedureStepNode);
60 maneuver_action = getFailurePosteriorProbability(net, maneuverActionNode);
61#else
62 // Posteriors are computed lazily on first getter access (the getters check
63 // needs_update_). RestartNodeInfo holds two of these objects per branch
64 // point and never reads posteriors, so an eager calibration here would
65 // build a throwaway junction-tree workspace on every construction.
66 needs_update_ = true;
68#endif
69}
70
72
73}
74
75#ifdef ENABLE_HCL
77
78 const char *SYSTEM_CRITICALITY[] = {"Present", "Absent", NULL};
79 systemCriticalityNode =
80 CreateCptNode(net, "SystemCriticality", "State of System Criticality", SYSTEM_CRITICALITY, 100, 150);
81 const char *INFORMATION_LOAD[] = {"Present", "Absent", NULL};
82 informationLoadNode = CreateCptNode(net, "InformationLoad", "State of Information Load", INFORMATION_LOAD, 200, 150);
83 const char *TIME_CONSTRAINT_LOAD[] = {"Present", "Absent", NULL};
84 timeConstraintLoadNode =
85 CreateCptNode(net, "TimeConstraintLoad", "State of Time Constraint Load", TIME_CONSTRAINT_LOAD, 300, 150);
86 const char *COGNITIVE_TASK_LOAD[] = {"Present", "Absent", NULL};
87 cognitiveTaskLoadNode =
88 CreateCptNode(net, "CognitiveTaskLoad", "State of Cognitive Task Load", COGNITIVE_TASK_LOAD, 400, 150);
89 const char *PASSIVE_ALARM_LOAD[] = {"Present", "Absent", NULL};
90 passiveAlarmLoadNode =
91 CreateCptNode(net, "PassiveAlarmLoad", "State of Passive Alarm Load", PASSIVE_ALARM_LOAD, 500, 150);
92 const char *TASK_COMPLEXITY[] = {"Present", "Absent", NULL};
93 taskComplexityNode = CreateCptNode(net, "TaskComplexity", "State of Task Complexity", TASK_COMPLEXITY, 600, 150);
94 const char *EXPERTISE[] = {"Low", "High", NULL};
95 expertiseNode = CreateCptNode(net, "Expertise", "State of Expertise", EXPERTISE, 700, 150);
96 const char *STRESS[] = {"Present", "Absent", NULL};
97 stressNode = CreateCptNode(net, "Stress", "State of Stress", STRESS, 800, 150);
98 const char *FATIGUE[] = {"Present", "Absent", NULL};
99 fatigueNode = CreateCptNode(net, "Fatigue", "State of Fatigue", FATIGUE, 900, 150);
100 const char *PROBLEM_SOLVING_STYLE[] = {"Poor", "Best", NULL};
101 problemSolvingStyleNode =
102 CreateCptNode(net, "ProblemSolvingStyle", "State of Problem Solving Style", PROBLEM_SOLVING_STYLE, 1000, 150);
103
104 const char *OUTCOMES[] = {"Failure", "Success", NULL};
105 gatherStateInfoNode = CreateNoisyMaxNode(net, "GatherStateInfo", "Gather State Info", OUTCOMES, 210, 350);
106 gatherInfoModeNode = CreateNoisyMaxNode(net, "GatherInfoMode", "Gather Info Mode", OUTCOMES, 230, 450);
107 perceiveStateInfoNode = CreateNoisyMaxNode(net, "PerceiveStateInfo", "Perceive State Info", OUTCOMES, 350, 350);
108 gatherNewInfoNode = CreateNoisyMaxNode(net, "GatherNewInfo", "Gather New Info", OUTCOMES, 350, 430);
109 diagnosisNode = CreateNoisyMaxNode(net, "Diagnosis", "Diagnosis", OUTCOMES, 570, 350);
110 strategySelectionNode = CreateNoisyMaxNode(net, "StrategySelection", "Strategy Selection", OUTCOMES, 710, 350);
111 goalSelectionNode = CreateNoisyMaxNode(net, "GoalSelection", "Goal Selection", OUTCOMES, 840, 350);
112 strategyCommunicationNode =
113 CreateNoisyMaxNode(net, "StrategyCommunication", "Strategy Communication", OUTCOMES, 570, 450);
114 goalCommunicationNode = CreateNoisyMaxNode(net, "GoalCommunication", "Goal Communication", OUTCOMES, 730, 450);
115 procedureTransferNode = CreateNoisyMaxNode(net, "ProcedureTransfer", "Procedure Transfer", OUTCOMES, 870, 450);
116 mentalProcedureNode = CreateNoisyMaxNode(net, "MentalProcedure", "Mental Procedure", OUTCOMES, 1100, 350);
117 procedureInterpretationNode =
118 CreateNoisyMaxNode(net, "ProcedureInterpretation", "Procedure Interpretation", OUTCOMES, 1200, 350);
119 procedureStepNode = CreateNoisyMaxNode(net, "ProcedureStep", "Procedure Step", OUTCOMES, 1100, 450);
120 maneuverActionNode = CreateNoisyMaxNode(net, "ManeuverAction", "Maneuver Action", OUTCOMES, 1250, 450);
121
122 net.AddArc(systemCriticalityNode, gatherStateInfoNode);
123 net.AddArc(systemCriticalityNode, gatherInfoModeNode);
124 net.AddArc(systemCriticalityNode, perceiveStateInfoNode);
125 net.AddArc(systemCriticalityNode, gatherNewInfoNode);
126 net.AddArc(systemCriticalityNode, diagnosisNode);
127 net.AddArc(systemCriticalityNode, strategySelectionNode);
128 net.AddArc(systemCriticalityNode, goalSelectionNode);
129 net.AddArc(systemCriticalityNode, strategyCommunicationNode);
130 net.AddArc(systemCriticalityNode, goalCommunicationNode);
131 net.AddArc(systemCriticalityNode, procedureTransferNode);
132 net.AddArc(systemCriticalityNode, mentalProcedureNode);
133 net.AddArc(systemCriticalityNode, procedureInterpretationNode);
134 net.AddArc(systemCriticalityNode, procedureStepNode);
135 net.AddArc(systemCriticalityNode, maneuverActionNode);
136 net.AddArc(informationLoadNode, gatherStateInfoNode);
137 net.AddArc(informationLoadNode, gatherInfoModeNode);
138 net.AddArc(informationLoadNode, perceiveStateInfoNode);
139 net.AddArc(informationLoadNode, gatherNewInfoNode);
140 net.AddArc(informationLoadNode, diagnosisNode);
141 net.AddArc(informationLoadNode, strategySelectionNode);
142 net.AddArc(informationLoadNode, goalSelectionNode);
143 net.AddArc(informationLoadNode, strategyCommunicationNode);
144 net.AddArc(informationLoadNode, goalCommunicationNode);
145 net.AddArc(informationLoadNode, procedureTransferNode);
146 net.AddArc(informationLoadNode, mentalProcedureNode);
147 net.AddArc(informationLoadNode, procedureInterpretationNode);
148 net.AddArc(informationLoadNode, procedureStepNode);
149 net.AddArc(informationLoadNode, maneuverActionNode);
150 net.AddArc(timeConstraintLoadNode, gatherStateInfoNode);
151 net.AddArc(timeConstraintLoadNode, gatherInfoModeNode);
152 net.AddArc(timeConstraintLoadNode, perceiveStateInfoNode);
153 net.AddArc(timeConstraintLoadNode, gatherNewInfoNode);
154 net.AddArc(timeConstraintLoadNode, diagnosisNode);
155 net.AddArc(timeConstraintLoadNode, strategySelectionNode);
156 net.AddArc(timeConstraintLoadNode, goalSelectionNode);
157 net.AddArc(timeConstraintLoadNode, strategyCommunicationNode);
158 net.AddArc(timeConstraintLoadNode, goalCommunicationNode);
159 net.AddArc(timeConstraintLoadNode, procedureTransferNode);
160 net.AddArc(timeConstraintLoadNode, mentalProcedureNode);
161 net.AddArc(timeConstraintLoadNode, procedureInterpretationNode);
162 net.AddArc(timeConstraintLoadNode, procedureStepNode);
163 net.AddArc(timeConstraintLoadNode, maneuverActionNode);
164 net.AddArc(cognitiveTaskLoadNode, gatherStateInfoNode);
165 net.AddArc(cognitiveTaskLoadNode, gatherInfoModeNode);
166 net.AddArc(cognitiveTaskLoadNode, perceiveStateInfoNode);
167 net.AddArc(cognitiveTaskLoadNode, gatherNewInfoNode);
168 net.AddArc(cognitiveTaskLoadNode, diagnosisNode);
169 net.AddArc(cognitiveTaskLoadNode, strategySelectionNode);
170 net.AddArc(cognitiveTaskLoadNode, goalSelectionNode);
171 net.AddArc(cognitiveTaskLoadNode, strategyCommunicationNode);
172 net.AddArc(cognitiveTaskLoadNode, goalCommunicationNode);
173 net.AddArc(cognitiveTaskLoadNode, procedureTransferNode);
174 net.AddArc(cognitiveTaskLoadNode, mentalProcedureNode);
175 net.AddArc(cognitiveTaskLoadNode, procedureInterpretationNode);
176 net.AddArc(cognitiveTaskLoadNode, procedureStepNode);
177 net.AddArc(cognitiveTaskLoadNode, maneuverActionNode);
178 net.AddArc(passiveAlarmLoadNode, gatherStateInfoNode);
179 net.AddArc(passiveAlarmLoadNode, gatherInfoModeNode);
180 net.AddArc(passiveAlarmLoadNode, perceiveStateInfoNode);
181 net.AddArc(passiveAlarmLoadNode, gatherNewInfoNode);
182 net.AddArc(passiveAlarmLoadNode, diagnosisNode);
183 net.AddArc(passiveAlarmLoadNode, strategySelectionNode);
184 net.AddArc(passiveAlarmLoadNode, goalSelectionNode);
185 net.AddArc(passiveAlarmLoadNode, strategyCommunicationNode);
186 net.AddArc(passiveAlarmLoadNode, goalCommunicationNode);
187 net.AddArc(passiveAlarmLoadNode, procedureTransferNode);
188 net.AddArc(passiveAlarmLoadNode, mentalProcedureNode);
189 net.AddArc(passiveAlarmLoadNode, procedureInterpretationNode);
190 net.AddArc(passiveAlarmLoadNode, procedureStepNode);
191 net.AddArc(passiveAlarmLoadNode, maneuverActionNode);
192 net.AddArc(taskComplexityNode, gatherStateInfoNode);
193 net.AddArc(taskComplexityNode, gatherInfoModeNode);
194 net.AddArc(taskComplexityNode, perceiveStateInfoNode);
195 net.AddArc(taskComplexityNode, gatherNewInfoNode);
196 net.AddArc(taskComplexityNode, diagnosisNode);
197 net.AddArc(taskComplexityNode, strategySelectionNode);
198 net.AddArc(taskComplexityNode, goalSelectionNode);
199 net.AddArc(taskComplexityNode, strategyCommunicationNode);
200 net.AddArc(taskComplexityNode, goalCommunicationNode);
201 net.AddArc(taskComplexityNode, procedureTransferNode);
202 net.AddArc(taskComplexityNode, mentalProcedureNode);
203 net.AddArc(taskComplexityNode, procedureInterpretationNode);
204 net.AddArc(taskComplexityNode, procedureStepNode);
205 net.AddArc(taskComplexityNode, maneuverActionNode);
206 net.AddArc(expertiseNode, gatherStateInfoNode);
207 net.AddArc(expertiseNode, gatherInfoModeNode);
208 net.AddArc(expertiseNode, perceiveStateInfoNode);
209 net.AddArc(expertiseNode, gatherNewInfoNode);
210 net.AddArc(expertiseNode, diagnosisNode);
211 net.AddArc(expertiseNode, strategySelectionNode);
212 net.AddArc(expertiseNode, goalSelectionNode);
213 net.AddArc(expertiseNode, strategyCommunicationNode);
214 net.AddArc(expertiseNode, goalCommunicationNode);
215 net.AddArc(expertiseNode, procedureTransferNode);
216 net.AddArc(expertiseNode, mentalProcedureNode);
217 net.AddArc(expertiseNode, procedureInterpretationNode);
218 net.AddArc(expertiseNode, procedureStepNode);
219 net.AddArc(expertiseNode, maneuverActionNode);
220 net.AddArc(stressNode, gatherStateInfoNode);
221 net.AddArc(stressNode, gatherInfoModeNode);
222 net.AddArc(stressNode, perceiveStateInfoNode);
223 net.AddArc(stressNode, gatherNewInfoNode);
224 net.AddArc(stressNode, diagnosisNode);
225 net.AddArc(stressNode, strategySelectionNode);
226 net.AddArc(stressNode, goalSelectionNode);
227 net.AddArc(stressNode, strategyCommunicationNode);
228 net.AddArc(stressNode, goalCommunicationNode);
229 net.AddArc(stressNode, procedureTransferNode);
230 net.AddArc(stressNode, mentalProcedureNode);
231 net.AddArc(stressNode, procedureInterpretationNode);
232 net.AddArc(stressNode, procedureStepNode);
233 net.AddArc(stressNode, maneuverActionNode);
234 net.AddArc(fatigueNode, gatherStateInfoNode);
235 net.AddArc(fatigueNode, gatherInfoModeNode);
236 net.AddArc(fatigueNode, perceiveStateInfoNode);
237 net.AddArc(fatigueNode, gatherNewInfoNode);
238 net.AddArc(fatigueNode, diagnosisNode);
239 net.AddArc(fatigueNode, strategySelectionNode);
240 net.AddArc(fatigueNode, goalSelectionNode);
241 net.AddArc(fatigueNode, strategyCommunicationNode);
242 net.AddArc(fatigueNode, goalCommunicationNode);
243 net.AddArc(fatigueNode, procedureTransferNode);
244 net.AddArc(fatigueNode, mentalProcedureNode);
245 net.AddArc(fatigueNode, procedureInterpretationNode);
246 net.AddArc(fatigueNode, procedureStepNode);
247 net.AddArc(fatigueNode, maneuverActionNode);
248 net.AddArc(problemSolvingStyleNode, gatherStateInfoNode);
249 net.AddArc(problemSolvingStyleNode, gatherInfoModeNode);
250 net.AddArc(problemSolvingStyleNode, perceiveStateInfoNode);
251 net.AddArc(problemSolvingStyleNode, gatherNewInfoNode);
252 net.AddArc(problemSolvingStyleNode, diagnosisNode);
253 net.AddArc(problemSolvingStyleNode, strategySelectionNode);
254 net.AddArc(problemSolvingStyleNode, goalSelectionNode);
255 net.AddArc(problemSolvingStyleNode, strategyCommunicationNode);
256 net.AddArc(problemSolvingStyleNode, goalCommunicationNode);
257 net.AddArc(problemSolvingStyleNode, procedureTransferNode);
258 net.AddArc(problemSolvingStyleNode, mentalProcedureNode);
259 net.AddArc(problemSolvingStyleNode, procedureInterpretationNode);
260 net.AddArc(problemSolvingStyleNode, procedureStepNode);
261 net.AddArc(problemSolvingStyleNode, maneuverActionNode);
262
263 DSL_doubleArray probabilities(2);
264 probabilities[0] = 0.0;
265 probabilities[1] = 1.0;
266 DSL_nodeDefinition *systemCriticalityDef = net.GetNode(systemCriticalityNode)->Definition();
267 systemCriticalityDef->SetDefinition(probabilities);
268 DSL_nodeDefinition *informationLoadDef = net.GetNode(informationLoadNode)->Definition();
269 informationLoadDef->SetDefinition(probabilities);
270 DSL_nodeDefinition *timeConstraintLoadDef = net.GetNode(timeConstraintLoadNode)->Definition();
271 timeConstraintLoadDef->SetDefinition(probabilities);
272 DSL_nodeDefinition *cognitiveTaskLoadDef = net.GetNode(cognitiveTaskLoadNode)->Definition();
273 cognitiveTaskLoadDef->SetDefinition(probabilities);
274 DSL_nodeDefinition *passiveAlarmLoadDef = net.GetNode(passiveAlarmLoadNode)->Definition();
275 passiveAlarmLoadDef->SetDefinition(probabilities);
276 DSL_nodeDefinition *taskComplexityDef = net.GetNode(taskComplexityNode)->Definition();
277 taskComplexityDef->SetDefinition(probabilities);
278 DSL_nodeDefinition *expertiseDef = net.GetNode(expertiseNode)->Definition();
279 expertiseDef->SetDefinition(probabilities);
280 DSL_nodeDefinition *stressDef = net.GetNode(stressNode)->Definition();
281 stressDef->SetDefinition(probabilities);
282 DSL_nodeDefinition *fatigueDef = net.GetNode(fatigueNode)->Definition();
283 fatigueDef->SetDefinition(probabilities);
284 DSL_nodeDefinition *problemSolvingStyleDef = net.GetNode(problemSolvingStyleNode)->Definition();
285 problemSolvingStyleDef->SetDefinition(probabilities);
286
287 DSL_nodeDefinition *gatherStateInfoDef = net.GetNode(gatherStateInfoNode)->Definition();
288 DSL_Dmatrix gatherStateInfoMatrix;
289 gatherStateInfoMatrix.AddDimension(21);
290 gatherStateInfoMatrix.AddDimension(2);
291 gatherStateInfoMatrix[0] = 0.0063;
292 gatherStateInfoMatrix[1] = 0.9937;
293 gatherStateInfoMatrix[2] = 0;
294 gatherStateInfoMatrix[3] = 1;
295 gatherStateInfoMatrix[4] = 0.00317;
296 gatherStateInfoMatrix[5] = 0.99683;
297 gatherStateInfoMatrix[6] = 0;
298 gatherStateInfoMatrix[7] = 1;
299 gatherStateInfoMatrix[8] = 0.0063;
300 gatherStateInfoMatrix[9] = 0.9937;
301 gatherStateInfoMatrix[10] = 0;
302 gatherStateInfoMatrix[11] = 1;
303 gatherStateInfoMatrix[12] = 0.00621;
304 gatherStateInfoMatrix[13] = 0.99379;
305 gatherStateInfoMatrix[14] = 0;
306 gatherStateInfoMatrix[15] = 1;
307 gatherStateInfoMatrix[16] = 0.00626;
308 gatherStateInfoMatrix[17] = 0.99374;
309 gatherStateInfoMatrix[18] = 0;
310 gatherStateInfoMatrix[19] = 1;
311 gatherStateInfoMatrix[20] = 0.00481;
312 gatherStateInfoMatrix[21] = 0.99519;
313 gatherStateInfoMatrix[22] = 0;
314 gatherStateInfoMatrix[23] = 1;
315 gatherStateInfoMatrix[24] = 0.0029;
316 gatherStateInfoMatrix[25] = 0.9971;
317 gatherStateInfoMatrix[26] = 0;
318 gatherStateInfoMatrix[27] = 1;
319 gatherStateInfoMatrix[28] = 0.00271;
320 gatherStateInfoMatrix[29] = 0.99729;
321 gatherStateInfoMatrix[30] = 0;
322 gatherStateInfoMatrix[31] = 1;
323 gatherStateInfoMatrix[32] = 0.00271;
324 gatherStateInfoMatrix[33] = 0.99729;
325 gatherStateInfoMatrix[34] = 0;
326 gatherStateInfoMatrix[35] = 1;
327 gatherStateInfoMatrix[36] = 0.00342;
328 gatherStateInfoMatrix[37] = 0.99658;
329 gatherStateInfoMatrix[38] = 0;
330 gatherStateInfoMatrix[39] = 1;
331 gatherStateInfoMatrix[40] = 0.001;
332 gatherStateInfoMatrix[41] = 0.999;
333 gatherStateInfoDef->SetDefinition(gatherStateInfoMatrix);
334
335 DSL_nodeDefinition *gatherInfoModeDef = net.GetNode(gatherInfoModeNode)->Definition();
336 DSL_Dmatrix gatherInfoModeMatrix;
337 gatherInfoModeMatrix.AddDimension(21);
338 gatherInfoModeMatrix.AddDimension(2);
339 gatherInfoModeMatrix[0] = 0.167;
340 gatherInfoModeMatrix[1] = 0.833;
341 gatherInfoModeMatrix[2] = 0;
342 gatherInfoModeMatrix[3] = 1;
343 gatherInfoModeMatrix[4] = 0.084;
344 gatherInfoModeMatrix[5] = 0.916;
345 gatherInfoModeMatrix[6] = 0;
346 gatherInfoModeMatrix[7] = 1;
347 gatherInfoModeMatrix[8] = 0.167;
348 gatherInfoModeMatrix[9] = 0.833;
349 gatherInfoModeMatrix[10] = 0;
350 gatherInfoModeMatrix[11] = 1;
351 gatherInfoModeMatrix[12] = 0.164;
352 gatherInfoModeMatrix[13] = 0.836;
353 gatherInfoModeMatrix[14] = 0;
354 gatherInfoModeMatrix[15] = 1;
355 gatherInfoModeMatrix[16] = 0.166;
356 gatherInfoModeMatrix[17] = 0.834;
357 gatherInfoModeMatrix[18] = 0;
358 gatherInfoModeMatrix[19] = 1;
359 gatherInfoModeMatrix[20] = 0.127;
360 gatherInfoModeMatrix[21] = 0.873;
361 gatherInfoModeMatrix[22] = 0;
362 gatherInfoModeMatrix[23] = 1;
363 gatherInfoModeMatrix[24] = 0.767;
364 gatherInfoModeMatrix[25] = 0.233;
365 gatherInfoModeMatrix[26] = 0;
366 gatherInfoModeMatrix[27] = 1;
367 gatherInfoModeMatrix[28] = 0.0718;
368 gatherInfoModeMatrix[29] = 0.9282;
369 gatherInfoModeMatrix[30] = 0;
370 gatherInfoModeMatrix[31] = 1;
371 gatherInfoModeMatrix[32] = 0.0718;
372 gatherInfoModeMatrix[33] = 0.9282;
373 gatherInfoModeMatrix[34] = 0;
374 gatherInfoModeMatrix[35] = 1;
375 gatherInfoModeMatrix[36] = 0.0905;
376 gatherInfoModeMatrix[37] = 0.9095;
377 gatherInfoModeMatrix[38] = 0;
378 gatherInfoModeMatrix[39] = 1;
379 gatherInfoModeMatrix[40] = 0.0265;
380 gatherInfoModeMatrix[41] = 0.9735;
381 gatherInfoModeDef->SetDefinition(gatherInfoModeMatrix);
382
383 DSL_nodeDefinition *perceiveStateInfoDef = net.GetNode(perceiveStateInfoNode)->Definition();
384 DSL_Dmatrix perceiveStateInfoMatrix;
385 perceiveStateInfoMatrix.AddDimension(21);
386 perceiveStateInfoMatrix.AddDimension(2);
387 perceiveStateInfoMatrix[0] = 0.0528;
388 perceiveStateInfoMatrix[1] = 0.9472;
389 perceiveStateInfoMatrix[2] = 0;
390 perceiveStateInfoMatrix[3] = 1;
391 perceiveStateInfoMatrix[4] = 0.0266;
392 perceiveStateInfoMatrix[5] = 0.9734;
393 perceiveStateInfoMatrix[6] = 0;
394 perceiveStateInfoMatrix[7] = 1;
395 perceiveStateInfoMatrix[8] = 0.0528;
396 perceiveStateInfoMatrix[9] = 0.9472;
397 perceiveStateInfoMatrix[10] = 0;
398 perceiveStateInfoMatrix[11] = 1;
399 perceiveStateInfoMatrix[12] = 0.052;
400 perceiveStateInfoMatrix[13] = 0.948;
401 perceiveStateInfoMatrix[14] = 0;
402 perceiveStateInfoMatrix[15] = 1;
403 perceiveStateInfoMatrix[16] = 0.0229;
404 perceiveStateInfoMatrix[17] = 0.9771;
405 perceiveStateInfoMatrix[18] = 0;
406 perceiveStateInfoMatrix[19] = 1;
407 perceiveStateInfoMatrix[20] = 0.0403;
408 perceiveStateInfoMatrix[21] = 0.9597;
409 perceiveStateInfoMatrix[22] = 0;
410 perceiveStateInfoMatrix[23] = 1;
411 perceiveStateInfoMatrix[24] = 0.0243;
412 perceiveStateInfoMatrix[25] = 0.9757;
413 perceiveStateInfoMatrix[26] = 0;
414 perceiveStateInfoMatrix[27] = 1;
415 perceiveStateInfoMatrix[28] = 0.0227;
416 perceiveStateInfoMatrix[29] = 0.9773;
417 perceiveStateInfoMatrix[30] = 0;
418 perceiveStateInfoMatrix[31] = 1;
419 perceiveStateInfoMatrix[32] = 0.0227;
420 perceiveStateInfoMatrix[33] = 0.9773;
421 perceiveStateInfoMatrix[34] = 0;
422 perceiveStateInfoMatrix[35] = 1;
423 perceiveStateInfoMatrix[36] = 0.0286;
424 perceiveStateInfoMatrix[37] = 0.9714;
425 perceiveStateInfoMatrix[38] = 0;
426 perceiveStateInfoMatrix[39] = 1;
427 perceiveStateInfoMatrix[40] = 0.00837;
428 perceiveStateInfoMatrix[41] = 0.99163;
429 perceiveStateInfoDef->SetDefinition(perceiveStateInfoMatrix);
430
431 DSL_nodeDefinition *gatherNewInfoDef = net.GetNode(gatherNewInfoNode)->Definition();
432 DSL_Dmatrix gatherNewInfoMatrix;
433 gatherNewInfoMatrix.AddDimension(21);
434 gatherNewInfoMatrix.AddDimension(2);
435 gatherNewInfoMatrix[0] = 0.441;
436 gatherNewInfoMatrix[1] = 0.559;
437 gatherNewInfoMatrix[2] = 0;
438 gatherNewInfoMatrix[3] = 1;
439 gatherNewInfoMatrix[4] = 0.222;
440 gatherNewInfoMatrix[5] = 0.778;
441 gatherNewInfoMatrix[6] = 0;
442 gatherNewInfoMatrix[7] = 1;
443 gatherNewInfoMatrix[8] = 0.441;
444 gatherNewInfoMatrix[9] = 0.559;
445 gatherNewInfoMatrix[10] = 0;
446 gatherNewInfoMatrix[11] = 1;
447 gatherNewInfoMatrix[12] = 0.435;
448 gatherNewInfoMatrix[13] = 0.565;
449 gatherNewInfoMatrix[14] = 0;
450 gatherNewInfoMatrix[15] = 1;
451 gatherNewInfoMatrix[16] = 0.438;
452 gatherNewInfoMatrix[17] = 0.562;
453 gatherNewInfoMatrix[18] = 0;
454 gatherNewInfoMatrix[19] = 1;
455 gatherNewInfoMatrix[20] = 0.337;
456 gatherNewInfoMatrix[21] = 0.663;
457 gatherNewInfoMatrix[22] = 0;
458 gatherNewInfoMatrix[23] = 1;
459 gatherNewInfoMatrix[24] = 0.203;
460 gatherNewInfoMatrix[25] = 0.797;
461 gatherNewInfoMatrix[26] = 0;
462 gatherNewInfoMatrix[27] = 1;
463 gatherNewInfoMatrix[28] = 0.19;
464 gatherNewInfoMatrix[29] = 0.81;
465 gatherNewInfoMatrix[30] = 0;
466 gatherNewInfoMatrix[31] = 1;
467 gatherNewInfoMatrix[32] = 0.19;
468 gatherNewInfoMatrix[33] = 0.81;
469 gatherNewInfoMatrix[34] = 0;
470 gatherNewInfoMatrix[35] = 1;
471 gatherNewInfoMatrix[36] = 0.239;
472 gatherNewInfoMatrix[37] = 0.761;
473 gatherNewInfoMatrix[38] = 0;
474 gatherNewInfoMatrix[39] = 1;
475 gatherNewInfoMatrix[40] = 0.07;
476 gatherNewInfoMatrix[41] = 0.93;
477 gatherNewInfoDef->SetDefinition(gatherNewInfoMatrix);
478
479 DSL_nodeDefinition *diagnosisDef = net.GetNode(diagnosisNode)->Definition();
480 DSL_Dmatrix diagnosisMatrix;
481 diagnosisMatrix.AddDimension(21);
482 diagnosisMatrix.AddDimension(2);
483 diagnosisMatrix[0] = 0.271;
484 diagnosisMatrix[1] = 0.729;
485 diagnosisMatrix[2] = 0;
486 diagnosisMatrix[3] = 1;
487 diagnosisMatrix[4] = 0.109;
488 diagnosisMatrix[5] = 0.891;
489 diagnosisMatrix[6] = 0;
490 diagnosisMatrix[7] = 1;
491 diagnosisMatrix[8] = 0.271;
492 diagnosisMatrix[9] = 0.729;
493 diagnosisMatrix[10] = 0;
494 diagnosisMatrix[11] = 1;
495 diagnosisMatrix[12] = 0.268;
496 diagnosisMatrix[13] = 0.732;
497 diagnosisMatrix[14] = 0;
498 diagnosisMatrix[15] = 1;
499 diagnosisMatrix[16] = 0.206;
500 diagnosisMatrix[17] = 0.794;
501 diagnosisMatrix[18] = 0;
502 diagnosisMatrix[19] = 1;
503 diagnosisMatrix[20] = 0.236;
504 diagnosisMatrix[21] = 0.764;
505 diagnosisMatrix[22] = 0;
506 diagnosisMatrix[23] = 1;
507 diagnosisMatrix[24] = 0.109;
508 diagnosisMatrix[25] = 0.891;
509 diagnosisMatrix[26] = 0;
510 diagnosisMatrix[27] = 1;
511 diagnosisMatrix[28] = 0.0892;
512 diagnosisMatrix[29] = 0.9108;
513 diagnosisMatrix[30] = 0;
514 diagnosisMatrix[31] = 1;
515 diagnosisMatrix[32] = 0.0892;
516 diagnosisMatrix[33] = 0.9108;
517 diagnosisMatrix[34] = 0;
518 diagnosisMatrix[35] = 1;
519 diagnosisMatrix[36] = 0.147;
520 diagnosisMatrix[37] = 0.853;
521 diagnosisMatrix[38] = 0;
522 diagnosisMatrix[39] = 1;
523 diagnosisMatrix[40] = 0.0431;
524 diagnosisMatrix[41] = 0.9569;
525 diagnosisDef->SetDefinition(diagnosisMatrix);
526
527 DSL_nodeDefinition *strategySelectionDef = net.GetNode(strategySelectionNode)->Definition();
528 DSL_Dmatrix strategySelectionMatrix;
529 strategySelectionMatrix.AddDimension(21);
530 strategySelectionMatrix.AddDimension(2);
531 strategySelectionMatrix[0] = 0.063;
532 strategySelectionMatrix[1] = 0.937;
533 strategySelectionMatrix[2] = 0;
534 strategySelectionMatrix[3] = 1;
535 strategySelectionMatrix[4] = 0.0252;
536 strategySelectionMatrix[5] = 0.9748;
537 strategySelectionMatrix[6] = 0;
538 strategySelectionMatrix[7] = 1;
539 strategySelectionMatrix[8] = 0.063;
540 strategySelectionMatrix[9] = 0.937;
541 strategySelectionMatrix[10] = 0;
542 strategySelectionMatrix[11] = 1;
543 strategySelectionMatrix[12] = 0.0621;
544 strategySelectionMatrix[13] = 0.9379;
545 strategySelectionMatrix[14] = 0;
546 strategySelectionMatrix[15] = 1;
547 strategySelectionMatrix[16] = 0.00789;
548 strategySelectionMatrix[17] = 0.99211;
549 strategySelectionMatrix[18] = 0;
550 strategySelectionMatrix[19] = 1;
551 strategySelectionMatrix[20] = 0.0549;
552 strategySelectionMatrix[21] = 0.9451;
553 strategySelectionMatrix[22] = 0;
554 strategySelectionMatrix[23] = 1;
555 strategySelectionMatrix[24] = 0.0368;
556 strategySelectionMatrix[25] = 0.9632;
557 strategySelectionMatrix[26] = 0;
558 strategySelectionMatrix[27] = 1;
559 strategySelectionMatrix[28] = 0.0272;
560 strategySelectionMatrix[29] = 0.9728;
561 strategySelectionMatrix[30] = 0;
562 strategySelectionMatrix[31] = 1;
563 strategySelectionMatrix[32] = 0.0272;
564 strategySelectionMatrix[33] = 0.9728;
565 strategySelectionMatrix[34] = 0;
566 strategySelectionMatrix[35] = 1;
567 strategySelectionMatrix[36] = 0.0342;
568 strategySelectionMatrix[37] = 0.9658;
569 strategySelectionMatrix[38] = 0;
570 strategySelectionMatrix[39] = 1;
571 strategySelectionMatrix[40] = 0.01;
572 strategySelectionMatrix[41] = 0.99;
573 strategySelectionDef->SetDefinition(strategySelectionMatrix);
574
575 DSL_nodeDefinition *goalSelectionDef = net.GetNode(goalSelectionNode)->Definition();
576 DSL_Dmatrix goalSelectionMatrix;
577 goalSelectionMatrix.AddDimension(21);
578 goalSelectionMatrix.AddDimension(2);
579 goalSelectionMatrix[0] = 0.063;
580 goalSelectionMatrix[1] = 0.937;
581 goalSelectionMatrix[2] = 0;
582 goalSelectionMatrix[3] = 1;
583 goalSelectionMatrix[4] = 0.0252;
584 goalSelectionMatrix[5] = 0.9748;
585 goalSelectionMatrix[6] = 0;
586 goalSelectionMatrix[7] = 1;
587 goalSelectionMatrix[8] = 0.063;
588 goalSelectionMatrix[9] = 0.937;
589 goalSelectionMatrix[10] = 0;
590 goalSelectionMatrix[11] = 1;
591 goalSelectionMatrix[12] = 0.0621;
592 goalSelectionMatrix[13] = 0.9379;
593 goalSelectionMatrix[14] = 0;
594 goalSelectionMatrix[15] = 1;
595 goalSelectionMatrix[16] = 0.00789;
596 goalSelectionMatrix[17] = 0.99211;
597 goalSelectionMatrix[18] = 0;
598 goalSelectionMatrix[19] = 1;
599 goalSelectionMatrix[20] = 0.0549;
600 goalSelectionMatrix[21] = 0.9451;
601 goalSelectionMatrix[22] = 0;
602 goalSelectionMatrix[23] = 1;
603 goalSelectionMatrix[24] = 0.0368;
604 goalSelectionMatrix[25] = 0.9632;
605 goalSelectionMatrix[26] = 0;
606 goalSelectionMatrix[27] = 1;
607 goalSelectionMatrix[28] = 0.0272;
608 goalSelectionMatrix[29] = 0.9728;
609 goalSelectionMatrix[30] = 0;
610 goalSelectionMatrix[31] = 1;
611 goalSelectionMatrix[32] = 0.0272;
612 goalSelectionMatrix[33] = 0.9728;
613 goalSelectionMatrix[34] = 0;
614 goalSelectionMatrix[35] = 1;
615 goalSelectionMatrix[36] = 0.0342;
616 goalSelectionMatrix[37] = 0.9658;
617 goalSelectionMatrix[38] = 0;
618 goalSelectionMatrix[39] = 1;
619 goalSelectionMatrix[40] = 0.01;
620 goalSelectionMatrix[41] = 0.99;
621 goalSelectionDef->SetDefinition(goalSelectionMatrix);
622
623 DSL_nodeDefinition *strategyCommunicationDef = net.GetNode(strategyCommunicationNode)->Definition();
624 DSL_Dmatrix strategyCommunicationMatrix;
625 strategyCommunicationMatrix.AddDimension(21);
626 strategyCommunicationMatrix.AddDimension(2);
627 strategyCommunicationMatrix[0] = 0.0378;
628 strategyCommunicationMatrix[1] = 0.9622;
629 strategyCommunicationMatrix[2] = 0;
630 strategyCommunicationMatrix[3] = 1;
631 strategyCommunicationMatrix[4] = 0.019;
632 strategyCommunicationMatrix[5] = 0.981;
633 strategyCommunicationMatrix[6] = 0;
634 strategyCommunicationMatrix[7] = 1;
635 strategyCommunicationMatrix[8] = 0.0378;
636 strategyCommunicationMatrix[9] = 0.9622;
637 strategyCommunicationMatrix[10] = 0;
638 strategyCommunicationMatrix[11] = 1;
639 strategyCommunicationMatrix[12] = 0.0373;
640 strategyCommunicationMatrix[13] = 0.9627;
641 strategyCommunicationMatrix[14] = 0;
642 strategyCommunicationMatrix[15] = 1;
643 strategyCommunicationMatrix[16] = 0.0375;
644 strategyCommunicationMatrix[17] = 0.9625;
645 strategyCommunicationMatrix[18] = 0;
646 strategyCommunicationMatrix[19] = 1;
647 strategyCommunicationMatrix[20] = 0.0289;
648 strategyCommunicationMatrix[21] = 0.9711;
649 strategyCommunicationMatrix[22] = 0;
650 strategyCommunicationMatrix[23] = 1;
651 strategyCommunicationMatrix[24] = 0.0174;
652 strategyCommunicationMatrix[25] = 0.9826;
653 strategyCommunicationMatrix[26] = 0;
654 strategyCommunicationMatrix[27] = 1;
655 strategyCommunicationMatrix[28] = 0.0163;
656 strategyCommunicationMatrix[29] = 0.9837;
657 strategyCommunicationMatrix[30] = 0;
658 strategyCommunicationMatrix[31] = 1;
659 strategyCommunicationMatrix[32] = 0.0163;
660 strategyCommunicationMatrix[33] = 0.9837;
661 strategyCommunicationMatrix[34] = 0;
662 strategyCommunicationMatrix[35] = 1;
663 strategyCommunicationMatrix[36] = 0.0205;
664 strategyCommunicationMatrix[37] = 0.9795;
665 strategyCommunicationMatrix[38] = 0;
666 strategyCommunicationMatrix[39] = 1;
667 strategyCommunicationMatrix[40] = 0.006;
668 strategyCommunicationMatrix[41] = 0.994;
669 strategyCommunicationDef->SetDefinition(strategyCommunicationMatrix);
670
671 DSL_nodeDefinition *goalCommunicationDef = net.GetNode(goalCommunicationNode)->Definition();
672 DSL_Dmatrix goalCommunicationMatrix;
673 goalCommunicationMatrix.AddDimension(21);
674 goalCommunicationMatrix.AddDimension(2);
675 goalCommunicationMatrix[0] = 0.0378;
676 goalCommunicationMatrix[1] = 0.9622;
677 goalCommunicationMatrix[2] = 0;
678 goalCommunicationMatrix[3] = 1;
679 goalCommunicationMatrix[4] = 0.019;
680 goalCommunicationMatrix[5] = 0.981;
681 goalCommunicationMatrix[6] = 0;
682 goalCommunicationMatrix[7] = 1;
683 goalCommunicationMatrix[8] = 0.0378;
684 goalCommunicationMatrix[9] = 0.9622;
685 goalCommunicationMatrix[10] = 0;
686 goalCommunicationMatrix[11] = 1;
687 goalCommunicationMatrix[12] = 0.0373;
688 goalCommunicationMatrix[13] = 0.9627;
689 goalCommunicationMatrix[14] = 0;
690 goalCommunicationMatrix[15] = 1;
691 goalCommunicationMatrix[16] = 0.0375;
692 goalCommunicationMatrix[17] = 0.9625;
693 goalCommunicationMatrix[18] = 0;
694 goalCommunicationMatrix[19] = 1;
695 goalCommunicationMatrix[20] = 0.0289;
696 goalCommunicationMatrix[21] = 0.9711;
697 goalCommunicationMatrix[22] = 0;
698 goalCommunicationMatrix[23] = 1;
699 goalCommunicationMatrix[24] = 0.0174;
700 goalCommunicationMatrix[25] = 0.9826;
701 goalCommunicationMatrix[26] = 0;
702 goalCommunicationMatrix[27] = 1;
703 goalCommunicationMatrix[28] = 0.0163;
704 goalCommunicationMatrix[29] = 0.9837;
705 goalCommunicationMatrix[30] = 0;
706 goalCommunicationMatrix[31] = 1;
707 goalCommunicationMatrix[32] = 0.0163;
708 goalCommunicationMatrix[33] = 0.9837;
709 goalCommunicationMatrix[34] = 0;
710 goalCommunicationMatrix[35] = 1;
711 goalCommunicationMatrix[36] = 0.0205;
712 goalCommunicationMatrix[37] = 0.9795;
713 goalCommunicationMatrix[38] = 0;
714 goalCommunicationMatrix[39] = 1;
715 goalCommunicationMatrix[40] = 0.006;
716 goalCommunicationMatrix[41] = 0.994;
717 goalCommunicationDef->SetDefinition(goalCommunicationMatrix);
718
719 DSL_nodeDefinition *procedureTransferDef = net.GetNode(procedureTransferNode)->Definition();
720 DSL_Dmatrix procedureTransferMatrix;
721 procedureTransferMatrix.AddDimension(21);
722 procedureTransferMatrix.AddDimension(2);
723 procedureTransferMatrix[0] = 0.063;
724 procedureTransferMatrix[1] = 0.937;
725 procedureTransferMatrix[2] = 0;
726 procedureTransferMatrix[3] = 1;
727 procedureTransferMatrix[4] = 0.0252;
728 procedureTransferMatrix[5] = 0.9748;
729 procedureTransferMatrix[6] = 0;
730 procedureTransferMatrix[7] = 1;
731 procedureTransferMatrix[8] = 0.063;
732 procedureTransferMatrix[9] = 0.937;
733 procedureTransferMatrix[10] = 0;
734 procedureTransferMatrix[11] = 1;
735 procedureTransferMatrix[12] = 0.0621;
736 procedureTransferMatrix[13] = 0.9379;
737 procedureTransferMatrix[14] = 0;
738 procedureTransferMatrix[15] = 1;
739 procedureTransferMatrix[16] = 0.0478;
740 procedureTransferMatrix[17] = 0.9522;
741 procedureTransferMatrix[18] = 0;
742 procedureTransferMatrix[19] = 1;
743 procedureTransferMatrix[20] = 0.0549;
744 procedureTransferMatrix[21] = 0.9451;
745 procedureTransferMatrix[22] = 0;
746 procedureTransferMatrix[23] = 1;
747 procedureTransferMatrix[24] = 0.0393;
748 procedureTransferMatrix[25] = 0.9607;
749 procedureTransferMatrix[26] = 0;
750 procedureTransferMatrix[27] = 1;
751 procedureTransferMatrix[28] = 0.0271;
752 procedureTransferMatrix[29] = 0.9729;
753 procedureTransferMatrix[30] = 0;
754 procedureTransferMatrix[31] = 1;
755 procedureTransferMatrix[32] = 0.0271;
756 procedureTransferMatrix[33] = 0.9729;
757 procedureTransferMatrix[34] = 0;
758 procedureTransferMatrix[35] = 1;
759 procedureTransferMatrix[36] = 0.0342;
760 procedureTransferMatrix[37] = 0.9658;
761 procedureTransferMatrix[38] = 0;
762 procedureTransferMatrix[39] = 1;
763 procedureTransferMatrix[40] = 0.01;
764 procedureTransferMatrix[41] = 0.99;
765 procedureTransferDef->SetDefinition(procedureTransferMatrix);
766
767 DSL_nodeDefinition *mentalProcedureDef = net.GetNode(mentalProcedureNode)->Definition();
768 DSL_Dmatrix mentalProcedureMatrix;
769 mentalProcedureMatrix.AddDimension(21);
770 mentalProcedureMatrix.AddDimension(2);
771 mentalProcedureMatrix[0] = 0.0154;
772 mentalProcedureMatrix[1] = 0.9846;
773 mentalProcedureMatrix[2] = 0;
774 mentalProcedureMatrix[3] = 1;
775 mentalProcedureMatrix[4] = 0.00617;
776 mentalProcedureMatrix[5] = 0.99383;
777 mentalProcedureMatrix[6] = 0;
778 mentalProcedureMatrix[7] = 1;
779 mentalProcedureMatrix[8] = 0.0154;
780 mentalProcedureMatrix[9] = 0.9846;
781 mentalProcedureMatrix[10] = 0;
782 mentalProcedureMatrix[11] = 1;
783 mentalProcedureMatrix[12] = 0.0152;
784 mentalProcedureMatrix[13] = 0.9848;
785 mentalProcedureMatrix[14] = 0;
786 mentalProcedureMatrix[15] = 1;
787 mentalProcedureMatrix[16] = 0.0117;
788 mentalProcedureMatrix[17] = 0.9883;
789 mentalProcedureMatrix[18] = 0;
790 mentalProcedureMatrix[19] = 1;
791 mentalProcedureMatrix[20] = 0.0197;
792 mentalProcedureMatrix[21] = 0.9803;
793 mentalProcedureMatrix[22] = 0;
794 mentalProcedureMatrix[23] = 1;
795 mentalProcedureMatrix[24] = 0.00962;
796 mentalProcedureMatrix[25] = 0.99038;
797 mentalProcedureMatrix[26] = 0;
798 mentalProcedureMatrix[27] = 1;
799 mentalProcedureMatrix[28] = 0.00662;
800 mentalProcedureMatrix[29] = 0.99338;
801 mentalProcedureMatrix[30] = 0;
802 mentalProcedureMatrix[31] = 1;
803 mentalProcedureMatrix[32] = 0.00662;
804 mentalProcedureMatrix[33] = 0.99338;
805 mentalProcedureMatrix[34] = 0;
806 mentalProcedureMatrix[35] = 1;
807 mentalProcedureMatrix[36] = 0.00838;
808 mentalProcedureMatrix[37] = 0.99162;
809 mentalProcedureMatrix[38] = 0;
810 mentalProcedureMatrix[39] = 1;
811 mentalProcedureMatrix[40] = 0.00245;
812 mentalProcedureMatrix[41] = 0.99755;
813 mentalProcedureDef->SetDefinition(mentalProcedureMatrix);
814
815 DSL_nodeDefinition *procedureInterpretationDef = net.GetNode(procedureInterpretationNode)->Definition();
816 DSL_Dmatrix procedureInterpretationMatrix;
817 procedureInterpretationMatrix.AddDimension(21);
818 procedureInterpretationMatrix.AddDimension(2);
819 procedureInterpretationMatrix[0] = 0.0154;
820 procedureInterpretationMatrix[1] = 0.9846;
821 procedureInterpretationMatrix[2] = 0;
822 procedureInterpretationMatrix[3] = 1;
823 procedureInterpretationMatrix[4] = 0.00617;
824 procedureInterpretationMatrix[5] = 0.99383;
825 procedureInterpretationMatrix[6] = 0;
826 procedureInterpretationMatrix[7] = 1;
827 procedureInterpretationMatrix[8] = 0.0154;
828 procedureInterpretationMatrix[9] = 0.9846;
829 procedureInterpretationMatrix[10] = 0;
830 procedureInterpretationMatrix[11] = 1;
831 procedureInterpretationMatrix[12] = 0.0152;
832 procedureInterpretationMatrix[13] = 0.9848;
833 procedureInterpretationMatrix[14] = 0;
834 procedureInterpretationMatrix[15] = 1;
835 procedureInterpretationMatrix[16] = 0.0117;
836 procedureInterpretationMatrix[17] = 0.9883;
837 procedureInterpretationMatrix[18] = 0;
838 procedureInterpretationMatrix[19] = 1;
839 procedureInterpretationMatrix[20] = 0.0197;
840 procedureInterpretationMatrix[21] = 0.9803;
841 procedureInterpretationMatrix[22] = 0;
842 procedureInterpretationMatrix[23] = 1;
843 procedureInterpretationMatrix[24] = 0.00962;
844 procedureInterpretationMatrix[25] = 0.99038;
845 procedureInterpretationMatrix[26] = 0;
846 procedureInterpretationMatrix[27] = 1;
847 procedureInterpretationMatrix[28] = 0.00662;
848 procedureInterpretationMatrix[29] = 0.99338;
849 procedureInterpretationMatrix[30] = 0;
850 procedureInterpretationMatrix[31] = 1;
851 procedureInterpretationMatrix[32] = 0.00662;
852 procedureInterpretationMatrix[33] = 0.99338;
853 procedureInterpretationMatrix[34] = 0;
854 procedureInterpretationMatrix[35] = 1;
855 procedureInterpretationMatrix[36] = 0.00838;
856 procedureInterpretationMatrix[37] = 0.99162;
857 procedureInterpretationMatrix[38] = 0;
858 procedureInterpretationMatrix[39] = 1;
859 procedureInterpretationMatrix[40] = 0.00245;
860 procedureInterpretationMatrix[41] = 0.99755;
861 procedureInterpretationDef->SetDefinition(procedureInterpretationMatrix);
862
863 DSL_nodeDefinition *procedureStepDef = net.GetNode(procedureStepNode)->Definition();
864 DSL_Dmatrix procedureStepMatrix;
865 procedureStepMatrix.AddDimension(21);
866 procedureStepMatrix.AddDimension(2);
867 procedureStepMatrix[0] = 0.063;
868 procedureStepMatrix[1] = 0.937;
869 procedureStepMatrix[2] = 0;
870 procedureStepMatrix[3] = 1;
871 procedureStepMatrix[4] = 0.0252;
872 procedureStepMatrix[5] = 0.9748;
873 procedureStepMatrix[6] = 0;
874 procedureStepMatrix[7] = 1;
875 procedureStepMatrix[8] = 0.063;
876 procedureStepMatrix[9] = 0.937;
877 procedureStepMatrix[10] = 0;
878 procedureStepMatrix[11] = 1;
879 procedureStepMatrix[12] = 0.0621;
880 procedureStepMatrix[13] = 0.9379;
881 procedureStepMatrix[14] = 0;
882 procedureStepMatrix[15] = 1;
883 procedureStepMatrix[16] = 0.0478;
884 procedureStepMatrix[17] = 0.9522;
885 procedureStepMatrix[18] = 0;
886 procedureStepMatrix[19] = 1;
887 procedureStepMatrix[20] = 0.0549;
888 procedureStepMatrix[21] = 0.9451;
889 procedureStepMatrix[22] = 0;
890 procedureStepMatrix[23] = 1;
891 procedureStepMatrix[24] = 0.0393;
892 procedureStepMatrix[25] = 0.9607;
893 procedureStepMatrix[26] = 0;
894 procedureStepMatrix[27] = 1;
895 procedureStepMatrix[28] = 0.0271;
896 procedureStepMatrix[29] = 0.9729;
897 procedureStepMatrix[30] = 0;
898 procedureStepMatrix[31] = 1;
899 procedureStepMatrix[32] = 0.0271;
900 procedureStepMatrix[33] = 0.9729;
901 procedureStepMatrix[34] = 0;
902 procedureStepMatrix[35] = 1;
903 procedureStepMatrix[36] = 0.0342;
904 procedureStepMatrix[37] = 0.9658;
905 procedureStepMatrix[38] = 0;
906 procedureStepMatrix[39] = 1;
907 procedureStepMatrix[40] = 0.01;
908 procedureStepMatrix[41] = 0.99;
909 procedureStepDef->SetDefinition(procedureStepMatrix);
910
911 DSL_nodeDefinition *maneuverActionDef = net.GetNode(maneuverActionNode)->Definition();
912 DSL_Dmatrix maneuverActionMatrix;
913 maneuverActionMatrix.AddDimension(21);
914 maneuverActionMatrix.AddDimension(2);
915 maneuverActionMatrix[0] = 0.0234;
916 maneuverActionMatrix[1] = 0.9766;
917 maneuverActionMatrix[2] = 0;
918 maneuverActionMatrix[3] = 1;
919 maneuverActionMatrix[4] = 0.0132;
920 maneuverActionMatrix[5] = 0.9868;
921 maneuverActionMatrix[6] = 0;
922 maneuverActionMatrix[7] = 1;
923 maneuverActionMatrix[8] = 0.0234;
924 maneuverActionMatrix[9] = 0.9766;
925 maneuverActionMatrix[10] = 0;
926 maneuverActionMatrix[11] = 1;
927 maneuverActionMatrix[12] = 0.0207;
928 maneuverActionMatrix[13] = 0.9793;
929 maneuverActionMatrix[14] = 0;
930 maneuverActionMatrix[15] = 1;
931 maneuverActionMatrix[16] = 0.0147;
932 maneuverActionMatrix[17] = 0.9853;
933 maneuverActionMatrix[18] = 0;
934 maneuverActionMatrix[19] = 1;
935 maneuverActionMatrix[20] = 0.0194;
936 maneuverActionMatrix[21] = 0.9806;
937 maneuverActionMatrix[22] = 0;
938 maneuverActionMatrix[23] = 1;
939 maneuverActionMatrix[24] = 0.0194;
940 maneuverActionMatrix[25] = 0.9806;
941 maneuverActionMatrix[26] = 0;
942 maneuverActionMatrix[27] = 1;
943 maneuverActionMatrix[28] = 0.0928;
944 maneuverActionMatrix[29] = 0.9072;
945 maneuverActionMatrix[30] = 0;
946 maneuverActionMatrix[31] = 1;
947 maneuverActionMatrix[32] = 0.0135;
948 maneuverActionMatrix[33] = 0.9865;
949 maneuverActionMatrix[34] = 0;
950 maneuverActionMatrix[35] = 1;
951 maneuverActionMatrix[36] = 0.0234;
952 maneuverActionMatrix[37] = 0.9766;
953 maneuverActionMatrix[38] = 0;
954 maneuverActionMatrix[39] = 1;
955 maneuverActionMatrix[40] = 0.00331;
956 maneuverActionMatrix[41] = 0.99669;
957 maneuverActionDef->SetDefinition(maneuverActionMatrix);
958
959 net.UpdateBeliefs();
960}
961
962void HumanFailureEventsBBN::setSystemCriticality(double system_criticality) {
963 this->system_criticality = system_criticality;
964 DSL_doubleArray probabilities(2);
965 probabilities[0] = system_criticality;
966 probabilities[1] = 1.0 - system_criticality;
967 DSL_nodeDefinition *systemCriticalityDef = net.GetNode(systemCriticalityNode)->Definition();
968 systemCriticalityDef->SetDefinition(probabilities);
969 net.UpdateBeliefs();
970}
971void HumanFailureEventsBBN::setInformationLoad(double information_load) {
972 this->information_load = information_load;
973 DSL_doubleArray probabilities(2);
974 probabilities[0] = information_load;
975 probabilities[1] = 1.0 - information_load;
976 DSL_nodeDefinition *informationLoadDef = net.GetNode(informationLoadNode)->Definition();
977 informationLoadDef->SetDefinition(probabilities);
978 net.UpdateBeliefs();
979}
980void HumanFailureEventsBBN::setTimeConstraintLoad(double time_constraint_load) {
981 this->time_constraint_load = time_constraint_load;
982 DSL_doubleArray probabilities(2);
983 probabilities[0] = time_constraint_load;
984 probabilities[1] = 1.0 - time_constraint_load;
985 DSL_nodeDefinition *timeConstraintLoadDef = net.GetNode(timeConstraintLoadNode)->Definition();
986 timeConstraintLoadDef->SetDefinition(probabilities);
987 net.UpdateBeliefs();
988}
989void HumanFailureEventsBBN::setCognitiveTaskLoad(double cognitive_task_load) {
990 this->cognitive_task_load = cognitive_task_load;
991 DSL_doubleArray probabilities(2);
992 probabilities[0] = cognitive_task_load;
993 probabilities[1] = 1.0 - cognitive_task_load;
994 DSL_nodeDefinition *cognitiveTaskLoadDef = net.GetNode(cognitiveTaskLoadNode)->Definition();
995 cognitiveTaskLoadDef->SetDefinition(probabilities);
996 net.UpdateBeliefs();
997}
998void HumanFailureEventsBBN::setPassiveAlarmLoad(double passive_alarm_load) {
999 this->passive_alarm_load = passive_alarm_load;
1000 DSL_doubleArray probabilities(2);
1001 probabilities[0] = passive_alarm_load;
1002 probabilities[1] = 1.0 - passive_alarm_load;
1003 DSL_nodeDefinition *passiveAlarmLoadDef = net.GetNode(passiveAlarmLoadNode)->Definition();
1004 passiveAlarmLoadDef->SetDefinition(probabilities);
1005 net.UpdateBeliefs();
1006}
1007void HumanFailureEventsBBN::setTaskComplexity(double task_complexity) {
1008 this->task_complexity = task_complexity;
1009 DSL_doubleArray probabilities(2);
1010 probabilities[0] = task_complexity;
1011 probabilities[1] = 1.0 - task_complexity;
1012 DSL_nodeDefinition *taskComplexityDef = net.GetNode(taskComplexityNode)->Definition();
1013 taskComplexityDef->SetDefinition(probabilities);
1014 net.UpdateBeliefs();
1015}
1016void HumanFailureEventsBBN::setExpertise(double expertise) {
1017 this->expertise = expertise;
1018 DSL_doubleArray probabilities(2);
1019 probabilities[0] = expertise;
1020 probabilities[1] = 1.0 - expertise;
1021 DSL_nodeDefinition *expertiseDef = net.GetNode(expertiseNode)->Definition();
1022 expertiseDef->SetDefinition(probabilities);
1023 net.UpdateBeliefs();
1024}
1025void HumanFailureEventsBBN::setStress(double stress) {
1026 this->stress = stress;
1027 DSL_doubleArray probabilities(2);
1028 probabilities[0] = stress;
1029 probabilities[1] = 1.0 - stress;
1030 DSL_nodeDefinition *stressDef = net.GetNode(stressNode)->Definition();
1031 stressDef->SetDefinition(probabilities);
1032 net.UpdateBeliefs();
1033}
1034void HumanFailureEventsBBN::setFatigue(double fatigue) {
1035 this->fatigue = fatigue;
1036 DSL_doubleArray probabilities(2);
1037 probabilities[0] = fatigue;
1038 probabilities[1] = 1.0 - fatigue;
1039 DSL_nodeDefinition *fatigueDef = net.GetNode(fatigueNode)->Definition();
1040 fatigueDef->SetDefinition(probabilities);
1041 net.UpdateBeliefs();
1042}
1043void HumanFailureEventsBBN::setProblemSolvingStyle(double problem_solving_style) {
1044 this->problem_solving_style = problem_solving_style;
1045 DSL_doubleArray probabilities(2);
1046 probabilities[0] = problem_solving_style;
1047 probabilities[1] = 1.0 - problem_solving_style;
1048 DSL_nodeDefinition *problemSolvingStyleDef = net.GetNode(problemSolvingStyleNode)->Definition();
1049 problemSolvingStyleDef->SetDefinition(probabilities);
1050 net.UpdateBeliefs();
1051}
1052
1054 gather_state_info = getFailurePosteriorProbability(net, gatherStateInfoNode);
1055 return gather_state_info;
1056}
1058 gather_info_mode = getFailurePosteriorProbability(net, gatherInfoModeNode);
1059 return gather_info_mode;
1060}
1062 perceive_state_info = getFailurePosteriorProbability(net, perceiveStateInfoNode);
1063 return perceive_state_info;
1064}
1066 gather_new_info = getFailurePosteriorProbability(net, gatherNewInfoNode);
1067 return gather_new_info;
1068}
1070 diagnosis = getFailurePosteriorProbability(net, diagnosisNode);
1071 return diagnosis;
1072}
1074 strategy_selection = getFailurePosteriorProbability(net, strategySelectionNode);
1075 return strategy_selection;
1076}
1078 goal_selection = getFailurePosteriorProbability(net, goalSelectionNode);
1079 return goal_selection;
1080}
1082 strategy_communication = getFailurePosteriorProbability(net, strategyCommunicationNode);
1084}
1086 goal_communication = getFailurePosteriorProbability(net, goalCommunicationNode);
1087 return goal_communication;
1088}
1090 procedure_transfer = getFailurePosteriorProbability(net, procedureTransferNode);
1091 return procedure_transfer;
1092}
1094 mental_procedure = getFailurePosteriorProbability(net, mentalProcedureNode);
1095 return mental_procedure;
1096}
1098 procedure_interpretation = getFailurePosteriorProbability(net, procedureInterpretationNode);
1100}
1102 procedure_step = getFailurePosteriorProbability(net, procedureStepNode);
1103 return procedure_step;
1104}
1106 maneuver_action = getFailurePosteriorProbability(net, maneuverActionNode);
1107 return maneuver_action;
1108}
1109
1110
1112 this->systemCriticalityNode = _hfebbn.systemCriticalityNode;
1113 this->informationLoadNode = _hfebbn.informationLoadNode;
1114 this->timeConstraintLoadNode = _hfebbn.timeConstraintLoadNode;
1115 this->cognitiveTaskLoadNode = _hfebbn.cognitiveTaskLoadNode;
1116 this->passiveAlarmLoadNode = _hfebbn.passiveAlarmLoadNode;
1117 this->taskComplexityNode = _hfebbn.taskComplexityNode;
1118 this->expertiseNode = _hfebbn.expertiseNode;
1119 this->stressNode = _hfebbn.stressNode;
1120 this->fatigueNode = _hfebbn.fatigueNode;
1121 this->problemSolvingStyleNode = _hfebbn.problemSolvingStyleNode;
1122 this->gatherStateInfoNode = _hfebbn.gatherStateInfoNode;
1123 this->gatherInfoModeNode = _hfebbn.gatherInfoModeNode;
1124 this->perceiveStateInfoNode = _hfebbn.perceiveStateInfoNode;
1125 this->gatherNewInfoNode = _hfebbn.gatherNewInfoNode;
1126 this->diagnosisNode = _hfebbn.diagnosisNode;
1127 this->strategySelectionNode = _hfebbn.strategySelectionNode;
1128 this->goalSelectionNode = _hfebbn.goalSelectionNode;
1129 this->strategyCommunicationNode = _hfebbn.strategyCommunicationNode;
1130 this->goalCommunicationNode = _hfebbn.goalCommunicationNode;
1131 this->procedureTransferNode = _hfebbn.procedureTransferNode;
1132 this->mentalProcedureNode = _hfebbn.mentalProcedureNode;
1133 this->procedureInterpretationNode = _hfebbn.procedureInterpretationNode;
1134 this->procedureStepNode = _hfebbn.procedureStepNode;
1135 this->maneuverActionNode = _hfebbn.maneuverActionNode;
1136 this->net = _hfebbn.net;
1137 this->system_criticality = _hfebbn.system_criticality;
1138 this->information_load = _hfebbn.information_load;
1139 this->time_constraint_load = _hfebbn.time_constraint_load;
1140 this->cognitive_task_load = _hfebbn.cognitive_task_load;
1141 this->passive_alarm_load = _hfebbn.passive_alarm_load;
1142 this->task_complexity = _hfebbn.task_complexity;
1143 this->expertise = _hfebbn.expertise;
1144 this->stress = _hfebbn.stress;
1145 this->fatigue = _hfebbn.fatigue;
1146 this->problem_solving_style = _hfebbn.problem_solving_style;
1147 this->net.UpdateBeliefs();
1148}
1149
1150int HumanFailureEventsBBN::CreateCptNode(DSL_network &net,
1151 const char *id,
1152 const char *name,
1153 const char *outcomes[],
1154 int xPos,
1155 int yPos) {
1156 int handle = net.AddNode(DSL_CPT, id);
1157 DSL_node *node = net.GetNode(handle);
1158
1159 DSL_idArray ida;
1160 for (const char **p = outcomes; *p != NULL; p++) {
1161 ida.Add(*p);
1162 }
1163 DSL_nodeDefinition *def = node->Definition();
1164 def->SetNumberOfOutcomes(ida);
1165
1166 node->Info().Header().SetName(name);
1167
1168 DSL_rectangle &position = node->Info().Screen().position;
1169 position.center_X = xPos;
1170 position.center_Y = yPos;
1171 position.width = 85;
1172 position.height = 55;
1173
1174 return handle;
1175}
1176
1177int HumanFailureEventsBBN::CreateNoisyMaxNode(DSL_network &net,
1178 const char *id,
1179 const char *name,
1180 const char *outcomes[],
1181 int xPos,
1182 int yPos) {
1183 int handle = net.AddNode(DSL_NOISY_MAX, id);
1184 DSL_node *node = net.GetNode(handle);
1185
1186 DSL_idArray ida;
1187 for (const char **p = outcomes; *p != NULL; p++) {
1188 ida.Add(*p);
1189 }
1190 DSL_nodeDefinition *def = node->Definition();
1191 def->SetNumberOfOutcomes(ida);
1192
1193 node->Info().Header().SetName(name);
1194
1195 DSL_rectangle &position = node->Info().Screen().position;
1196 position.center_X = xPos;
1197 position.center_Y = yPos;
1198 position.width = 85;
1199 position.height = 55;
1200
1201 return handle;
1202}
1203
1204double HumanFailureEventsBBN::getFailurePosteriorProbability(DSL_network &net, int handle) {
1205 DSL_node *node = net.GetNode(handle);
1206 DSL_nodeValue *val = node->Value();
1207 const DSL_Dmatrix &posteriors = *val->GetMatrix();
1208 //return posteriors[0];
1209 return 1.0e-3;
1210}
1211
1213 // SMILE (ENABLE_HCL) path: deserialized state is consumed only through
1214 // copyHumanFailureEventsBBN, which re-applies evidence via the setter path.
1215 // Intentionally a no-op in the HCL build.
1216}
1217
1218#else // !ENABLE_HCL — BNCore implementation
1219
1220namespace {
1221
1222struct NoisyMaxParams {
1223 double link_fail[10]; // P(Failure | parent_i = Present), per parent
1224 double leak; // P(Failure | leak)
1225};
1226
1227// Expand noisy-MAX D-matrix parameters to a full CPT.
1228// For 10 binary parents: 2^10 parent combos × 2 child states = 2048 entries.
1229// Formula: P(Fail) = 1 - (1-leak) × prod_i(1 - d_i(x_i))
1230std::vector<double> expandNoisyMaxToCpt(const NoisyMaxParams &params) {
1231 constexpr int N = 10;
1232 constexpr int NUM_COMBOS = 1 << N;
1233 std::vector<double> cpt(NUM_COMBOS * 2);
1234 for (int combo = 0; combo < NUM_COMBOS; ++combo) {
1235 double prod = 1.0 - params.leak;
1236 for (int i = 0; i < N; ++i) {
1237 int state = (combo >> (N - 1 - i)) & 1;
1238 if (state == 0) // Present/Low/Poor → contributes to failure
1239 prod *= (1.0 - params.link_fail[i]);
1240 }
1241 double p_fail = 1.0 - prod;
1242 cpt[combo * 2] = p_fail;
1243 cpt[combo * 2 + 1] = 1.0 - p_fail;
1244 }
1245 return cpt;
1246}
1247
1248// Link failure probabilities extracted from SMILE Noisy-MAX D-matrices.
1249// Parent order: SysCrit, InfoLoad, TimeConst, CogTask, PassAlarm,
1250// TaskComplex, Expertise, Stress, Fatigue, PSS
1251// clang-format off
1252const NoisyMaxParams kGatherStateInfo = {{0.0063, 0.00317, 0.0063, 0.00621, 0.00626, 0.00481, 0.0029, 0.00271, 0.00271, 0.00342}, 0.001};
1253const NoisyMaxParams kGatherInfoMode = {{0.167, 0.084, 0.167, 0.164, 0.166, 0.127, 0.767, 0.0718, 0.0718, 0.0905}, 0.0265};
1254const NoisyMaxParams kPerceiveStateInfo = {{0.0528, 0.0266, 0.0528, 0.052, 0.0229, 0.0403, 0.0243, 0.0227, 0.0227, 0.0286}, 0.00837};
1255const NoisyMaxParams kGatherNewInfo = {{0.441, 0.222, 0.441, 0.435, 0.438, 0.337, 0.203, 0.19, 0.19, 0.239}, 0.07};
1256const NoisyMaxParams kDiagnosis = {{0.271, 0.109, 0.271, 0.268, 0.206, 0.236, 0.109, 0.0892, 0.0892, 0.147}, 0.0431};
1257const NoisyMaxParams kStrategySelection = {{0.063, 0.0252, 0.063, 0.0621, 0.00789, 0.0549, 0.0368, 0.0272, 0.0272, 0.0342}, 0.01};
1258const NoisyMaxParams kGoalSelection = {{0.063, 0.0252, 0.063, 0.0621, 0.00789, 0.0549, 0.0368, 0.0272, 0.0272, 0.0342}, 0.01};
1259const NoisyMaxParams kStrategyCommunication = {{0.0378, 0.019, 0.0378, 0.0373, 0.0375, 0.0289, 0.0174, 0.0163, 0.0163, 0.0205}, 0.006};
1260const NoisyMaxParams kGoalCommunication = {{0.0378, 0.019, 0.0378, 0.0373, 0.0375, 0.0289, 0.0174, 0.0163, 0.0163, 0.0205}, 0.006};
1261const NoisyMaxParams kProcedureTransfer = {{0.063, 0.0252, 0.063, 0.0621, 0.0478, 0.0549, 0.0393, 0.0271, 0.0271, 0.0342}, 0.01};
1262const NoisyMaxParams kMentalProcedure = {{0.0154, 0.00617, 0.0154, 0.0152, 0.0117, 0.0197, 0.00962, 0.00662, 0.00662, 0.00838}, 0.00245};
1263const NoisyMaxParams kProcedureInterpretation={{0.0154, 0.00617, 0.0154, 0.0152, 0.0117, 0.0197, 0.00962, 0.00662, 0.00662, 0.00838}, 0.00245};
1264const NoisyMaxParams kProcedureStep = {{0.063, 0.0252, 0.063, 0.0621, 0.0478, 0.0549, 0.0393, 0.0271, 0.0271, 0.0342}, 0.01};
1265const NoisyMaxParams kManeuverAction = {{0.0234, 0.0132, 0.0234, 0.0207, 0.0147, 0.0194, 0.0194, 0.0928, 0.0135, 0.0234}, 0.00331};
1266// clang-format on
1267
1268} // anonymous namespace
1269
1271 graph_ = std::make_unique<bncore::Graph>();
1272
1273 // 10 PSF root nodes (binary, uniform prior for soft evidence)
1274 psf_ids_[0] = graph_->add_variable("SystemCriticality", {"Present", "Absent"});
1275 psf_ids_[1] = graph_->add_variable("InformationLoad", {"Present", "Absent"});
1276 psf_ids_[2] = graph_->add_variable("TimeConstraintLoad", {"Present", "Absent"});
1277 psf_ids_[3] = graph_->add_variable("CognitiveTaskLoad", {"Present", "Absent"});
1278 psf_ids_[4] = graph_->add_variable("PassiveAlarmLoad", {"Present", "Absent"});
1279 psf_ids_[5] = graph_->add_variable("TaskComplexity", {"Present", "Absent"});
1280 psf_ids_[6] = graph_->add_variable("Expertise", {"Low", "High"});
1281 psf_ids_[7] = graph_->add_variable("Stress", {"Present", "Absent"});
1282 psf_ids_[8] = graph_->add_variable("Fatigue", {"Present", "Absent"});
1283 psf_ids_[9] = graph_->add_variable("ProblemSolvingStyle", {"Poor", "Best"});
1284
1285 // 14 HFE child nodes (binary: Failure/Success)
1286 hfe_ids_[0] = graph_->add_variable("GatherStateInfo", {"Failure", "Success"});
1287 hfe_ids_[1] = graph_->add_variable("GatherInfoMode", {"Failure", "Success"});
1288 hfe_ids_[2] = graph_->add_variable("PerceiveStateInfo", {"Failure", "Success"});
1289 hfe_ids_[3] = graph_->add_variable("GatherNewInfo", {"Failure", "Success"});
1290 hfe_ids_[4] = graph_->add_variable("Diagnosis", {"Failure", "Success"});
1291 hfe_ids_[5] = graph_->add_variable("StrategySelection", {"Failure", "Success"});
1292 hfe_ids_[6] = graph_->add_variable("GoalSelection", {"Failure", "Success"});
1293 hfe_ids_[7] = graph_->add_variable("StrategyCommunication", {"Failure", "Success"});
1294 hfe_ids_[8] = graph_->add_variable("GoalCommunication", {"Failure", "Success"});
1295 hfe_ids_[9] = graph_->add_variable("ProcedureTransfer", {"Failure", "Success"});
1296 hfe_ids_[10] = graph_->add_variable("MentalProcedure", {"Failure", "Success"});
1297 hfe_ids_[11] = graph_->add_variable("ProcedureInterpretation", {"Failure", "Success"});
1298 hfe_ids_[12] = graph_->add_variable("ProcedureStep", {"Failure", "Success"});
1299 hfe_ids_[13] = graph_->add_variable("ManeuverAction", {"Failure", "Success"});
1300
1301 // 140 edges: every PSF -> every HFE
1302 for (std::size_t i = 0; i < 10; ++i)
1303 for (std::size_t j = 0; j < 14; ++j)
1304 graph_->add_edge(psf_ids_[i], hfe_ids_[j]);
1305
1306 // Uniform priors for PSF nodes (soft evidence produces correct marginals)
1307 for (std::size_t i = 0; i < 10; ++i)
1308 graph_->set_cpt(psf_ids_[i], {0.5, 0.5});
1309
1310 // Expand noisy-MAX D-matrices to full CPTs (2^10 x 2 = 2048 entries each)
1311 const NoisyMaxParams *hfe_params[14] = {
1312 &kGatherStateInfo, &kGatherInfoMode, &kPerceiveStateInfo,
1313 &kGatherNewInfo, &kDiagnosis, &kStrategySelection,
1314 &kGoalSelection, &kStrategyCommunication, &kGoalCommunication,
1315 &kProcedureTransfer, &kMentalProcedure, &kProcedureInterpretation,
1316 &kProcedureStep, &kManeuverAction};
1317 for (std::size_t j = 0; j < 14; ++j)
1318 graph_->set_cpt(hfe_ids_[j], expandNoisyMaxToCpt(*hfe_params[j]));
1319
1320 // Compile junction tree and create inference engine
1322 engine_ = std::make_unique<bncore::BatchExecutionEngine>(*jt_, 1, 1);
1323
1324 // Apply initial soft evidence (all PSFs = 0.0 -> [0.0, 1.0])
1325 for (std::size_t i = 0; i < 10; ++i) {
1326 double likelihoods[2] = {0.0, 1.0};
1327 engine_->set_soft_evidence(psf_ids_[i], likelihoods, 2);
1328 }
1329}
1330
1332 constexpr std::size_t NUM_VARS = 24; // 10 PSF + 14 HFE
1333 constexpr std::size_t NUM_HFE = 14;
1334
1335 // No hard evidence — all -1
1336 std::vector<int> evidence(NUM_VARS, -1);
1337
1338 // Query all 14 HFE nodes in one calibration pass.
1339 // evaluate_multi treats output_offsets as a prefix-sum array and reads
1340 // output_offsets[num_queries] for the total state count, so it needs
1341 // NUM_HFE + 1 entries.
1342 std::size_t query_vars[NUM_HFE];
1343 std::size_t output_offsets[NUM_HFE + 1];
1344 for (std::size_t i = 0; i < NUM_HFE; ++i) {
1345 query_vars[i] = hfe_ids_[i];
1346 output_offsets[i] = i * 2;
1347 }
1348 output_offsets[NUM_HFE] = NUM_HFE * 2;
1349
1350 // Do NOT invalidate the engine's workspace cache here: the single-chunk fast
1351 // path reuses the cached BatchWorkspace via reset(), which restores clean
1352 // base potentials and re-applies the current soft evidence, giving
1353 // bitwise-identical posteriors. Forcing a rebuild would pay a full
1354 // BatchWorkspace construction on every update.
1355 double output[NUM_HFE * 2] = {0.0};
1356 engine_->evaluate_multi(evidence.data(), 1, NUM_VARS, query_vars, NUM_HFE,
1357 output_offsets, output);
1358
1359 // Cache P(Failure) for each HFE (index 0 of each pair)
1360 gather_state_info = output[0];
1361 gather_info_mode = output[2];
1362 perceive_state_info = output[4];
1363 gather_new_info = output[6];
1364 diagnosis = output[8];
1365 strategy_selection = output[10];
1366 goal_selection = output[12];
1367 strategy_communication = output[14];
1368 goal_communication = output[16];
1369 procedure_transfer = output[18];
1370 mental_procedure = output[20];
1371 procedure_interpretation = output[22];
1372 procedure_step = output[24];
1373 maneuver_action = output[26];
1374
1375 needs_update_ = false;
1376}
1377
1378// Setters are value-guarded: identical evidence produces bitwise-identical
1379// posteriors, so re-applying an unchanged value (which happens every 0.5 s
1380// evaluation point via updateEvidenceForAllPSFs) must not dirty the engine.
1381// Without the guard, every tick would pay a full junction-tree calibration.
1383 if (v == system_criticality) return;
1385 double lk[2] = {v, 1.0 - v};
1386 engine_->set_soft_evidence(psf_ids_[0], lk, 2);
1387 needs_update_ = true;
1388}
1390 if (v == information_load) return;
1391 information_load = v;
1392 double lk[2] = {v, 1.0 - v};
1393 engine_->set_soft_evidence(psf_ids_[1], lk, 2);
1394 needs_update_ = true;
1395}
1397 if (v == time_constraint_load) return;
1399 double lk[2] = {v, 1.0 - v};
1400 engine_->set_soft_evidence(psf_ids_[2], lk, 2);
1401 needs_update_ = true;
1402}
1404 if (v == cognitive_task_load) return;
1406 double lk[2] = {v, 1.0 - v};
1407 engine_->set_soft_evidence(psf_ids_[3], lk, 2);
1408 needs_update_ = true;
1409}
1411 if (v == passive_alarm_load) return;
1413 double lk[2] = {v, 1.0 - v};
1414 engine_->set_soft_evidence(psf_ids_[4], lk, 2);
1415 needs_update_ = true;
1416}
1418 if (v == task_complexity) return;
1419 task_complexity = v;
1420 double lk[2] = {v, 1.0 - v};
1421 engine_->set_soft_evidence(psf_ids_[5], lk, 2);
1422 needs_update_ = true;
1423}
1425 if (v == expertise) return;
1426 expertise = v;
1427 double lk[2] = {v, 1.0 - v};
1428 engine_->set_soft_evidence(psf_ids_[6], lk, 2);
1429 needs_update_ = true;
1430}
1432 if (v == stress) return;
1433 stress = v;
1434 double lk[2] = {v, 1.0 - v};
1435 engine_->set_soft_evidence(psf_ids_[7], lk, 2);
1436 needs_update_ = true;
1437}
1439 if (v == fatigue) return;
1440 fatigue = v;
1441 double lk[2] = {v, 1.0 - v};
1442 engine_->set_soft_evidence(psf_ids_[8], lk, 2);
1443 needs_update_ = true;
1444}
1446 if (v == problem_solving_style) return;
1448 double lk[2] = {v, 1.0 - v};
1449 engine_->set_soft_evidence(psf_ids_[9], lk, 2);
1450 needs_update_ = true;
1451}
1452
1455 return gather_state_info;
1456}
1459 return gather_info_mode;
1460}
1463 return perceive_state_info;
1464}
1467 return gather_new_info;
1468}
1471 return diagnosis;
1472}
1475 return strategy_selection;
1476}
1479 return goal_selection;
1480}
1484}
1487 return goal_communication;
1488}
1491 return procedure_transfer;
1492}
1495 return mental_procedure;
1496}
1500}
1503 return procedure_step;
1504}
1507 return maneuver_action;
1508}
1509
1517 expertise = _hfebbn.expertise;
1518 stress = _hfebbn.stress;
1519 fatigue = _hfebbn.fatigue;
1522}
1523
1525 // Re-sync the engine's soft evidence with the PSF members and force
1526 // re-inference. Called after a copy and after a Boost load: a freshly
1527 // deserialized object carries the saved PSF members but an engine still
1528 // holding the constructor's zero evidence, so without this a getter would
1529 // serve posteriors computed from the wrong evidence.
1530 double psf_values[10] = {
1534 for (std::size_t i = 0; i < 10; ++i) {
1535 double lk[2] = {psf_values[i], 1.0 - psf_values[i]};
1536 engine_->set_soft_evidence(psf_ids_[i], lk, 2);
1537 }
1538 needs_update_ = true;
1539}
1540
1541#endif // ENABLE_HCL
void setTaskComplexity(double task_complexity)
std::unique_ptr< bncore::JunctionTree > jt_
double getProcedureInterpretationFailureProbability()
void setCognitiveTaskLoad(double cognitive_task_load)
void setSystemCriticality(double system_criticality)
void setTimeConstraintLoad(double time_constraint_load)
std::unique_ptr< bncore::Graph > graph_
void copyHumanFailureEventsBBN(HumanFailureEventsBBN &)
void setExpertise(double expertise)
void setProblemSolvingStyle(double problem_solving_style)
std::unique_ptr< bncore::BatchExecutionEngine > engine_
void setPassiveAlarmLoad(double passive_alarm_load)
void setInformationLoad(double information_load)
void setFatigue(double fatigue)
std::array< std::uint32_t, 14 > hfe_ids_
std::array< std::uint32_t, 10 > psf_ids_
static std::unique_ptr< JunctionTree > compile(const Graph &graph, const std::string &heuristic="min_fill")
Compiles a junction tree.
Definition: compiler.cpp:53
bncore::JunctionTreeCompiler, which turns a Graph into the JunctionTree that the inference engine run...
bncore::BatchExecutionEngine, the query interface of BNCore: exact posterior marginals and MAP states...
bncore::Graph, the discrete Bayesian network model: variables, their states, directed edges and condi...