8#include "../Crew/OperatorDM.h"
9#include "../Crew/OperatorAT.h"
15#include "../Global/SimulationContext.h"
55 vector<Investigator *>::iterator invest_itr;
57 Label * label_group_pt;
58 bool need_inst_bl =
false;
84 if(label_group_pt != NULL)
86 if(RM_pt->
m_IB->FindLabelGroupByLabelID(this->m_label_ID_pt) == label_group_pt)
92 this->
ErrorMessage(
"The codes is not ready for this situation yet!");
96 if(need_inst_bl ==
true)
116 invest_pt = invest_e.get();
130 {new_case_bl =
true;}
133 if(new_case_bl ==
true)
135 auto case_owned = make_unique<SymptomCase>();
136 case_pt = case_owned.get();
149 cout <<
r5pars_.timesno <<
" " << str <<
" in SymptomInvestigator.cpp" <<
'\n';
150 ofstream fout(
"err messages.txt", ios::app);
151 fout <<
r5pars_.timesno <<
" " << str <<
'\n';
163 bool consistant_bl =
true;
164 bool finished_bl =
true;
165 bool jump_out_bl =
false;
168 vector<IDElement *>::iterator link_ID_itr;
169 vector<KnowledgeUnit *>::iterator KU_itr;
174 for(KU_itr = this->
m_event_symptom_pt->
m_KU_list.begin(); KU_itr != this->m_event_symptom_pt->m_KU_list.end() && jump_out_bl ==
false; KU_itr++)
178 problem_invest_pt = invest_pt;
186 unfinished_invest_pt = invest_pt;
201 if(found_bl ==
false)
206 unfinished_invest_link_pt = invest_link_pt;
214 KU_stuck_pt = (*KU_itr);
222 problem_permission_invest_pt = invest_pt;
230 {this->
ErrorMessage(
"This situation is beyond the current codes!");}
238 KU_stuck_pt = (*KU_itr);
239 problem_invest_pt = invest_pt;
248 if(jump_out_bl ==
true)
270 if(problem_invest_pt != NULL)
279 if(problem_permission_invest_pt != NULL)
292 if(unfinished_invest_pt != NULL && unfinished_invest_link_pt != NULL)
302 if(
e->m_invest_pt == _invest_pt)
363 vector<KnowledgeUnit *>::reverse_iterator KU_ritr;
372 bool consistant_bl =
true;
373 bool finished_bl =
true;
374 bool jump_out_bl =
false;
375 bool discard_bl =
false;
376 bool found_bl =
false;
377 bool match_bl =
false;
380 vector<IDElement *>::iterator link_ID_itr;
381 vector<IDElement *>::iterator invest_ID_itr;
382 vector<KnowledgeUnit *>::iterator KU_itr;
409 if(invest_pt->
m_ID ==
"Investigator_535")
471 for(KU_itr = this->
m_event_symptom_pt->
m_KU_list.begin(); KU_itr != this->m_event_symptom_pt->m_KU_list.end() && jump_out_bl ==
false; KU_itr++)
487 problem_invest_pt = invest_pt;
499 unfinished_invest_pt = invest_pt;
505 unfinished_invest_pt = invest_pt;
518 unfinished_invest_link_pt = invest_link_pt;
526 if(jump_out_bl ==
true)
541 if(found_bl ==
false)
556 {unfinished_invest_pt = invest_pt;}
558 {unfinished_invest_link_pt = invest_link_pt;}
568 KU_stuck_pt = (*KU_itr);
579 problem_permission_invest_pt = invest_pt;
594 this->
ErrorMessage(
"This situation is beyond the current codes!");
604 invest_pt = invest_buffer_pt;
607 if(invest_pt == NULL)
619 KU_stuck_pt = (*KU_itr);
620 problem_invest_pt = invest_pt;
636 if(unfinished_invest_pt != NULL)
658 if(jump_out_bl ==
true)
660 if(discard_bl ==
true)
672 {_case_pt = _case_pt;}
691 auto invest_owned = make_unique<Investigator>();
692 new_invest_pt = invest_owned.get();
693 new_invest_pt->
m_note =
"by event schema";
736 else if(problem_permission_invest_pt != NULL)
750 if(problem_permission_invest_pt != NULL)
766 else if(problem_invest_pt != NULL)
822 if(this->m_independent_symptom_probability < _case_pt->m_path_confidence)
841 root_invest_pt = invest_pt;
843 if(root_invest_pt == NULL)
856 {Happen_invest_pt = invest_pt;}
868 if(found_bl ==
false)
874 {this->
ErrorMessage(
"This situation is beyond the current codes!");
return;}
883 {invest_pt = invest_buffer_pt;}
885 if(invest_pt == NULL)
895 if(Happen_invest_pt == NULL)
898 invest_pt = Happen_invest_pt;
899 while(unfinished_invest_pt == NULL && unfinished_invest_link_pt == NULL && jump_out_bl ==
false)
904 {unfinished_invest_pt = invest_pt;
break;}
916 {unfinished_invest_link_pt = invest_link_pt;
break;}
918 {found_bl =
true;
break;}
920 if(unfinished_invest_link_pt != NULL)
923 if(found_bl ==
false)
935 {unfinished_invest_pt = invest_pt;
break;}
937 {found_bl =
true;
break;}
945 {invest_ID_itr ++;
continue;}
947 {invest_ID_itr ++;
continue;}
949 {unfinished_invest_pt = invest_pt;
break;}
951 {found_bl =
true;
break;}
955 if(unfinished_invest_pt != NULL)
957 if(found_bl ==
false)
961 {unfinished_invest_pt = invest_pt;
break;}
977 if(it->get() == _case_pt)
989 if(it->get() == _case_pt)
991 _target.push_back(std::move(*it));
1000 float rejection_time = 0;
1003 if(
e->m_rejection_time > rejection_time)
1005 rejection_time =
e->m_rejection_time;
1008 return rejection_time;
1013 vector<KnowledgeUnit *>::iterator KU_itr;
1016 for(KU_itr = this->
m_event_symptom_pt->
m_KU_list.begin(); KU_itr != this->m_event_symptom_pt->m_KU_list.end() && found_KU_pt == NULL; KU_itr++)
1018 if((*KU_itr) == _KU_pt)
1020 found_KU_pt = (*KU_itr);
1028 float confirm_time = 0;
1036 return confirm_time;
1043 cout <<
":\n" << str <<
'\n';
1046 ofstream fout(
"RMI.txt", ios::app);
1047 fout <<
"\n" <<
"Time: " <<
r5pars_.timesno <<
":\n" << str <<
'\n';
1103 {this->
ErrorMessage(
"this->m_ongoing_invest_list.size() != 0");
return;}
1105 {this->
ErrorMessage(
"this->m_ongoing_invest_link_list.size() != 0");
return;}
1113 vector<string>::iterator str_itr;
1115 vector<Investigator *>::iterator invest_itr;
1120 ID = (*invest_itr)->m_ID;
1133 vector<InvestigatorLink *>::iterator link_itr;
1138 ID = (*link_itr)->m_ID;
1160 auto sc_pt = make_unique<SymptomCase>();
1161 sc_pt->CopySymptomCaseInfoFromAnother(
e.get());
1167 auto sc_pt = make_unique<SymptomCase>();
1168 sc_pt->CopySymptomCaseInfoFromAnother(
e.get());
1174 auto sc_pt = make_unique<SymptomCase>();
1175 sc_pt->CopySymptomCaseInfoFromAnother(
e.get());
1180 auto sc_pt = make_unique<SymptomCase>();
1181 sc_pt->CopySymptomCaseInfoFromAnother(
e.get());
1186 auto sc_pt = make_unique<SymptomCase>();
1187 sc_pt->CopySymptomCaseInfoFromAnother(
e.get());
1192 auto sc_pt = make_unique<SymptomCase>();
1193 sc_pt->CopySymptomCaseInfoFromAnother(
e.get());
1198 auto sc_pt = make_unique<SymptomCase>();
1199 sc_pt->CopySymptomCaseInfoFromAnother(
e.get());
1204 auto sc_pt = make_unique<SymptomCase>();
1205 sc_pt->CopySymptomCaseInfoFromAnother(
e.get());
1218 {this->
ErrorMessage(
"this->m_label_ID_pt == NULL");
return;}
1225 {this->
ErrorMessage(
"this->m_label_ID_pt == NULL");
return;}
1229 if(this->
m_ID_KE.compare(
"") != 0)
1244 if(this->
m_ID_esu.compare(
"") != 0)
1253 vector<string>::iterator str_itr;
1257 if(invest_pt == NULL)
1258 {this->
ErrorMessage(
"could not find this investigator " + *str_itr);
return;}
1267 {this->
ErrorMessage(
"could not find this InvestigatorLink " + *str_itr);
return;}
1282 {
e->BuildConnectionsForThisSymptomCase(_pt);}
1285 {
e->BuildConnectionsForThisSymptomCase(_pt);}
1288 {
e->BuildConnectionsForThisSymptomCase(_pt);}
1291 {
e->BuildConnectionsForThisSymptomCase(_pt);}
1294 {
e->BuildConnectionsForThisSymptomCase(_pt);}
1297 {
e->BuildConnectionsForThisSymptomCase(_pt);}
1300 {
e->BuildConnectionsForThisSymptomCase(_pt);}
1303 {
e->BuildConnectionsForThisSymptomCase(_pt);}
1309 vector<Investigator *>::iterator invest_itr;
1310 vector<InvestigatorLink *>::iterator link_itr;
1312 for(invest_itr = this->
m_ongoing_invest_list.begin(); invest_itr != this->m_ongoing_invest_list.end(); invest_itr++)
1314 (*invest_itr)->BoostActivationOfThisByActiveDiagnosisInvestigation();
1319 (*link_itr)->BoostActivationOfThisLinkByActiveDiagnosisInvestigation();
Diagnostic reasoning engine — knowledge representation, mental model, and inference.
SimulationContext g_sim
Global simulation context: the single instance, defined in SimulationContext.cpp.
KnowledgeElement * m_event_KE_pt
std::vector< KnowledgeUnit * > m_KU_list
KnowledgeElement * m_symptom_KE_pt
void CopyIDElementToRestartInfo(IDElement *)
IDElement * m_condition_ID_pt
KnowledgeUnit * m_K_unit_pt
bool m_invest_link_dormant
bool m_is_inference_path_bl
void CheckThePathStatus3102()
std::vector< IDElement * > m_upperstream_ID_list
bool m_investigation_closed
void ReopenThisInvestigator()
float m_probability_update_time
IDElement * m_KElement_ID_pt
bool m_active_investigation
bool m_root_of_a_thought_line
float m_independent_probability
std::vector< IDElement * > m_upperstream_ID_list
float m_interest_from_SymptomInvestigator
Statement * m_Statement_pt
SentenceUnit * m_SentenceUnit_pt
std::unique_ptr< ReasonMachine > m_RM
std::unique_ptr< KBConcept > m_Concept_Base
InvestigatorLink * FindInvestigatorLinkByID(std::string)
std::vector< std::unique_ptr< Investigator > > m_investigator_pool
KnowledgeElement * FindKnowledgeElementByID(std::string)
KnowledgeElement * FindAKEbySentenceAndNegationSign(SentenceUnit *, bool)
void WriteAuxInfo(std::string str)
std::unique_ptr< InstantiationBase > m_IB
Investigator * FindInvestigatorByID(std::string)
std::unique_ptr< EventSchemaBase > m_event_schema_base
Investigator * m_buffer_invest_pt
void AddNewInvestigator(Investigator *)
SentenceUnit * InstantiateAnIndefiniteSentenceWithLabel(SentenceUnit *, IDElement *)
IDElement * GetLabelOfThisSentence()
Investigator * m_invest_pt
Investigator * m_unfinished_invest_pt
KnowledgeUnit * m_stuck_KU_pt
InvestigatorLink * m_unfinished_invest_link_pt
Investigator * m_problem_permission_invest_pt
Investigator * m_problem_invest_pt
bool m_invest_opposite_bl
virtual ~SymptomInvestigator()
void RemoveADeterminedCaseFromCandiateList(SymptomCase *_case_pt)
float m_last_case_end_time
std::vector< std::unique_ptr< SymptomCase > > m_voided_case_list
std::vector< std::unique_ptr< SymptomCase > > m_partial_consistant_case_list
void PrintMessage(std::string str)
void CopySymptomInvestigatorInfoFromAnother(SymptomInvestigator *)
EventSymptomUnit * m_event_symptom_pt
void TrackOneInvestigationCase(SymptomCase *_case_pt)
std::vector< Investigator * > m_ongoing_invest_list
KnowledgeElement * m_symptom_KE_pt
std::vector< InvestigatorLink * > m_ongoing_invest_link_list
std::string m_opposite_KE_ID
std::vector< std::unique_ptr< SymptomCase > > m_candidate_case_list
std::vector< std::unique_ptr< SymptomCase > > m_exception_case_list
std::vector< std::unique_ptr< SymptomCase > > m_inconsistant_case_list
void MoveCaseFromCandidateTo(SymptomCase *_case_pt, std::vector< std::unique_ptr< SymptomCase > > &_target)
float m_independent_symptom_probability
bool m_need_to_invest_opposite_bl
bool m_can_not_explain_opposite_bl
std::vector< std::string > m_ID_ongoing_invest_link_list
void SITrackTheOngoingInvestigation()
IDElement * m_label_ID_pt
KnowledgeElement * m_opposite_KE_pt
void InitiationOfthisSymptomInvestigator()
float GetTheLastRejectionTime()
void ErrorMessage(std::string)
float GetLastConfirmationTime()
std::vector< std::unique_ptr< SymptomCase > > m_rejected_case_list
std::vector< std::unique_ptr< SymptomCase > > m_confirmed_case_list
void BuildConnectionsForThisSymptomInvestigator(void *)
KnowledgeUnit * CheckAKnowledgeUnitInTheList(KnowledgeUnit *_KU_pt)
std::vector< std::unique_ptr< SymptomCase > > m_discarded_case_list
void InitiallyCompareAnInvestigationTraceWithThePrototype(SymptomCase *)
void BoostTheActivationOfOngoingInvestigation()
SymptomCase * FindASymptomCaseByInvestigator(Investigator *_invest_pt)
std::vector< std::string > m_ID_ongoing_invest_list
OperatorAT Action_Taker
Crew action execution model.
OperatorDM Decision_Maker
Crew decision-making model.