← Documentation
ADS-IDAC Engine 5.0.0
DiagnoseInvestigator.cpp
Go to the documentation of this file.
1// DiagnoseInvestigator.cpp: implementation of the DiagnoseInvestigator class.
2//
4
6#include "Investigator.h"
7#include "EventSchemaBase.h"
8#include "ReasonMachine.h"
9#include "../Crew/OperatorDM.h"
10#include "../Crew/OperatorAT.h"
11#include "../Branch/BranchProcedureStep.h"
12#include "../Crew/DecisionProcedureStep.h"
13#include "../Branch/BranchRecord.h"
14#include "../Procedure/Procedures.h"
15#include "../Global/fmodule.h"
16#include <memory>
17#include <vector>
18#include "../Global/SimulationContext.h"
19using namespace std;
20
21
23// Construction/Destruction
25
27{
28 this->m_ID_Type = 502;
29 this->m_coverage_coefficient = 0.6;
31 this->m_event_schema_pt = NULL;
32 this->m_ES_base_ID_pt = NULL;
33 this->m_confidence = 0;
34 this->m_tbi_SI = NULL;
35 this->m_ongoing_SI = NULL;
36 this->m_event_statement_pt = NULL;
37 this->m_label_ID_pt = NULL;
38 this->m_claim_bl = false; //whether the operator has claimed that this accident happened
39 this->m_terminate_investigation = false;
40 this->m_n_hard_setback = 0;
41 this->m_procedure_entered_bl = 0; //whether the corresponding procedure has been enterred
42 this->m_branching1_prob = 0.5;
43 this->m_branching_2_1_prob = 0.1;
44 this->m_branching_2_2_prob = 0.5;
45 this->m_branching_3_1_prob = 0.4;
46 this->m_branching_3_2_prob = 0.4;
48 this->m_wm_i = 0;
49 this->m_wm_type = 0;
50 this->m_wm_procedure_step_pt = NULL;
51 this->m_procedure_step_pt = NULL;
52 this->m_event_KE_pt = NULL;
53 this->m_claim_time = 0;
54
55 this->m_wm_procedure_name = "NONE";
56 this->m_wm_procedure_step_name = "NONE";
57 this->m_procedure_name = "NONE";
58 this->m_procedure_step_name = "NONE";
59 this->m_ID_tbi_SI = "";
60 this->m_ID_ongoing_SI = "";
61 this->m_ID_label = "";
62 this->m_ID_es = "";
63 this->m_ID_KE = "";
64 this->m_ID_statement = "";
65}
66
68{
69 this->m_wm_i_list.clear();
70 this->m_wm_type_list.clear();
71 this->m_confidence_history.clear();
72 this->m_confidence_timeline.clear();
73
74 this->m_symptom_invest_list.clear();
75}
76
78{
79 Investigator * invest_pt = (Investigator*)_ID_pt;
80
81 //ES_base_pt = (EventSchemaBase *)(this->m_ES_base_ID_pt);
82
83 ReasonMachine * RM_pt;
84 if (this->m_operator == sim::Operator::ODM)
85 {RM_pt = g_sim.Decision_Maker.m_RM.get();}
86 else if (this->m_operator == sim::Operator::OAT)
87 {RM_pt = g_sim.Action_Taker.m_RM.get();}
88 else
89 {}//add error message
90
91 //Error Check first
92 if(this->m_event_schema_pt == NULL || this->m_event_statement_pt == NULL)
93 {
94 this->ErrorMessage("Error in DiagnoseInvestigator!");
95 return;
96 }
97
98 if(this->m_event_statement_pt->m_state == false || this->m_event_schema_pt->m_event_KE_pt->m_negation == true)
99 {
100 this->ErrorMessage("Error in DiagnoseInvestigator!");
101 return;
102 }
103 //
106 if(this->m_procedure_step_pt != NULL)
107 {
110 }
111
112 //record the instantiation label
114
115 //Assign the m_event_KE_pt
116 if(this->m_event_statement_pt->m_sent_pt == this->m_event_schema_pt->m_event_KE_pt->m_SentenceUnit_pt)
117 {
119 }
120 else
121 {
122 if(this->m_label_ID_pt == NULL)
123 {this->ErrorMessage("Error!");}
124
125 //Find a KE for this DiagnoseInvestigator
127 if(this->m_event_KE_pt == NULL)
128 {this->ErrorMessage("Error!");}
129 }
130
131 stringstream conv;
132 string str_ID;
133
134 //Initiate the Symptoms
135 for(auto &event_symp : this->m_event_schema_pt->m_symptom_list)
136 {
137 auto symp_invest_owned = make_unique<SymptomInvestigator>();
138 auto symp_invest_pt = symp_invest_owned.get();
139 this->m_symptom_invest_list.push_back(std::move(symp_invest_owned));
140 conv.str("");
141 conv << this->m_symptom_invest_list.size();
142 str_ID = this->m_ID + "_SI_" + conv.str();
143 symp_invest_pt->m_ID = str_ID;
144 symp_invest_pt->m_DI_ID_pt = (IDElement*)this;
145 symp_invest_pt->m_event_symptom_pt = event_symp.get();
146 symp_invest_pt->m_operator = this->m_operator;
147 symp_invest_pt->m_label_ID_pt = this->m_label_ID_pt;
148 symp_invest_pt->InitiationOfthisSymptomInvestigator();
149 }
150
152 if(this->m_confidence_history.size() == 0)
153 {
154 this->m_confidence_from_others = _p;
155 auto tvn_owned = make_unique<TimeValueNoteUnit>();
156 tvn_owned->m_time = r5pars_.timesno;
157 tvn_owned->m_value = invest_pt->m_independent_probability;
158 tvn_owned->m_string = RM_pt->m_buffer_invest_pt->m_KElement_ID_pt->m_ID;
159 tvn_owned->m_note = RM_pt->m_buffer_invest_pt->m_ID;
160 this->m_other_evidence_list.push_back(std::move(tvn_owned));
162 /*
163 this->m_confidence_history.push_back(_p);
164 this->m_confidence_timeline.push_back(r5pars_.timesno);
165 this->m_Integrated_prob_list.push_back(_p);
166 this->m_coverage_list.push_back(0);
167 this->m_N_setback_list.push_back(0);
168 this->m_N_disabled_list.push_back(0);
169 this->m_N_voided_list.push_back(0);
170 this->m_symp_confidence_list.push_back("Diagnosis investigation initiated");
171 */
172 }
173}
174
176{
177 cout << r5pars_.timesno << " " << str << '\n';
178 ofstream fout("err messages.txt", ios::app);
179 fout << r5pars_.timesno << " " << str << '\n';
180 fout.close();
181 //r5pars_.terminateall = true;
182}
183
185{
186 //to be added
187 SymptomCase * case_pt;
188 bool jump_out_bl;
189 int consistance_level;
190 Investigator * invest_pt;
191 InvestigatorLink * invest_link_pt;
192 InvestigatorLink * found_invest_link_pt;
193 vector<KnowledgeUnit *>::reverse_iterator KU_ritr;
194 vector<IDElement *>::iterator ID_itr;
195
196
197 for(auto &SI_up : this->m_symptom_invest_list)
198 {
199 consistance_level = 0;
200 auto SI_pt = SI_up.get();
201 invest_pt = _invest_pt;
202 jump_out_bl = false;
203 for(KU_ritr = SI_pt->m_event_symptom_pt->m_KU_list.rbegin(); KU_ritr != SI_pt->m_event_symptom_pt->m_KU_list.rend() && jump_out_bl == false; KU_ritr++)
204 {
205 //compare against each symptominvestigator
206 //KnowledgeUnit by KnowledgeUnit
207 //The comparison is going forward, from upperstream to downstream
208
209 //find a downstream that match
210 found_invest_link_pt = NULL;
211 for(ID_itr = invest_pt->m_downstream_ID_list.begin(); ID_itr != invest_pt->m_downstream_ID_list.end() && found_invest_link_pt == NULL; ID_itr++)
212 {
213 invest_link_pt = (InvestigatorLink*)(*ID_itr);
214 if(invest_link_pt->m_K_unit_pt == (*KU_ritr))
215 {
216 found_invest_link_pt = invest_link_pt;
217 }
218 }
219 if(found_invest_link_pt == NULL)
220 {
221 jump_out_bl = true;
222 }
223 else
224 {
225 invest_pt = (Investigator *)(found_invest_link_pt->m_downstream_ID_pt);
226 if(invest_pt->m_Happen != 4)
227 {
228 consistance_level++;
229 }
230 else
231 {break;}
232 }
233 }
234 //finish examining this SymptomInvestigator
235 if(consistance_level > 0)
236 {
237 case_pt = SI_pt->FindASymptomCaseByInvestigator(invest_pt);
238 if(case_pt == NULL)
239 {
240 //then create a case_pt
241 case_pt = new SymptomCase();
242 case_pt->m_finished_bl = false;
243 case_pt->m_invest_pt = invest_pt;
244 }
245 //update the case_pt information
246 if(consistance_level == SI_pt->m_event_symptom_pt->m_KU_list.size())
247 {
248 case_pt->m_consistant_bl = true;
249 case_pt->m_finished_bl = true;
250 case_pt->m_path_confidence = _invest_pt->m_independent_probability;
251 _invest_pt->m_independent_probability = 0;
252 case_pt->m_confirmed_time = r5pars_.timesno;
253 SI_pt->RemoveADeterminedCaseFromCandiateList(case_pt);
254 SI_pt->m_confirmed_case_list.push_back(unique_ptr<SymptomCase>(case_pt));
255 SI_pt->m_last_case_end_time = r5pars_.timesno;
256 if(case_pt->m_path_confidence > SI_pt->m_independent_symptom_probability)
257 {
258 SI_pt->m_independent_symptom_probability = case_pt->m_path_confidence;
259 }
260 //check point
261 if(SI_pt->m_symptom_KE_pt->m_ID == "KE_air_ejector_radiation_>_10")
262 {
263 this->ErrorMessage("check point");
264 }
265 }
266 else
267 {
268 case_pt->m_consistant_bl = false;
269 case_pt->m_finished_bl = true;
270 case_pt->m_path_confidence = _invest_pt->m_independent_probability * consistance_level / SI_pt->m_event_symptom_pt->m_KU_list.size();
271 _invest_pt->m_independent_probability = 0;
272 SI_pt->RemoveADeterminedCaseFromCandiateList(case_pt);
273 SI_pt->m_partial_consistant_case_list.push_back(unique_ptr<SymptomCase>(case_pt));
274
275 }
276 if(case_pt->m_path_confidence > SI_pt->m_independent_symptom_probability)
277 {
278 SI_pt->m_independent_symptom_probability = case_pt->m_path_confidence;
279 }
280 }
281 }
282
283 //To be added, add algorithm for calculating the confidence level of the DiagnoseInvestigator
285}
286
287static int compare_floats(const void*a, const void*b)
288{
289 float* arg1 = (float*)a;
290 float* arg2 = (float*)b;
291 if(*arg1 < *arg2)
292 {return 1;}
293 else
294 {return -1;}
295}
296
298{//this function calculates the DI confidence level and the interest on this DI
299 int N_consistant_symptom = 0;
300 int N_disabled_symptom = 0;
301 int N_setback_symptom = 0;
302 int N_unexplored_symptom = 0;
303 int N_voided_symptom = 0;
304 float maximum_symp_confidence = 0;
305 float coverage_fl;
306 float Integrated_prob = 1;
307 float modulator = 1;
308 float other_confidence = 0;
309 float new_confidence;
310 stringstream conv;
311// vector<Investigator *>::iterator invest_itr;
312// vector<InvestigatorLink *>::iterator invest_link_itr;
313// vector<IDElement*>::iterator ID_itr;
314// Investigator * invest_pt;
315// InvestigatorLink * link_pt;
316 int size, i;
317 string str_v;
318 size = this->m_symptom_invest_list.size();
319 vector<float> ConfidenceArray(size);
320 vector<float> OtherConfidenceArray(this->m_other_evidence_list.size());
321 ReasonMachine * RM_pt;
322 if (this->m_operator == sim::Operator::ODM)
323 {RM_pt = g_sim.Decision_Maker.m_RM.get();}
324 else if (this->m_operator == sim::Operator::OAT)
325 {RM_pt = g_sim.Action_Taker.m_RM.get();}
326 else
327 {}//add error message
328 bool vagabond_reset = false;
329
330 if(r5pars_.timesno > 1416)
331 {this->ErrorMessage("");}
332
333 i = 0;
334 for(auto &tvn : this->m_other_evidence_list)
335 {
336 OtherConfidenceArray[i] = tvn->m_value;
337 i++;
338 }
339 qsort(OtherConfidenceArray.data(), this->m_other_evidence_list.size(), sizeof(float), compare_floats);
340
341 if(this->m_other_evidence_list.size() > 0)
342 {
343 other_confidence = OtherConfidenceArray[0];
344 i = 1;
345 while(i < this->m_other_evidence_list.size())
346 {
347 other_confidence = other_confidence + (1 - other_confidence) * OtherConfidenceArray[i] * RM_pt->m_ability_of_integrating_evidence;
348 i++;
349 }
350 }
351 this->m_confidence_from_others = other_confidence;
352
353 i = 0;
354 for(auto &SI : this->m_symptom_invest_list)
355 {
356 if(SI->m_confirmed_case_list.size() > 0)
357 {
358 N_consistant_symptom ++;
359 }
360 else if(SI->m_exception_case_list.size() > 0 )
361 {
362 N_disabled_symptom ++;
363 }
364 else if(SI->m_voided_case_list.size() > 0 )
365 {
366 N_voided_symptom ++;
367 }
368 else if(SI->m_rejected_case_list.size() > 0 )
369 {
370 N_setback_symptom ++;
371 }
372 else// SI->m_inconsistant_case_list is treated as irrelevant;
373 {
374 N_unexplored_symptom ++;
375 }
376
377 if(SI->m_independent_symptom_probability > maximum_symp_confidence)
378 {
379 maximum_symp_confidence = SI->m_independent_symptom_probability;
380 }
381 ConfidenceArray[i] = SI->m_independent_symptom_probability;
382 i++;
383 }
384 qsort(ConfidenceArray.data(), size, sizeof(float), compare_floats);
385 Integrated_prob = 1;
386 if(size > 0)
387 {Integrated_prob = ConfidenceArray[0];}
388 if(size > 1)
389 {
390 for(i = 1; i < size; i++)
391 {
392 Integrated_prob = Integrated_prob + (1 - Integrated_prob)*ConfidenceArray[i]*RM_pt->m_ability_of_integrating_evidence;
393 }
394 }
395
396 Integrated_prob = Integrated_prob + (1 - Integrated_prob)*this->m_confidence_from_others * min<float>(RM_pt->m_ability_of_integrating_evidence,0.5);//caution
397
398 if(N_disabled_symptom == this->m_event_schema_pt->m_symptom_list.size())
399 {
400 this->ErrorMessage("Exception! All the symptoms are disabled!");
401 }
402 if(this->m_event_schema_pt->m_symptom_list.size() - N_disabled_symptom - N_voided_symptom == 0)
403 {
404 this->ErrorMessage("this->m_event_schema_pt->m_symptom_list.size() - N_disabled_symptom - N_voided_symptom == 0");
405 }
406 coverage_fl = (float)N_consistant_symptom/(float)(this->m_event_schema_pt->m_symptom_list.size() - N_disabled_symptom - N_voided_symptom);
407
408
409 //calculate the confidence level of this DiagnoseInvestigator and the attention level
410 new_confidence = Integrated_prob * pow((this->m_coverage_coefficient * coverage_fl + 1 - this->m_coverage_coefficient), 0.7);
412 {
413 new_confidence = pow(new_confidence, (1+0.3*N_setback_symptom));
414 }
415 else
416 {
417 new_confidence = pow(new_confidence, (1+N_setback_symptom));
418 }
419
420
421 if(this->m_confidence != new_confidence)
422 {
423 if(new_confidence > this->m_confidence && this->m_terminate_investigation == true)
424 {this->m_terminate_investigation = false;}
425 this->m_confidence = new_confidence;
426 this->m_confidence_history.push_back(new_confidence);
427 this->m_confidence_timeline.push_back(r5pars_.timesno);
428 if(RM_pt->m_event_schema_base->m_timed_DI == this)
429 {//clear this and let it to recalculate the timing of next investigation
430 RM_pt->m_event_schema_base->m_timed_DI = NULL;
431 RM_pt->m_event_schema_base->m_timing = 0;
432 }
433 else if(RM_pt->m_event_schema_base->m_timed_DI != NULL && RM_pt->m_event_schema_base->m_timed_DI->m_confidence < this->m_confidence)
434 {
435 RM_pt->m_event_schema_base->m_timed_DI = NULL;
436 RM_pt->m_event_schema_base->m_timing = 0;
437 }
438/*
439 vector<float> m_Integrated_prob_list;
440 vector<float> m_coverage_list;
441 vector<int> m_N_setback_list;
442 vector<int> m_N_disabled_list;
443 vector<string> m_symp_confidence_list;
444*/
445 this->m_Integrated_prob_list.push_back(Integrated_prob);
446 this->m_coverage_list.push_back(coverage_fl);
447 this->m_N_setback_list.push_back(N_setback_symptom);
448 this->m_N_disabled_list.push_back(N_disabled_symptom);
449 this->m_N_voided_list.push_back(N_voided_symptom);
450 str_v = "";
451 for(auto &SI : this->m_symptom_invest_list)
452 {
453 conv.str("");
454 conv << SI->m_independent_symptom_probability;
455 str_v += conv.str();
456 str_v += " ";
457 }
458 conv.str("");
459 conv << this->m_confidence_from_others;
460 str_v += conv.str();
461 this->m_symp_confidence_list.push_back(str_v);
462 }
463 this->m_attention_level = this->m_confidence * (N_unexplored_symptom + 0.3 * N_setback_symptom + 0.05* N_consistant_symptom)/this->m_event_schema_pt->m_symptom_list.size();
464 //need to remove these codes
465 if(this->m_attention_level < 0.15)
466 {this->m_attention_level = 0.15;}
467 //
468 //calculate the attention level of each SymptomInvestigator and propagate it to the Corresponding Investigator or InvestigatorLink
469 for(auto &SI : this->m_symptom_invest_list)
470 {
471 //
472 if(RM_pt->m_problem_solving_style == ProblemSolvingStyle::Vagabond && this->m_ongoing_SI == SI.get())
473 {vagabond_reset = true;}
474
475 if(SI->m_confirmed_case_list.size() > 0)
476 {
477 modulator = 0.1;
478 modulator *= 1 - SI->m_independent_symptom_probability;
479 }
480 else if(SI->m_exception_case_list.size() > 0)
481 {modulator = 0.5;}
482 else if(SI->m_rejected_case_list.size() > 0)
483 {modulator = 0.2;}
484 else
485 {modulator = 1.0;}
486 SI->m_attention_level = this->m_attention_level * modulator*5;
487 for(auto &sc : SI->m_candidate_case_list)
488 {
489 sc->m_invest_pt->BoostAttentionofThisByDiagnosisInvestigation(SI->m_attention_level, vagabond_reset);
490 }
491 /*
492 for(invest_itr = (*SI_itr)->m_ongoing_invest_list.begin(); invest_itr != (*SI_itr)->m_ongoing_invest_list.end(); invest_itr++)
493 {
494 (*invest_itr)->m_interest_from_SymptomInvestigator = (*SI_itr)->m_attention_level;
495 //
496 if(vagabond_reset == true)
497 {(*invest_itr)->m_last_active_time = r5pars_.timesno;}
498
499 if((*invest_itr)->m_invest_pause == true)
500 {
501 for(ID_itr = (*invest_itr)->m_upperstream_ID_list.begin(); ID_itr != (*invest_itr)->m_upperstream_ID_list.end(); ID_itr++)
502 {
503 link_pt = (InvestigatorLink *)(*ID_itr);
504 if(link_pt->m_invest_link_dormant == false)
505 {
506 link_pt->m_interest_from_SymptomInvestigator = (*SI_itr)->m_attention_level;
507 }
508 }
509 }
510 }
511 for(invest_link_itr = (*SI_itr)->m_ongoing_invest_link_list.begin(); invest_link_itr != (*SI_itr)->m_ongoing_invest_link_list.end(); invest_link_itr++)
512 {
513 (*invest_link_itr)->m_interest_from_SymptomInvestigator = (*SI_itr)->m_attention_level;
514
515 //
516 if(vagabond_reset == true)
517 {
518 invest_pt = (Investigator*)(*invest_link_itr)->m_downstream_ID_pt;
519 invest_pt->m_last_active_time = r5pars_.timesno;
520 }
521 //if((*invest_link_itr)->m_invest_link_pause == true)
522 //{
523 for(ID_itr = (*invest_link_itr)->m_upperstream_ID_list.begin(); ID_itr != (*invest_link_itr)->m_upperstream_ID_list.end(); ID_itr++)
524 {
525 invest_pt = (Investigator*)(*ID_itr);
526 //if(invest_pt->m_invest_dormant == false)
527 invest_pt->m_interest_from_SymptomInvestigator = (*SI_itr)->m_attention_level;
528 //
529 if(vagabond_reset == true)
530 {invest_pt->m_last_active_time = r5pars_.timesno;}
531 }
532 //}
533 }
534 */
535 }
536
537 if(this->m_confidence > this->m_diagnose_claim_threshold && this->m_claim_bl == 0)
538 {
539 if(this->m_operator == sim::Operator::ODM)
540 {
542 {return;}
543 }
544 else if(this->m_operator == sim::Operator::OAT)
545 {
547 {return;}
548 }
550 }
551}
552
554{
555 for(auto &SI : this->m_symptom_invest_list)
556 {
557 SI->SITrackTheOngoingInvestigation();
558 }
560}
561
563{
564
565}
566
568{
569 SymptomInvestigator *found_unexplored_SI = NULL;
570 SymptomInvestigator *found_rejected_SI = NULL;
571 SymptomInvestigator *found_explored_SI = NULL;
572 vector<KnowledgeUnit *>::iterator KU_itr;
573 float rejection_time = 0;
574 float confirmed_time = 0;
575 float retrieve_score, retrieve_score2;
576 this->m_ongoing_SI = NULL;
577 bool exist_bl;
578 //check point
579 if(r5pars_.timesno > 2644)
580 {
581 this->ErrorMessage("Check point!");
582 }
583 if(this->m_terminate_investigation == true)
584 {this->m_tbi_SI = NULL; return;}
585 for(auto &SI : this->m_symptom_invest_list)
586 {
587 if(this->m_ongoing_SI != NULL) break;
588 exist_bl = false;
589 if(SI->m_candidate_case_list.size() > 0)
590 {
591 if(SI->m_confirmed_case_list.size() == 0 || SI->m_independent_symptom_probability < ((EventSchemaBase *)(this->m_ES_base_ID_pt))->m_active_investigation_threshold)//using the threshold
592 {
593 for(auto &sc : SI->m_candidate_case_list)
594 {
595 if(SI->m_need_to_invest_opposite_bl == true)
596 {
597 if(sc->m_invest_pt->m_KElement_ID_pt == (IDElement *)(SI->m_opposite_KE_pt))
598 {exist_bl = true;}
599 }
600 else if(sc->m_invest_pt->m_KElement_ID_pt == (IDElement *)(SI->m_symptom_KE_pt))
601 {exist_bl = true;}
602 }
603
604 if(SI->m_voided_case_list.size() > 0 || SI->m_exception_case_list.size() > 0)
605 {exist_bl = false;}
606
607 if(exist_bl == true)
608 {this->m_ongoing_SI = SI.get();return;}
609 }
610 }
611
612 if(SI->m_confirmed_case_list.size() == 0)
613 {
614 if(SI->m_rejected_case_list.size() > 0 && SI->m_exception_case_list.size() == 0)
615 {
616 if(found_rejected_SI == NULL)
617 {
618 found_rejected_SI = SI.get();
619 rejection_time = SI->m_last_case_end_time;
620 }
621 else if(rejection_time > SI->m_last_case_end_time)
622 {
623 found_rejected_SI = SI.get();
624 rejection_time = SI->m_last_case_end_time;
625 }
626 }
627 else if(SI->m_voided_case_list.size() > 0)
628 {}
629 else if(SI->m_exception_case_list.size() == 0)
630 {
631 retrieve_score2 = 1;
632 KU_itr = SI->m_event_symptom_pt->m_KU_list.begin();
633 while(KU_itr != SI->m_event_symptom_pt->m_KU_list.end())
634 {
635 retrieve_score2 *= (*KU_itr)->m_forward_retrieve_weight;
636 KU_itr++;
637 }
638 if(found_unexplored_SI == NULL)
639 {//investigate the unexplored SI from the first to last
640 found_unexplored_SI = SI.get();
641 retrieve_score = retrieve_score2;
642 }
643 else
644 {
645 if(retrieve_score2 > retrieve_score)
646 {
647 found_unexplored_SI = SI.get();
648 retrieve_score = retrieve_score2;
649 }
650 }
651 }
652 }
653 else if(SI->m_voided_case_list.size() > 0)//take this option out if there is a voided symptom found
654 {}
655 else if(SI->m_independent_symptom_probability < 0.09)
656 {
657 if(found_explored_SI == NULL)
658 {
659 found_explored_SI = SI.get();
660 confirmed_time = SI->m_last_case_end_time;
661 }
662 else if(confirmed_time > SI->m_last_case_end_time)
663 {
664 found_explored_SI = SI.get();
665 confirmed_time = SI->m_last_case_end_time;
666 }
667 }
668 }
669 //
670 //unexplored SI is prioritized over rejected SI over confirmed SI
671 if(this->m_ongoing_SI == NULL)
672 {
673 if(found_unexplored_SI != NULL)
674 {
675 this->m_tbi_SI = found_unexplored_SI;
676 }
677 else
678 {
679 if(found_rejected_SI)
680 {
681 this->m_tbi_SI = found_rejected_SI;
682 }
683 else if(found_explored_SI == NULL)
684 {
685 this->m_tbi_SI = found_explored_SI;
686 }
687
688 /*if(found_rejected_SI != NULL && found_explored_SI != NULL)
689 {
690 if(rejection_time < confirmed_time )
691 {this->m_tbi_SI = found_rejected_SI;}
692 else
693 {this->m_tbi_SI = found_explored_SI;}
694 }*/
695 }
696 }
697 //check point
698 if(this->m_tbi_SI != NULL)
699 {
700 if(this->m_tbi_SI->m_symptom_KE_pt->m_ID == "KE_SG_A_level_increase")
701 {
702 this->ErrorMessage("check point");
703 }
704 }
705}
706
707
708
710{
711 this->m_claim_bl = 1;
712 this->m_claim_time = r5pars_.timesno;
713 ProcedureBranchingInfo * branch_info;
714
715 BranchProcedureStep * b_procedure_step_pt;
716 string current_procedure_name, current_step_name;
717
718 if(this->m_procedure_step_pt == NULL)
719 {return;}
720
721 if(this->m_operator == sim::Operator::ODM)
722 {
725 }
726 else if(this->m_operator == sim::Operator::OAT)
727 {
730 }
731 else
732 {
733 this->ErrorMessage("Unrecognized Operator!");
734 }
735
736 if(this->m_procedure_entered_bl == true)
737 {return;}
738
739 //add the second branch-the operator decides to stay in the current procedure
740 {
741 auto bps_owned = make_unique<BranchProcedureStep>();
742 b_procedure_step_pt = bps_owned.get();
743 b_procedure_step_pt->setSenderAndReceiver(this->m_operator, this->m_operator);
744 b_procedure_step_pt->setTimerAndProbability(1.0, 1 - this->m_branching1_prob);
745 b_procedure_step_pt->setProcedureName(current_procedure_name);
746 b_procedure_step_pt->setStepName(current_step_name);
747 b_procedure_step_pt->setLastProcedureName(current_procedure_name);
748 b_procedure_step_pt->setLastStepName(current_step_name);
749 b_procedure_step_pt->setStateOfActivation(sim::Source::Bypass);
751 g_sim.Branch_center.addProcedureStep(this->m_operator, bps_owned.release());
752 //
753 auto bi_owned = make_unique<ProcedureBranchingInfo>();
754 branch_info = bi_owned.get();
755 branch_info->s_current_procedure_name = current_procedure_name;
756 branch_info->s_current_step_name = current_step_name;
757 branch_info->s_procedure_name = b_procedure_step_pt->getProcedureName();
758 branch_info->s_step_name = b_procedure_step_pt->getStepName();
759 branch_info->s_branching_type = 1;
760 branch_info->s_branching_choice = 1; //choice 2
761 branch_info->s_branching_time = r5pars_.timesno;
762 this->m_branching_info_list.push_back(std::move(bi_owned));
763 }
764
765 //add one branch--the operator transfer to the associated procedure step immediately after s/he claims an accident
766 {
767 auto bps_owned = make_unique<BranchProcedureStep>();
768 b_procedure_step_pt = bps_owned.get();
769 b_procedure_step_pt->setSenderAndReceiver(this->m_operator, this->m_operator);
770 b_procedure_step_pt->setTimerAndProbability(1.0, this->m_branching1_prob);
771 b_procedure_step_pt->setProcedureName(this->m_procedure_step_pt->getCurrentProcedureName());
772 b_procedure_step_pt->setStepName(this->m_procedure_step_pt->getCurrentStepName());
773 b_procedure_step_pt->setLastProcedureName(current_procedure_name);
774 b_procedure_step_pt->setLastStepName(current_step_name);
776 g_sim.Branch_center.addProcedureStep(this->m_operator, bps_owned.release());
777 //
778 auto bi_owned = make_unique<ProcedureBranchingInfo>();
779 branch_info = bi_owned.get();
780 branch_info->s_current_procedure_name = current_procedure_name;
781 branch_info->s_current_step_name = current_step_name;
782 branch_info->s_procedure_name = b_procedure_step_pt->getProcedureName();
783 branch_info->s_step_name = b_procedure_step_pt->getStepName();
784 branch_info->s_branching_type = 1;
785 branch_info->s_branching_choice = 2; //choice 2
786 branch_info->s_branching_time = r5pars_.timesno;
787 this->m_branching_info_list.push_back(std::move(bi_owned));
788 }
789
790}
791
793{
794 DecisionProcedureStep * current_procedure_step_pt;
795 ProcedureStepUnit * step_unit_pt;
796 map<string, ProcedureStep *>::iterator procedure_map_itr;
797 vector<unique_ptr<ProcedureStepUnit>>::iterator step_unit_itr;
798 ProcedureStepInfo * step_info_pt;
799 int i;
800
801 if(this->m_procedure_name == "" || this->m_procedure_step_name == "")
802 {
803 if(this->m_procedure_step_pt == NULL)
804 {
805 return; // this event is not linked with a procedure at all
806 }
807 else
808 {
811 }
812 }
813
815
816 if(this->m_operator == sim::Operator::ODM)
817 {
819 }
820 else
821 {
823 }
824
825 //find the currently working on procedure step
826 if(current_procedure_step_pt == 0)
827 {
828 return; // The operators have not entered a procedure yet.
829 }
830
831 if(current_procedure_step_pt->getProcedureName().compare(this->m_procedure_step_pt->getCurrentProcedureName()) == 0)
832 {
833 this->m_procedure_entered_bl = true;
834 return;
835 }
836
837 procedure_map_itr = g_sim.All_procedure.procedure_map.find(current_procedure_step_pt->getProcedureName() + current_procedure_step_pt->getStepName());
838 if(procedure_map_itr != g_sim.All_procedure.procedure_map.end())
839 {
840 this->m_wm_procedure_step_pt = procedure_map_itr->second;
841 }
842 else
843 {
844 this->ErrorMessage("Could not find this procedure step: " + current_procedure_step_pt->getProcedureName() + current_procedure_step_pt->getStepName());
845 return;
846 }
847
848 //firstly check whether this is a transfer point to the associated procedure
849 i = 0;
850 for(step_unit_itr = this->m_wm_procedure_step_pt->procedure_step_unit.begin(); step_unit_itr != this->m_wm_procedure_step_pt->procedure_step_unit.end(); step_unit_itr++)
851 {
852 step_unit_pt = step_unit_itr->get();
854 {
855 step_info_pt = step_unit_pt->non_response_procedure.get();
856 if(step_info_pt->getProcedureName().compare(this->m_procedure_name) == 0)//whether add the step name in the comparison?
857 {
858 this->m_wm_i_list.push_back(i);
859 this->m_wm_type_list.push_back(1); //1--non response procedure transfer
860 }
861 }
862 i++;
863 }
864 if(this->m_wm_procedure_step_pt->getNextProcedureName().compare(this->m_procedure_name) == 0)
865 {
866 this->m_wm_i_list.push_back(i); // i beyonds the list size, that means it is the next procedure step
867 this->m_wm_type_list.push_back(0); //procedure transfer at the end of a procedure step
868 }
869}
870
872{
873 this->m_wm_i_list.clear();
874 this->m_wm_type_list.clear();
875 this->m_wm_procedure_step_pt = NULL;
876}
877
879{
880 string current_procedure_name, current_step_name;
881 string name1, name2;
882 int current_i;
883 vector<int>::iterator i_itr;
884 vector<int>::iterator i_type_itr;
885 vector<unique_ptr<ProcedureStepUnit>>::iterator ps_unit_itr;
886 ProcedureStepUnit *ps_unit_pt = 0;
887 bool found_bl = false;
888 bool bps_existing = false;
889 int state_of_activation;
890 //b_procedure_step_itr: declared as auto at point of use below
891 BranchProcedureStep * b_procedure_step_pt;
892 ProcedureBranchingInfo * branch_info;
893 int prior_choice = 0;
894
895 if (r5pars_.timesno > 1404)
896 {prior_choice = 0;}
897
898
899 if(this->m_operator != sim::Operator::ODM)
900 {return;}
901
902 if(this->m_procedure_entered_bl == true || this->m_procedure_step_pt == NULL)
903 {return;}
904
905 if(this->m_wm_procedure_step_pt == NULL)
906 {
908 }
909 else
910 {
913 if(current_procedure_name.compare(this->m_wm_procedure_step_pt->getCurrentProcedureName()) != 0
914 || current_step_name.compare(this->m_wm_procedure_step_pt->getCurrentStepName()) != 0)
915 {
917 }
918 }
919 if(this->m_wm_procedure_step_pt != NULL)
920 {
923 }
924 else
925 {return;}
926
927 if(this->m_confidence < 0.2 )
928 {return;}
929
933 this->m_branching_3_2_prob = (1- this->m_confidence)/2;
934 //Type 1 branchign: When an accident is claimed, whether or not transfer to the desired procedure immediately
935 //
936 //Type 2 branching: the current procedure step contains a transfer to the desired procedure
937 // but the transfer conditions are not satisfied
938 //Type 3 branching: the current procedure step transfers to a third procedure
939
940 //Find the progress with the current procedure step
941 ps_unit_itr = this->m_wm_procedure_step_pt->procedure_step_unit.begin();
942 current_i = 0;
943 while(ps_unit_itr != this->m_wm_procedure_step_pt->procedure_step_unit.end() && !found_bl)
944 {
945 state_of_activation = (*ps_unit_itr)->getStateOfActivation();
946 if(state_of_activation == sim::None || state_of_activation == sim::State::Active){
947 found_bl = true;
948 continue;
949 }
950 ps_unit_itr++;
951 current_i++;
952 }
953 //if(found_bl == false && current_i > 0)
954 //{return;}
955 //start to compare the progress with the potential branching points.
956 if(this->m_wm_i_list.size() > 0)
957 {
958 if(current_i <= this->m_wm_i_list[0])
959 {
960 //check branching type 21, in the current procedure step, it transits before reaching to the key step
961 //intercept the procedurestep branches in the Branch_Record
963 {//Match the type 21 branching condition
964 prior_choice = this->FindARecentSimilarBranching(21, current_procedure_name, current_step_name);
965
967 {
968 //branch 1: follow the procedure
969 b_procedure_step_pt = g_sim.Branch_center.ODM_branch.procedure_step.begin()->get();
970 if(prior_choice == 0)
971 {b_procedure_step_pt->setTimerAndProbability(1.0, 1 - this->m_branching_2_1_prob);}
972 else if(prior_choice == 1)
973 {b_procedure_step_pt->setTimerAndProbability(1.0, 1);}
974 else if(prior_choice == 2)
975 {
979 }
980
981 //ProcedureBranchingInfo * branch_info;
982 if(prior_choice != 2)
983 {
984 auto bi_owned = make_unique<ProcedureBranchingInfo>();
985 branch_info = bi_owned.get();
986 branch_info->s_current_procedure_name = current_procedure_name;
987 branch_info->s_current_step_name = current_step_name;
988 branch_info->s_procedure_name = b_procedure_step_pt->getProcedureName();
989 branch_info->s_step_name = b_procedure_step_pt->getStepName();
990 branch_info->s_branching_type = 21;
991 branch_info->s_branching_choice = 1; // choice 1
992 branch_info->s_branching_time = r5pars_.timesno;
993 this->m_branching_info_list.push_back(std::move(bi_owned));
994 }
995 //branch 2: transit to the desired procedure
996 {
997 auto bps_owned = make_unique<BranchProcedureStep>();
998 b_procedure_step_pt = bps_owned.get();
999 b_procedure_step_pt->setSenderAndReceiver(this->m_operator, this->m_operator);
1000 b_procedure_step_pt->setProcedureName(this->m_procedure_step_pt->getCurrentProcedureName());
1001 b_procedure_step_pt->setStepName(this->m_procedure_step_pt->getCurrentStepName());
1002 b_procedure_step_pt->setLastProcedureName(current_procedure_name);
1003 b_procedure_step_pt->setLastStepName(current_step_name);
1005 if(prior_choice == 0)
1006 {b_procedure_step_pt->setTimerAndProbability(1.0, this->m_branching_2_1_prob);}
1007 else if(prior_choice == 2)
1008 {b_procedure_step_pt->setTimerAndProbability(1.0, this->m_branching_2_1_prob);}
1009
1010 if(prior_choice != 1)
1011 {g_sim.Branch_center.addProcedureStep(this->m_operator, bps_owned.release());}
1012 // else: bps_owned auto-deletes at scope end
1013 }
1014
1015 //ProcedureBranchingInfo * branch_info;
1016 if(prior_choice != 1)
1017 {
1018 auto bi_owned = make_unique<ProcedureBranchingInfo>();
1019 branch_info = bi_owned.get();
1020 branch_info->s_current_procedure_name = current_procedure_name;
1021 branch_info->s_current_step_name = current_step_name;
1022 branch_info->s_procedure_name = b_procedure_step_pt->getProcedureName();
1023 branch_info->s_step_name = b_procedure_step_pt->getStepName();
1024 branch_info->s_branching_type = 21;
1025 branch_info->s_branching_choice = 2; //choice 2
1026 branch_info->s_branching_time = r5pars_.timesno;
1027 this->m_branching_info_list.push_back(std::move(bi_owned));
1028 }
1029 }
1030 else
1031 {this->ErrorMessage("Unexpected!");}
1032 }
1033 }
1034 else if(current_i > this->m_wm_i_list[0])
1035 {
1036 if(this->m_wm_type_list[0] == 1)
1037 {//Match the type 22 branching condition, generate branch
1038 //to be added
1040 {bps_existing = true;}
1041 else
1042 {bps_existing = false;}
1043
1044 prior_choice = this->FindARecentSimilarBranching(22, current_procedure_name, current_step_name);
1045
1047 {
1048 //add one branch--the operator transfer to the associated procedure step
1049 {
1050 auto bps_owned = make_unique<BranchProcedureStep>();
1051 b_procedure_step_pt = bps_owned.get();
1052 b_procedure_step_pt->setSenderAndReceiver(this->m_operator, this->m_operator);
1053 b_procedure_step_pt->setProcedureName(this->m_procedure_step_pt->getCurrentProcedureName());
1054 b_procedure_step_pt->setStepName(this->m_procedure_step_pt->getCurrentStepName());
1055 b_procedure_step_pt->setLastProcedureName(current_procedure_name);
1056 b_procedure_step_pt->setLastStepName(current_step_name);
1058 if(prior_choice == 0)
1059 {b_procedure_step_pt->setTimerAndProbability(1.0, this->m_branching_2_2_prob);}
1060 else if(prior_choice == 1)
1061 {b_procedure_step_pt->setTimerAndProbability(1.0, 1);}
1062 else if(prior_choice == 2)
1063 {} // bps_owned auto-deletes at scope end
1064 else
1065 {this->ErrorMessage("the prior_choice type could not be recognized"); return;}
1066 if(prior_choice != 2)
1067 {g_sim.Branch_center.addProcedureStep(this->m_operator, bps_owned.release());}
1068 }
1069
1070 //ProcedureBranchingInfo * branch_info;
1071 if(prior_choice != 2)
1072 {
1073 auto bi_owned = make_unique<ProcedureBranchingInfo>();
1074 branch_info = bi_owned.get();
1075 branch_info->s_current_procedure_name = current_procedure_name;
1076 branch_info->s_current_step_name = current_step_name;
1077 branch_info->s_procedure_name = b_procedure_step_pt->getProcedureName();
1078 branch_info->s_step_name = b_procedure_step_pt->getStepName();
1079 branch_info->s_branching_type = 22;
1080 branch_info->s_branching_choice = 1; // choice 1
1081 branch_info->s_branching_time = r5pars_.timesno;
1082 this->m_branching_info_list.push_back(std::move(bi_owned));
1083 }
1084
1085 //add the second branch-the operator decides to stay in the current procedure
1086 {
1087 unique_ptr<BranchProcedureStep> bps_owned;
1088 if(bps_existing == true)
1089 {b_procedure_step_pt = g_sim.Branch_center.ODM_branch.procedure_step.begin()->get();}
1090 else
1091 {
1092 bps_owned = make_unique<BranchProcedureStep>();
1093 b_procedure_step_pt = bps_owned.get();
1094 b_procedure_step_pt->setSenderAndReceiver(this->m_operator, this->m_operator);
1095 b_procedure_step_pt->setProcedureName(current_procedure_name);
1096 b_procedure_step_pt->setStepName(current_step_name);
1097 b_procedure_step_pt->setLastProcedureName(current_procedure_name);
1098 b_procedure_step_pt->setLastStepName(current_step_name);
1099 b_procedure_step_pt->setStateOfActivation(sim::Source::Bypass);
1101 }
1102 if(prior_choice == 0)
1103 {b_procedure_step_pt->setTimerAndProbability(1.0, 1 - this->m_branching_2_2_prob);}
1104 else if(prior_choice == 2)
1105 {b_procedure_step_pt->setTimerAndProbability(1.0, 1);}
1106 else if(prior_choice == 1)
1107 {
1108 if(bps_existing == true)
1109 {
1113 }
1114 // else: bps_owned auto-deletes at scope end
1115 }
1116 else
1117 {this->ErrorMessage("the prior_choice could not be recognized");}
1118 if(prior_choice != 1 && bps_existing == false)
1119 {g_sim.Branch_center.addProcedureStep(this->m_operator, bps_owned.release());}
1120 }
1121
1122 //ProcedureBranchingInfo * branch_info;
1123 if(prior_choice != 1)
1124 {
1125 auto bi_owned = make_unique<ProcedureBranchingInfo>();
1126 branch_info = bi_owned.get();
1127 branch_info->s_current_procedure_name = current_procedure_name;
1128 branch_info->s_current_step_name = current_step_name;
1129 branch_info->s_procedure_name = b_procedure_step_pt->getProcedureName();
1130 branch_info->s_step_name = b_procedure_step_pt->getStepName();
1131 branch_info->s_branching_type = 22;
1132 branch_info->s_branching_choice = 2; // choice 2
1133 branch_info->s_branching_time = r5pars_.timesno;
1134 this->m_branching_info_list.push_back(std::move(bi_owned));
1135 }
1136 }
1137 else
1138 {this->ErrorMessage("Unexpected!");}
1139 }
1140 //delete the passed key points
1141 i_itr = this->m_wm_i_list.begin();
1142 i_type_itr = this->m_wm_type_list.begin();
1143 this->m_wm_i_list.erase(i_itr);
1144 this->m_wm_type_list.erase(i_type_itr);
1145 }
1146 }
1147 else
1148 {
1150 {//type 3 branching
1151 //check whether it transits to a different procedure
1152 b_procedure_step_pt = g_sim.Branch_center.ODM_branch.procedure_step.begin()->get();
1153 name1 = b_procedure_step_pt->getLastProcedureName();
1154 name2 = b_procedure_step_pt->getProcedureName();
1155 prior_choice = this->FindARecentSimilarBranching(3, current_procedure_name, current_step_name);
1156 if(name1.compare(name2) != 0)
1157 {//type 3 branching happending
1158
1159 if(prior_choice == 0)
1160 {b_procedure_step_pt->setTimerAndProbability(1.0, this->m_branching_3_2_prob);}
1161 else if(prior_choice == 2)
1162 {b_procedure_step_pt->setTimerAndProbability(1.0, 1);}
1163 else if(prior_choice == 1 || prior_choice == 3)
1164 {
1168 }
1169 else
1170 {this->ErrorMessage("the prior_choice could not be recognized"); return;}
1171
1172 //ProcedureBranchingInfo * branch_info;
1173 if(prior_choice == 0 || prior_choice == 2)
1174 {
1175 auto bi_owned = make_unique<ProcedureBranchingInfo>();
1176 branch_info = bi_owned.get();
1177 branch_info->s_current_procedure_name = current_procedure_name;
1178 branch_info->s_current_step_name = current_step_name;
1179 branch_info->s_procedure_name = b_procedure_step_pt->getProcedureName();
1180 branch_info->s_step_name = b_procedure_step_pt->getStepName();
1181 branch_info->s_branching_type = 3;
1182 branch_info->s_branching_choice = 2; // choice 2
1183 branch_info->s_branching_time = r5pars_.timesno;
1184 this->m_branching_info_list.push_back(std::move(bi_owned));
1185 }
1186
1187 //add the second branch-the operator decides to transit to the desired procedure
1188 {
1189 auto bps_owned = make_unique<BranchProcedureStep>();
1190 b_procedure_step_pt = bps_owned.get();
1191 b_procedure_step_pt->setSenderAndReceiver(this->m_operator, this->m_operator);
1192 b_procedure_step_pt->setProcedureName(this->m_procedure_step_pt->getCurrentProcedureName());
1193 b_procedure_step_pt->setStepName(this->m_procedure_step_pt->getCurrentStepName());
1194 b_procedure_step_pt->setLastProcedureName(current_procedure_name);
1195 b_procedure_step_pt->setLastStepName(current_step_name);
1197 if(prior_choice == 0)
1198 {b_procedure_step_pt->setTimerAndProbability(1.0, this->m_branching_3_1_prob);}
1199 else if(prior_choice == 1)
1200 {b_procedure_step_pt->setTimerAndProbability(1.0, 1);}
1201 else if(prior_choice == 2 || prior_choice == 3)
1202 {} // bps_owned auto-deletes at scope end
1203 else
1204 {this->ErrorMessage("the prior choice could not be recognized"); return;}
1205
1206 if(prior_choice == 0 || prior_choice == 1)
1207 {g_sim.Branch_center.addProcedureStep(this->m_operator, bps_owned.release());}
1208 }
1209 //ProcedureBranchingInfo * branch_info;
1210
1211 if(prior_choice == 0 || prior_choice == 1)
1212 {
1213 auto bi_owned = make_unique<ProcedureBranchingInfo>();
1214 branch_info = bi_owned.get();
1215 branch_info->s_current_procedure_name = current_procedure_name;
1216 branch_info->s_current_step_name = current_step_name;
1217 branch_info->s_procedure_name = b_procedure_step_pt->getProcedureName();
1218 branch_info->s_step_name = b_procedure_step_pt->getStepName();
1219 branch_info->s_branching_type = 3;
1220 branch_info->s_branching_choice = 1; // choice 1
1221 branch_info->s_branching_time = r5pars_.timesno;
1222 this->m_branching_info_list.push_back(std::move(bi_owned));
1223 }
1224
1225 //add the third branch-the operator decides to stay in the current procedure
1226 {
1227 auto bps_owned = make_unique<BranchProcedureStep>();
1228 b_procedure_step_pt = bps_owned.get();
1229 b_procedure_step_pt->setSenderAndReceiver(this->m_operator, this->m_operator);
1230 b_procedure_step_pt->setProcedureName(current_procedure_name);
1231 b_procedure_step_pt->setStepName(current_step_name);
1232 b_procedure_step_pt->setLastProcedureName(current_procedure_name);
1233 b_procedure_step_pt->setLastStepName(current_step_name);
1234 b_procedure_step_pt->setStateOfActivation(sim::Source::Bypass);
1236 if(prior_choice == 0)
1237 {b_procedure_step_pt->setTimerAndProbability(1.0, 1 - this->m_branching_3_1_prob - this->m_branching_3_2_prob);}
1238 else if(prior_choice == 3)
1239 {b_procedure_step_pt->setTimerAndProbability(1.0, 1);}
1240 else if(prior_choice == 1 || prior_choice == 2)
1241 {} // bps_owned auto-deletes at scope end
1242 else
1243 {this->ErrorMessage("the prior_choice could not be recognized"); return;}
1244
1245 if(prior_choice == 0 || prior_choice == 3)
1246 {g_sim.Branch_center.addProcedureStep(this->m_operator, bps_owned.release());}
1247 }
1248 //ProcedureBranchingInfo * branch_info;
1249 if(prior_choice == 0 || prior_choice == 3)
1250 {
1251 auto bi_owned = make_unique<ProcedureBranchingInfo>();
1252 branch_info = bi_owned.get();
1253 branch_info->s_current_procedure_name = current_procedure_name;
1254 branch_info->s_current_step_name = current_step_name;
1255 branch_info->s_procedure_name = b_procedure_step_pt->getProcedureName();
1256 branch_info->s_step_name = b_procedure_step_pt->getStepName();
1257 branch_info->s_branching_type = 3;
1258 branch_info->s_branching_choice = 3;
1259 branch_info->s_branching_time = r5pars_.timesno;
1260 this->m_branching_info_list.push_back(std::move(bi_owned));
1261 }
1262 }
1263 }
1264 else if(g_sim.Branch_center.ODM_branch.procedure_step.size() > 1)
1265 {
1266 this->ErrorMessage("Unexpected!");
1267 }
1268 else if((this->m_claim_bl == true) && (r5pars_.timesno - this->m_claim_time > this->m_event_schema_pt->m_max_delay))
1269 {
1270 //type 4 branching, transit to the desired procedure after a certain period of time of claiming an accident
1272 {
1276 }
1277 {
1278 auto bps_owned = make_unique<BranchProcedureStep>();
1279 b_procedure_step_pt = bps_owned.get();
1280 b_procedure_step_pt->setSenderAndReceiver(this->m_operator, this->m_operator);
1281 b_procedure_step_pt->setTimerAndProbability(1.0, 1.0);
1282 b_procedure_step_pt->setProcedureName(this->m_procedure_step_pt->getCurrentProcedureName());
1283 b_procedure_step_pt->setStepName(this->m_procedure_step_pt->getCurrentStepName());
1284 b_procedure_step_pt->setLastProcedureName(current_procedure_name);
1285 b_procedure_step_pt->setLastStepName(current_step_name);
1287 g_sim.Branch_center.addProcedureStep(this->m_operator, bps_owned.release());
1288
1289 auto bi_owned = make_unique<ProcedureBranchingInfo>();
1290 branch_info = bi_owned.get();
1291 branch_info->s_current_procedure_name = current_procedure_name;
1292 branch_info->s_current_step_name = current_step_name;
1293 branch_info->s_procedure_name = b_procedure_step_pt->getProcedureName();
1294 branch_info->s_step_name = b_procedure_step_pt->getStepName();
1295 branch_info->s_branching_type = 4;
1296 branch_info->s_branching_choice = 0;
1297 branch_info->s_branching_time = r5pars_.timesno;
1298 this->m_branching_info_list.push_back(std::move(bi_owned));
1299 }
1300 }
1301 }
1302
1303}
1304
1306{
1307 this->CopyIDElementToRestartInfo((IDElement*)_di_pt);
1309
1310 //new add
1311 this->m_branching_info_list.clear();
1312
1313
1314
1315 //to be added
1316/*
1317 int m_wm_type;
1318 int m_wm_i;
1319 int m_operator;
1320 bool m_contain_transfer_point_to_associate_procedure_bl;
1321 bool m_claim_bl;
1322 bool m_procedure_entered_bl;
1323 float m_branching1_prob;
1324 float m_branching_2_1_prob; //probability of transiting to the desired procedrue
1325 float m_branching_2_2_prob; //probability of transiting to the desired procedure
1326 float m_branching_3_1_prob; //probability of transiting to the desired procedure
1327 float m_branching_3_2_prob; //probability of literally following the procedure guidance
1328 float m_diagnose_claim_threshold;
1329 float m_claim_time;
1330 float m_attention_level;
1331 float m_confidence;
1332*/
1333 this->m_wm_type = _di_pt->m_wm_type;
1334 this->m_wm_i = _di_pt->m_wm_i;
1335 this->m_operator = _di_pt->m_operator;
1337 this->m_claim_bl = _di_pt->m_claim_bl;
1339 this->m_branching1_prob = _di_pt->m_branching1_prob;
1345 this->m_claim_time = _di_pt->m_claim_time;
1346 this->m_attention_level = _di_pt->m_attention_level;
1347 this->m_confidence = _di_pt->m_confidence;
1349 this->m_n_hard_setback = _di_pt->m_n_hard_setback;
1351
1352//check the size of each vector
1353 if(this->m_wm_i_list.size() != 0)
1354 {this->ErrorMessage("this->m_wm_i_list.size() != 0");return;}
1355 if(this->m_wm_type_list.size() != 0)
1356 {this->ErrorMessage("this->m_wm_type_list.size() != 0");return;}
1357 if(this->m_confidence_history.size() != 0)
1358 {this->ErrorMessage("this->m_confidence_history.size() != 0");return;}
1359 if(this->m_confidence_timeline.size() != 0)
1360 {this->ErrorMessage("this->m_confidence_timeline.size() != 0");return;}
1361/*
1362 vector<int> m_wm_i_list;
1363 vector<int> m_wm_type_list;
1364 vector<float> m_confidence_history;
1365 vector<float> m_confidence_timeline;
1366*/
1367 vector<int>::iterator int_itr;
1368 vector<float>::iterator fl_itr;
1369 int i;
1370 float fl;
1371 for(int_itr = _di_pt->m_wm_i_list.begin(); int_itr != _di_pt->m_wm_i_list.end(); int_itr++)
1372 {
1373 i = *int_itr;
1374 this->m_wm_i_list.push_back(i);
1375 }
1376 for(int_itr = _di_pt->m_wm_type_list.begin(); int_itr != _di_pt->m_wm_type_list.end(); int_itr++)
1377 {
1378 i = *int_itr;
1379 this->m_wm_type_list.push_back(i);
1380 }
1381 for(fl_itr = _di_pt->m_confidence_history.begin(); fl_itr != _di_pt->m_confidence_history.end(); fl_itr++)
1382 {
1383 fl = *fl_itr;
1384 this->m_confidence_history.push_back(fl);
1385 }
1386 for(fl_itr = _di_pt->m_confidence_timeline.begin(); fl_itr != _di_pt->m_confidence_timeline.end(); fl_itr++)
1387 {
1388 fl = *fl_itr;
1389 this->m_confidence_timeline.push_back(fl);
1390 }
1391 /*
1392
1393 vector<float> m_Integrated_prob_list;
1394 vector<float> m_coverage_list;
1395 vector<int> m_N_setback_list;
1396 vector<int> m_N_disabled_list;
1397 vector<string> m_symp_confidence_list;
1398 */
1399 for(fl_itr = _di_pt->m_Integrated_prob_list.begin(); fl_itr != _di_pt->m_Integrated_prob_list.end(); fl_itr++)
1400 {
1401 fl = *fl_itr;
1402 this->m_Integrated_prob_list.push_back(fl);
1403 }
1404
1405 for(fl_itr = _di_pt->m_coverage_list.begin(); fl_itr != _di_pt->m_coverage_list.end(); fl_itr++)
1406 {
1407 fl = *fl_itr;
1408 this->m_coverage_list.push_back(fl);
1409 }
1410 for(int_itr = _di_pt->m_N_setback_list.begin(); int_itr != _di_pt->m_N_setback_list.end(); int_itr++)
1411 {
1412 i = *int_itr;
1413 this->m_N_setback_list.push_back(i);
1414 }
1415 for(int_itr = _di_pt->m_N_disabled_list.begin(); int_itr != _di_pt->m_N_disabled_list.end(); int_itr++)
1416 {
1417 i = *int_itr;
1418 this->m_N_disabled_list.push_back(i);
1419 }
1420 for(int_itr = _di_pt->m_N_voided_list.begin(); int_itr != _di_pt->m_N_voided_list.end(); int_itr++)
1421 {
1422 i = *int_itr;
1423 this->m_N_voided_list.push_back(i);
1424 }
1425
1426 vector<string>::iterator str_itr;
1427 string str_v;
1428 for(str_itr = _di_pt->m_symp_confidence_list.begin(); str_itr != _di_pt->m_symp_confidence_list.end(); str_itr++)
1429 {
1430 str_v = *str_itr;
1431 this->m_symp_confidence_list.push_back(str_v);
1432 }
1433
1434 if(this->m_other_evidence_list.size() > 0)
1435 {this->ErrorMessage("this->m_other_evidence_list.size() > 0");}
1436 for(auto &tvn : _di_pt->m_other_evidence_list)
1437 {
1438 auto tvn_owned = make_unique<TimeValueNoteUnit>();
1439 tvn_owned->CopyFromAnotherTimeValueNoteUnit(tvn.get());
1440 this->m_other_evidence_list.push_back(std::move(tvn_owned));
1441 }
1442
1443/*
1444 ProcedureStep* m_wm_procedure_step_pt;
1445 ProcedureStep * m_procedure_step_pt;
1446 SymptomInvestigator * m_tbi_SI;
1447 SymptomInvestigator * m_ongoing_SI; //is ongoing to explore a symptom
1448 IDElement * m_ES_base_ID_pt;
1449 IDElement * m_label_ID_pt;
1450 Statement * m_event_statement_pt;
1451 KnowledgeElement * m_event_KE_pt;
1452 EventSchemaUnit * m_event_schema_pt;
1453
1454 string m_procedure_name;
1455 string m_procedure_step_name;
1456 string m_ID_tbi_SI;
1457 string m_ID_ongoing_SI;
1458 string m_ID_label;
1459 string m_ID_es;
1460 string m_ID_KE;
1461 string m_ID_statement;
1462*/
1463 if(_di_pt->m_wm_procedure_step_pt != NULL)
1464 {
1467 }
1468 else
1469 {
1472 }
1473
1474 if(_di_pt->m_procedure_step_pt != NULL)
1475 {
1478 }
1479 else
1480 {
1481 this->m_procedure_name = _di_pt->m_procedure_name;
1483 }
1484
1485 {this->m_ID_tbi_SI = _di_pt->m_ID_tbi_SI;}
1486
1487 if(_di_pt->m_tbi_SI != NULL)
1488 {this->m_ID_tbi_SI = _di_pt->m_tbi_SI->m_ID;}
1489 else
1490 {this->m_ID_tbi_SI = _di_pt->m_ID_tbi_SI;}
1491
1492 if(_di_pt->m_ongoing_SI != NULL)
1493 {this->m_ID_ongoing_SI = _di_pt->m_ongoing_SI->m_ID;}
1494 else
1495 {this->m_ID_ongoing_SI = _di_pt->m_ID_ongoing_SI;}
1496
1497 if(_di_pt->m_label_ID_pt != NULL)
1498 {this->m_ID_label = _di_pt->m_label_ID_pt->m_ID;}
1499 else
1500 {this->m_ID_label = _di_pt->m_ID_label;}
1501
1502 if(_di_pt->m_event_schema_pt != NULL)
1503 {this->m_ID_es = _di_pt->m_event_schema_pt->m_ID;}
1504 else
1505 {this->m_ID_es = _di_pt->m_ID_es;}
1506
1507 if(_di_pt->m_event_KE_pt != NULL)
1508 {this->m_ID_KE = _di_pt->m_event_KE_pt->m_ID;}
1509 else
1510 {this->m_ID_KE = _di_pt->m_ID_KE;}
1511
1512 if(_di_pt->m_event_statement_pt != NULL)
1513 {this->m_ID_statement = _di_pt->m_event_statement_pt->m_ID;}
1514 else
1515 {this->m_ID_statement = _di_pt->m_ID_statement;}
1516
1517/*
1518 vector<SymptomInvestigator *> m_symptom_invest_list;
1519*/
1520 for(auto &si : _di_pt->m_symptom_invest_list)
1521 {
1522 auto si_owned = make_unique<SymptomInvestigator>();
1523 si_owned->CopySymptomInvestigatorInfoFromAnother(si.get());
1524 this->m_symptom_invest_list.push_back(std::move(si_owned));
1525 }
1526
1527
1528 //vector<ProcedureBranchingInfo *> m_branching_info_list;
1529 //vector<ProcedureBranchingInfo *> m_branching_history_list;
1530 for(auto &bh : _di_pt->m_branching_history_list)
1531 {
1532 auto bi_owned = make_unique<ProcedureBranchingInfo>();
1533 bi_owned->s_branching_choice = bh->s_branching_choice;
1534 bi_owned->s_branching_time = bh->s_branching_time;
1535 bi_owned->s_branching_type = bh->s_branching_type;
1536 bi_owned->s_current_procedure_name = bh->s_current_procedure_name;
1537 bi_owned->s_current_step_name = bh->s_current_step_name;
1538 bi_owned->s_procedure_name = bh->s_procedure_name;
1539 bi_owned->s_step_name = bh->s_step_name;
1540 this->m_branching_history_list.push_back(std::move(bi_owned));
1541 }
1542 for(auto &bi : _di_pt->m_branching_info_list)
1543 {
1544 auto bi_owned = make_unique<ProcedureBranchingInfo>();
1545 bi_owned->s_branching_choice = bi->s_branching_choice;
1546 bi_owned->s_branching_time = bi->s_branching_time;
1547 bi_owned->s_branching_type = bi->s_branching_type;
1548 bi_owned->s_current_procedure_name = bi->s_current_procedure_name;
1549 bi_owned->s_current_step_name = bi->s_current_step_name;
1550 bi_owned->s_procedure_name = bi->s_procedure_name;
1551 bi_owned->s_step_name = bi->s_step_name;
1552 this->m_branching_info_list.push_back(std::move(bi_owned));
1553 }
1554}
1555
1557{
1558 ReasonMachine * RM_pt;
1559 RM_pt = (ReasonMachine*)_pt;
1560 map<string, ProcedureStep *>::iterator procedure_map_itr;
1561
1562 //ProcedureStep* m_wm_procedure_step_pt;
1563 //ProcedureStep * m_procedure_step_pt;
1564 if(this->m_procedure_name.compare("NONE") != 0 && this->m_procedure_step_name.compare("NONE") != 0)
1565 {
1566 procedure_map_itr = g_sim.All_procedure.procedure_map.find(this->m_procedure_name + this->m_procedure_step_name);
1567 if(procedure_map_itr != g_sim.All_procedure.procedure_map.end())
1568 {
1569 this->m_procedure_step_pt = procedure_map_itr->second;
1570 }
1571 else
1572 {
1573 this->ErrorMessage("Could not find this procedure step: " + this->m_procedure_name + this->m_procedure_step_name);
1574 return;
1575 }
1576 }
1577
1578 if(this->m_wm_procedure_name.compare("NONE") != 0 && this->m_wm_procedure_step_name.compare("NONE") != 0)
1579 {
1580 procedure_map_itr = g_sim.All_procedure.procedure_map.find(this->m_wm_procedure_name + this->m_wm_procedure_step_name);
1581 if(procedure_map_itr != g_sim.All_procedure.procedure_map.end())
1582 {
1583 this->m_wm_procedure_step_pt = procedure_map_itr->second;
1584 }
1585 else
1586 {
1587 this->ErrorMessage("Could not find this procedure step: " + this->m_wm_procedure_name + this->m_wm_procedure_step_name);
1588 return;
1589 }
1590 }
1591 this->m_wm_procedure_name = "NONE";
1592 this->m_wm_procedure_step_name = "NONE";
1593
1594
1595
1596 //SymptomInvestigator * m_tbi_SI;
1597 if(this->m_ID_tbi_SI.compare("") != 0)
1598 {
1599 this->m_tbi_SI = RM_pt->m_event_schema_base->FindSymtomInvestigatorByID(this->m_ID_tbi_SI);
1600 if(this->m_tbi_SI == NULL)
1601 {this->ErrorMessage("this->m_tbi_SI == NULL"); return;}
1602 }
1603 this->m_ID_tbi_SI = "";
1604
1605 //SymptomInvestigator * m_ongoing_SI;
1606 if (this->m_ID_ongoing_SI.compare("") != 0)
1607 {
1608 this->m_ongoing_SI = RM_pt->m_event_schema_base->FindSymtomInvestigatorByID(this->m_ID_ongoing_SI);
1609 if( this->m_ongoing_SI == NULL)
1610 {this->ErrorMessage("this->m_ongoing_SI"); return;}
1611 }
1612 this->m_ID_ongoing_SI = "";
1613
1614 //IDElement * m_ES_base_ID_pt;
1615 this->m_ES_base_ID_pt = (IDElement*)(RM_pt->m_event_schema_base.get());
1616
1617 //IDElement * m_label_ID_pt;
1618 if(this->m_ID_label.compare("") != 0)
1619 {
1620 this->m_label_ID_pt = RM_pt->m_Concept_Base->FindConceptByID(this->m_ID_label);
1621 if( this->m_label_ID_pt== NULL)
1622 {this->ErrorMessage("this->m_label_ID_pt == NULL"); return;}
1623 }
1624
1625 //KnowledgeElement * m_event_KE_pt;
1626 if(this->m_ID_KE.compare("") != 0)
1627 {
1628 this->m_event_KE_pt = RM_pt->FindKnowledgeElementByID(this->m_ID_KE);
1629 if(this->m_event_KE_pt == NULL)
1630 {this->ErrorMessage("this->m_event_KE_pt == NULL"); return;}
1631 }
1632
1633 //Statement * m_event_statement_pt;
1634 if(this->m_ID_statement.compare("") != 0)
1635 {
1637 if(this->m_event_statement_pt == NULL)
1638 {this->ErrorMessage("this->m_event_statement_pt == NULL"); return;}
1639 }
1640
1641 //EventSchemaUnit * m_event_schema_pt;
1642 if(this->m_ID_es.compare("") != 0)
1643 {
1644 this->m_event_schema_pt = RM_pt->m_event_schema_base->FindEventSchemaUnitByID(this->m_ID_es);
1645 if(this->m_event_schema_pt == NULL)
1646 {this->ErrorMessage("this->m_event_schema_pt == NULL"); return;}
1647 }
1648
1649/*
1650 vector<SymptomInvestigator *> m_symptom_invest_list;
1651*/
1652 for(auto &symp : this->m_symptom_invest_list)
1653 {
1654 symp->BuildConnectionsForThisSymptomInvestigator(_pt);
1655 }
1656
1657}
1658
1660{
1661 bool match_bl;
1662 BranchProbability * bp_pt;
1663 BranchProcedureStep * bps_pt;
1664 string next_procedure_name;
1665 string next_step_name;
1666 int type = 0;
1667 int choice = 0;
1668
1669 bp_pt = (BranchProbability *)_pt;
1670
1671
1672 ProcedureBranchingInfo * found_info_pt = NULL;
1673 size_t found_idx = 0;
1674
1675 if(this->m_branching_info_list.size() == 0)
1676 {return;}
1677
1678 if(bp_pt->procedure_step.size() == 0)
1679 {this->ErrorMessage("bp_pt->procedure_step.size() == 0"); return;}
1680 else if(bp_pt->procedure_step.size() > 1)
1681 {this->ErrorMessage("bp_pt->procedure_step.size() > 1"); return;}
1682
1683 bps_pt = bp_pt->procedure_step.begin()->get();
1684 next_procedure_name = bps_pt->getProcedureName();
1685 next_step_name = bps_pt->getStepName();
1686
1687 for(size_t idx = 0; idx < this->m_branching_info_list.size(); idx++)
1688 {
1689 auto &info = this->m_branching_info_list[idx];
1690 match_bl = false;
1691
1692 if(info->s_procedure_name.compare(next_procedure_name) == 0)
1693 {
1694 if(info->s_step_name.compare(next_step_name) == 0)
1695 {
1696 match_bl = true;
1697 found_info_pt = info.get();
1698 found_idx = idx;
1699 }
1700 }
1701
1702 //if(match_bl == false)
1703 //{delete (*info_itr);}
1704 }
1705
1706 if(found_info_pt == NULL)
1707 {this->ErrorMessage("Fail: found_info == NULL"); return;}
1708
1709 type = found_info_pt->s_branching_type;
1710 choice = found_info_pt->s_branching_choice;
1711
1712 if((type == 1 && choice == 2) || (type == 21 && choice == 2) || (type == 22 && choice == 1) || (type == 3 && choice == 2) || (type == 4))
1714 this->m_branching_history_list.push_back(std::move(this->m_branching_info_list[found_idx]));
1715 this->m_branching_info_list.clear();
1716 //clear this->m_branching_info_list
1717}
1718
1719int DiagnoseInvestigator::FindARecentSimilarBranching(int type, string procedure_name, string step_name)
1720{
1721 int choice = 0;
1722 ProcedureBranchingInfo * found_info_pt = NULL;
1723
1724 for(auto ritr = this->m_branching_history_list.rbegin(); ritr != this->m_branching_history_list.rend() && found_info_pt == NULL; ritr++)
1725 {
1726 if((*ritr)->s_branching_type != type)
1727 {continue;}
1728 if((*ritr)->s_current_procedure_name.compare(procedure_name) == 0 && (*ritr)->s_step_name.compare(step_name) == 0)
1729 {
1730 found_info_pt = ritr->get();
1731 }
1732 }
1733
1734 if(found_info_pt != NULL)
1735 {choice = found_info_pt->s_branching_choice;}
1736 return choice;
1737}
1738
1740{
1741 DecisionProcedureStep * dps_pt = NULL;
1742 if(this->m_wm_procedure_step_pt != NULL)
1745 if(dps_pt != NULL)
1747}
1748
1749//DEL float DiagnoseInvestigator::m_coverage_coefficient()
1750//DEL {
1751//DEL
1752//DEL }
1753
1755{
1756 Investigator * invest_pt = (Investigator *)_ID_pt;
1757 bool exist_bl = false;
1758 bool seen_before = false;
1759
1760 ReasonMachine * RM_pt;
1761 if (this->m_operator == sim::Operator::ODM)
1762 {RM_pt = g_sim.Decision_Maker.m_RM.get();}
1763 else if (this->m_operator == sim::Operator::OAT)
1764 {RM_pt = g_sim.Action_Taker.m_RM.get();}
1765 else
1766 {}//add error message
1767
1768 if(invest_pt->m_KElement_ID_pt == NULL)
1769 {return;}
1770 if((invest_pt->m_probability_update_time - r5pars_.timesno) > 0.0001 || (invest_pt->m_probability_update_time - r5pars_.timesno) < -0.0001)
1771 {return;}
1772 if(invest_pt->m_KElement_ID_pt->m_ID != this->m_event_KE_pt->m_ID )
1773 {return;}
1774
1775 for(auto &SI : this->m_symptom_invest_list)
1776 {
1777 if(exist_bl) break;
1778 if((IDElement*)(SI->m_symptom_KE_pt) == RM_pt->m_buffer_invest_pt->m_KElement_ID_pt)
1779 {exist_bl = true;}
1780 }
1781
1782 if(exist_bl == true)
1783 {return;}
1784
1785 // Check whether exists in the other info list and update
1786 bool update_number = false;
1787
1788 for(auto &tvn : this->m_other_evidence_list)
1789 {
1790 if(seen_before) break;
1791 if(tvn->m_string.compare(RM_pt->m_buffer_invest_pt->m_KElement_ID_pt->m_ID) == 0)
1792 {
1793 seen_before = true;
1794 if(invest_pt->m_independent_probability > tvn->m_value)
1795 {
1796 tvn->m_time = r5pars_.timesno;
1797 tvn->m_value = invest_pt->m_independent_probability;
1798 tvn->m_note = invest_pt->m_ID;
1799 update_number = true;
1800 }
1801 }
1802 }
1803
1804 if(seen_before == false)
1805 {
1806 auto other_evidence_owned = make_unique<TimeValueNoteUnit>();
1807 other_evidence_owned->m_string = RM_pt->m_buffer_invest_pt->m_KElement_ID_pt->m_ID;
1808 other_evidence_owned->m_value = invest_pt->m_independent_probability;
1809 other_evidence_owned->m_note = RM_pt->m_buffer_invest_pt->m_ID;
1810 other_evidence_owned->m_time = r5pars_.timesno;
1811 this->m_other_evidence_list.push_back(std::move(other_evidence_owned));
1812 update_number = true;
1813 }
1814
1815 if(update_number == true)
1816 {
1818
1819 //test
1820 //write aux infor
1821
1822
1823
1824 //write the codes for first other evidence at initation of DI, done
1825 // sort, do calculation...done
1826 //update the confidence, done
1827 //save the restore information for the m_other_evidence_list, done
1828 //link this function with the Investigator::backwardpropagateconfidence...., done
1829
1830
1832 //work on the resuming of investigation item
1833 //
1834 }
1835
1836}
static int compare_floats(const void *a, const void *b)
Diagnostic reasoning engine — knowledge representation, mental model, and inference.
SimulationContext g_sim
Global simulation context: the single instance, defined in SimulationContext.cpp.
One alternative of a BranchCluster, i.e. one PE node of the DET.
void addProcedureStep(int, BranchProcedureStep *)
int num_of_ODM_branch
Definition: BranchRecord.h:298
BranchUnit ODM_branch
Pending crew forks of the decision maker, action taker and consultant.
Definition: BranchRecord.h:288
int num_of_OAT_branch
Definition: BranchRecord.h:298
std::vector< std::shared_ptr< BranchProcedureStep > > procedure_step
Definition: BranchUnit.h:66
void setSenderAndReceiver(int, int)
void setTypeOfPauseActivity(int)
void setLastProcedureName(std::string)
void setLastStepName(std::string)
void setProcedureName(std::string)
std::vector< float > m_confidence_timeline
std::vector< std::unique_ptr< SymptomInvestigator > > m_symptom_invest_list
std::vector< float > m_coverage_list
void InitiationOfthisDiagnoseInvestigator(float, IDElement *)
void CopyDiagnoseInvestigatorInfoFromAnother(DiagnoseInvestigator *)
SymptomInvestigator * m_ongoing_SI
void UpdateForOtherEvidenceNotListedInEventSchema(IDElement *)
EventSchemaUnit * m_event_schema_pt
std::vector< int > m_N_setback_list
SymptomInvestigator * m_tbi_SI
ProcedureStep * m_procedure_step_pt
int FindARecentSimilarBranching(int, std::string, std::string)
KnowledgeElement * m_event_KE_pt
std::vector< std::unique_ptr< ProcedureBranchingInfo > > m_branching_info_list
std::vector< std::unique_ptr< ProcedureBranchingInfo > > m_branching_history_list
void ClearTheInfomationAboutTheCurrentProcedureStep()
std::vector< int > m_N_voided_list
std::string m_wm_procedure_step_name
void UpdateThisDiagnoseWithAnConfirmedInvestigator(Investigator *_invest_pt)
std::vector< std::unique_ptr< TimeValueNoteUnit > > m_other_evidence_list
std::vector< int > m_wm_type_list
std::vector< float > m_confidence_history
void UpdateDiagnoseInvestigatorBranchingInfo(void *)
std::vector< int > m_N_disabled_list
std::vector< std::string > m_symp_confidence_list
void CalculateTheConfidenceLeveloftheDiagnoseInvestigator()
void ErrorMessage(std::string str)
std::vector< float > m_Integrated_prob_list
bool m_contain_transfer_point_to_associate_procedure_bl
void BuildConnectionsForThisDiagnoseInvestigator(void *)
std::vector< int > m_wm_i_list
ProcedureStep * m_wm_procedure_step_pt
std::vector< std::unique_ptr< EventSymptomUnit > > m_symptom_list
ProcedureStep * m_procedure_step_pt
KnowledgeElement * m_event_KE_pt
float m_diagnose_claim_threshold
void CopyIDElementToRestartInfo(IDElement *)
Definition: IDElement.cpp:23
int m_ID_Type
Definition: IDElement.h:15
std::string m_ID
Definition: IDElement.h:16
std::string getCurrentProceduralStepName()
Definition: InfoChunk.cpp:155
DecisionProcedureStep * getCurrentProcedureStepPtr(int)
Definition: InfoChunk.cpp:201
std::string getCurrentProcedureName()
Definition: InfoChunk.cpp:140
float m_probability_update_time
Definition: Investigator.h:18
IDElement * m_KElement_ID_pt
Definition: Investigator.h:129
std::vector< IDElement * > m_downstream_ID_list
Definition: Investigator.h:144
float m_independent_probability
Definition: Investigator.h:121
std::unique_ptr< ReasonMachine > m_RM
Definition: Operator.h:55
ShortTermMemory memory
Definition: Operator.h:126
std::string getProcedureName()
std::unique_ptr< ProcedureStepInfo > non_response_procedure
std::vector< std::unique_ptr< ProcedureStepUnit > > procedure_step_unit
Definition: ProcedureStep.h:62
std::string getNextProcedureName()
std::string getCurrentProcedureName()
std::string getCurrentStepName()
void resetStateOfActivation()
std::map< std::string, ProcedureStep * > procedure_map
Definition: Procedures.h:72
std::unique_ptr< KBConcept > m_Concept_Base
KnowledgeElement * FindKnowledgeElementByID(std::string)
KnowledgeElement * FindAKEbySentenceAndNegationSign(SentenceUnit *, bool)
float m_ability_of_integrating_evidence
ProblemSolvingStyle m_problem_solving_style
Statement * FindStatementByID(std::string)
std::unique_ptr< EventSchemaBase > m_event_schema_base
Investigator * m_buffer_invest_pt
IDElement * GetLabelOfThisSentence()
InfoChunk perceived_info
void setStateOfActivation(int)
SentenceUnit * m_sent_pt
Definition: Statement.h:43
bool m_state
Definition: Statement.h:35
Investigator * m_invest_pt
Definition: SymptomCase.h:30
bool m_consistant_bl
Definition: SymptomCase.h:20
float m_path_confidence
Definition: SymptomCase.h:25
bool m_finished_bl
Definition: SymptomCase.h:21
float m_confirmed_time
Definition: SymptomCase.h:23
KnowledgeElement * m_symptom_KE_pt
void setTimerAndProbability(double, double)
struct @0 r5pars_
int size
Total number of MPI processes.
constexpr int Procedure
Definition: SimConstants.h:261
constexpr int ODM
Definition: SimConstants.h:145
constexpr int OAT
Definition: SimConstants.h:144
constexpr int Bypass
Definition: SimConstants.h:132
constexpr int Done
Definition: SimConstants.h:123
constexpr int Active
Definition: SimConstants.h:118
constexpr int FollowProcedure
Definition: SimConstants.h:177
constexpr int None
Definition: SimConstants.h:75
Procedures All_procedure
Emergency operating procedures.
OperatorAT Action_Taker
Crew action execution model.
OperatorDM Decision_Maker
Crew decision-making model.
BranchRecord Branch_center
Dynamic event tree state.