12#include "../Crew/OperatorDM.h"
13#include "../Crew/OperatorAT.h"
16#include "../Global/SimulationContext.h"
65 bool NewStatement_bl =
false;
85 prompt =
"Received new reading of ";
96 NewStatement_bl =
true;
115 if(found_sent_pt != 0)
117 auto stmt = make_unique<Statement>();
118 stmt->m_factual_type = 1;
119 stmt->m_confidence =1;
120 stmt->m_sent_pt = found_sent_pt;
121 stmt->m_state =
true;
122 stmt->m_time_range.m_time_after = this->
m_recent_state->m_time_perceived;
123 stmt->m_time_range.m_time_before =
r5pars_.timesno;
124 statement_pt = stmt.get();
129 if(_expecting ==
true)
143 auto inv = make_unique<Investigator>();
144 inv->m_note =
"by a statement";
145 inv->m_motivation = 1;
146 inv->m_Statement_pt = statement_pt;
150 inv->m_root_of_a_thought_line =
true;
151 invest_pt =
inv.get();
160 NewStatement_bl =
true;
164 NewStatement_bl =
false;
174 if(NewStatement_bl ==
true)
194 if(found_sent_pt != 0)
196 auto stmt = make_unique<Statement>();
197 stmt->m_factual_type = 1;
198 stmt->m_confidence =1;
199 stmt->m_sent_pt = found_sent_pt;
200 stmt->m_state =
true;
201 stmt->m_time_generated =
r5pars_.timesno;
202 stmt->m_time_range.m_start_time =
r5pars_.timesno;
204 {stmt->m_time_range.m_time_after = this->
m_recent_state->m_time_perceived;}
205 stmt->m_time_range.m_end_time =
r5pars_.timesno;
206 statement_pt = stmt.get();
211 if(_expecting ==
true)
245 bool NewStatement_bl =
false;
246 bool update_action_bl =
false;
252 prompt =
"Received new reading of ";
257 prompt += conv.str();
273 NewStatement_bl =
true;
279 NewStatement_bl =
true;
286 NewStatement_bl =
false;
287 update_action_bl =
true;
290 if(update_action_bl ==
true)
297 if(NewStatement_bl ==
true)
304 if(found_sent_pt != 0)
307 auto stmt = make_unique<Statement>();
308 stmt->m_factual_type = 1;
309 stmt->m_confidence =1;
310 stmt->m_sent_pt = found_sent_pt;
311 stmt->m_state =
true;
312 stmt->m_time_generated =
r5pars_.timesno;
313 stmt->m_time_range.m_time_before =
r5pars_.timesno;
315 statement_pt = stmt.get();
320 if(_expecting ==
true)
334 auto inv = make_unique<Investigator>();
335 inv->m_note =
"by a statement";
336 inv->m_motivation = 1;
337 inv->m_Statement_pt = statement_pt;
341 invest_pt =
inv.get();
371 else if(this->
m_recent_position_value->m_time_perceived >= _start && this->m_recent_position_value->m_time_perceived <= _end)
381 if(
e->m_time_perceived >= _start &&
e->m_time_perceived <= _end)
383 value_schema_pt =
e.get();
388 return value_schema_pt;
429 if(this->
m_recent_position_value->m_time_perceived >= _start && this->m_recent_position_value->m_time_perceived <= _end)
435 for(
auto ritr = this->
m_history_position_value.rbegin(); ritr != this->m_history_position_value.rend() && found ==
false; ritr++)
437 if((*ritr)->m_time_perceived <= _end)
439 if((*ritr)->m_time_perceived >= _start)
442 value_schema_pt = ritr->get();
451 return value_schema_pt;
460 bool NewStatement_bl =
false;
461 bool update_action_bl =
false;
467 prompt =
"Received new reading of ";
472 prompt += conv.str();
487 NewStatement_bl =
true;
493 NewStatement_bl =
true;
496 if(NewStatement_bl ==
true)
500 NewStatement_bl =
false;
501 update_action_bl =
true;
504 if(update_action_bl ==
true)
510 if(NewStatement_bl ==
true)
517 if(found_sent_pt != 0)
520 auto stmt = make_unique<Statement>();
521 stmt->m_factual_type = 1;
522 stmt->m_confidence =1;
523 stmt->m_sent_pt = found_sent_pt;
524 stmt->m_state =
true;
525 stmt->m_time_generated =
r5pars_.timesno;
526 stmt->m_time_range.m_time_before =
r5pars_.timesno;
528 statement_pt = stmt.get();
552 bool NewStatement_bl =
false;
572 prompt =
"Received new reading of ";
582 NewStatement_bl =
true;
601 if(found_sent_pt != 0)
603 auto stmt = make_unique<Statement>();
604 stmt->m_factual_type = 1;
605 stmt->m_confidence =1;
606 stmt->m_sent_pt = found_sent_pt;
607 stmt->m_state =
true;
608 stmt->m_time_range.m_time_after = this->
m_recent_state->m_time_perceived;
609 stmt->m_time_range.m_time_before =
r5pars_.timesno;
610 statement_pt = stmt.get();
617 NewStatement_bl =
true;
621 NewStatement_bl =
false;
631 if(NewStatement_bl ==
true)
651 if(found_sent_pt != 0)
653 auto stmt = make_unique<Statement>();
654 stmt->m_factual_type = 1;
655 stmt->m_confidence =1;
656 stmt->m_sent_pt = found_sent_pt;
657 stmt->m_state =
true;
658 stmt->m_time_generated =
r5pars_.timesno;
659 stmt->m_time_range.m_start_time =
r5pars_.timesno;
661 {stmt->m_time_range.m_time_after = this->
m_recent_state->m_time_perceived;}
662 stmt->m_time_range.m_end_time =
r5pars_.timesno;
663 statement_pt = stmt.get();
684 cout <<
"Time: " <<
r5pars_.timesno <<
": " << str <<
'\n';
687 ofstream fout(
"RMI.txt", ios::app);
688 fout <<
"Time: " <<
r5pars_.timesno <<
": " << str <<
'\n';
695 if(this->
m_recent_state->m_time_perceived >= _start && this->m_recent_state->m_time_perceived <= _end)
698 return found_state_schema_pt;
704 if(
e->m_time_perceived >= _start &&
e->m_time_perceived <= _end)
706 found_state_schema_pt =
e.get();
710 return found_state_schema_pt;
723 return found_state_schema_pt;
727 for(
auto ritr = this->
m_history_state.rbegin(); ritr != this->m_history_state.rend(); ritr++)
729 if((*ritr)->m_time_perceived < _start)
731 found_state_schema_pt = ritr->get();
732 return found_state_schema_pt;
736 return found_state_schema_pt;
745 if(
e->m_time_perceived > _end)
747 found_state_schema_pt =
e.get();
748 return found_state_schema_pt;
756 return found_state_schema_pt;
782 {comparison_type = 1;}
784 {comparison_type = 2;}
786 {comparison_type = 3;}
797 if(value_schema_pt != NULL)
802 switch (comparison_type)
807 found_schema_pt = value_schema_pt;
813 found_schema_pt = value_schema_pt;
820 found_schema_pt = value_schema_pt;
840 value_schema_pt = VS_ritr->get();
844 switch (comparison_type)
849 found_schema_pt = value_schema_pt;
855 found_schema_pt = value_schema_pt;
862 found_schema_pt = value_schema_pt;
878 return found_schema_pt;
883 cout <<
r5pars_.timesno <<
" " << str <<
" in MRComponentStateUnit.cpp" <<
'\n';
884 ofstream fout(
"err messages.txt", ios::app);
885 fout <<
r5pars_.timesno <<
" " << str <<
'\n';
912 {comparison_type = 1;}
914 {comparison_type = 2;}
916 {comparison_type = 3;}
927 if(value_schema_pt != NULL)
932 switch (comparison_type)
937 found_schema_pt = value_schema_pt;
943 found_schema_pt = value_schema_pt;
950 found_schema_pt = value_schema_pt;
970 value_schema_pt = VS_ritr->get();
974 switch (comparison_type)
979 found_schema_pt = value_schema_pt;
985 found_schema_pt = value_schema_pt;
992 found_schema_pt = value_schema_pt;
1008 return found_schema_pt;
1031 VS_pt = ritr->get();
1034 found_VS_pt = VS_pt;
1057 found_VS_pt = VS_pt;
1107 auto state_pt = make_unique<MRStateSchema>();
1108 state_pt->CopyStateSchemaFromAnother(
e.get());
1113 auto value_pt = make_unique<MRValueSchema>();
1114 value_pt->CopyMRValueSchemaFromAnother(
e.get());
1174 if(invest_pt != NULL)
1193 if(invest_pt != NULL)
Diagnostic reasoning engine — knowledge representation, mental model, and inference.
SimulationContext g_sim
Global simulation context: the single instance, defined in SimulationContext.cpp.
void CopyIDElementToRestartInfo(IDElement *)
bool m_investigation_closed
SentenceUnit * GetSemanticSentenceOfThisInvestigator()
void ReopenThisInvestigator()
bool m_root_of_a_thought_line
Statement * m_Statement_pt
MRValueSchema * FindAPositionReadingConsistantWithASentenceWithinTimeRange(float _start, float _end, SentenceUnit *_sent_pt)
std::unique_ptr< MRStateSchema > m_recent_state
MRValueSchema * FindTheFirstPositionReadingAfterATime(float _end)
void AddNewState(int, int, bool)
void AddNewStateForFirstRoundCheck(int, int)
std::string m_ID_recent_state_statement
MRValueSchema * FindTheLastPositionReadingBeforeATime(float _start)
MRValueSchema * CheckPositionReadingWithinTimeRange(double, double)
MRStateSchema * CheckTheFirstComponentStateReadingAfterATime(float _end)
MRValueSchema * FindAPositionReadingInconsitantWithASentenceWithinTimeRange(float _start, float _end, SentenceUnit *_sent_pt)
IDElement * m_Concept_ID_pt
virtual ~MRComponentStateUnit()
MRStateSchema * CheckComponentStateWithinTimeRange(float _start, float _end)
Statement * m_recent_state_statement
std::string Control_Value_Indicator_ID
void ReadComponentStateIndication(double)
MRStateSchema * CheckLastComponentStateReadingBeforeATime(float _start)
std::string Component_State_Indicator_ID
void AddNewPositionValue(float, int, bool)
void CopyMRComponentStateInfoFromAnother(MRComponentStateUnit *)
std::vector< std::unique_ptr< MRValueSchema > > m_history_position_value
MRValueSchema * FoundAPositionReadingWithinTimeRange(float, float)
Statement * m_recent_action_statement
std::unique_ptr< MRValueSchema > m_recent_position_value
std::vector< std::unique_ptr< MRStateSchema > > m_history_state
void AddNewPositionValueForFirstRoundCheck(float, int)
void ErrorMessage(std::string str)
void PrintMessage(std::string)
void BuildConnectionsForThisMRComponentState(void *)
void UpdateTheRelevantInvestigator(int)
std::string m_ID_recent_action_statement
std::unique_ptr< ReasonMachine > m_RM
void ActiveFetchParameterValueInfo(std::string, int)
void ActiveFetchComponentStateInfo(std::string, int)
std::unique_ptr< KBConcept > m_Concept_Base
void ActivationUpdateByRefreshAStatement(Statement *)
Investigator * m_working_on_invest_pt
void AddDeltaToCognitiveLoad(float)
void AddANewStatement(Statement *)
Statement * FindStatementByID(std::string)
Investigator * FindInvestigatorByID(std::string)
SentenceUnit * CheckExistInSemanticPoolBySentence(SentenceUnit *)
void AddDeltaToSystemDynamics(float)
void AddNewInvestigator(Investigator *)
IDElement * m_comparison_pt
void RefreshStatementEndTimeToCurrentTime(int)
IDElement * m_investigator_ID_pt
std::string m_ID_investigator
OperatorAT Action_Taker
Crew action execution model.
OperatorDM Decision_Maker
Crew decision-making model.