else:#if the belief does not exist at all, add it to the beliefbase
self.beliefbase.append(belief)
self.addition_count+=1
self.change_count+=1
if (self.abstraction_type==1):#type1 checks abstractions after every new change in the beliefbase
self.abstraction()
elif (self.abstraction_type==3andrevision_flag==1):#type3 checks abstractions after every revision (does not check after additions)
self.abstraction()
elif (self.abstraction_type==5):#type5 remembers any change in the beliefbase
self.change_flag=1
elif (self.abstraction_type==6andbelief[0]inself.relevant_beliefs):#type6 remembers relevant changes in the beliefbase
self.relevant_change_count+=1
self.relevant_change_flag=1
else:
pass
if (self.abstraction_type==2andround%self.round_check==0):#type2 checks abstractions after every "self.round_check" rounds
self.abstraction()
defabstraction(self):
ifself.knowledgebase.__contains__([self.abs_0,1])andself.beliefbase.__contains__([self.abs_1,1])andself.beliefbase.__contains__([self.abs_2,1]):#Means: L_X (Doctor(Y) and Expert(Y) and GoodCommunication(Y) -> Trust(X, Y))
self.trust_x_y=1
else:
self.trust_x_y=0
ifself.beliefbase.__contains__([self.abs_3,1])andself.beliefbase.__contains__([self.abs_4,1]):#Means: L_X (K_Y (GoodCommunication(X)) and L_Y (GoodCapabilities(X)) -> Trust(Y, X))
self.trust_y_x=1
else:
self.trust_y_x=0
#print("Abstractions checked!")
self.abstraction_count+=1
defdeliberation(self,round):
if (self.abstraction_type==4):#type4 checks abstractions only just before deliberation
self.abstraction()
elif (self.abstraction_type==5andself.change_flag==1):#type5 checks abstractions only just before deliberation and if there is an observed change in the beliefbase
self.abstraction()
self.change_flag=0#type5 resets change_flag after checking abstractions
elif (self.abstraction_type==6andself.relevant_change_flag==1):#type6 checks abstractions only just before deliberation and if there is an observed relevant (abstraction-related) change in the beliefbase
self.abstraction()
self.relevant_change_flag=0#type6 resets relevant_change_flag after checking abstractions
elif (self.abstraction_type==2andround%self.round_check==0):#type2 checks abstractions after every "self.round_check" rounds
defcalibrate(self):#convey abstraction-related beliefs to change/calibrate other's beliefs in case of an unexpected deliberation
#function designed for the third experiment where self.trust_x_y is always 1,
#so an action can either be "discuss" or "agree",
#yet the agents conveys the same abstraction-related beliefs nevertheless.
self.calibration_count+=1
ifself.current_deliberation=="discuss":#in our case, "discuss" is the preferred action, but mutual trust is required for that
return[[self.relevant_beliefs[4],1],[self.relevant_beliefs[5],1]]#since the agent already trusts the human, it should also ensure the human's trust for itself