diff --git a/model.py b/model.py index b54852fcf1285a27418776783f0422661997cb09..80ba27694b93f1ef3d3905eb79abc363b9274bad 100644 --- a/model.py +++ b/model.py @@ -7,10 +7,10 @@ import networkx as nx from agents import Bot, Police, Normal #Definition von Spreading-rates - #rate_PoliceToImmune = 0.5 - #rate_BotToNormal = 0.2 - #rate_MisToNormal = ?? - #rate_NormalSelf = ?? +rate_PoliceToImmune = 0.5 +rate_BotToMis = 0.2 +rate_MisToNormal = 0.1 +rate_NormalSelf = 0.01 class FakeModel(mesa.Model): """ @@ -80,12 +80,20 @@ class FakeModel(mesa.Model): #Änderungen des Steps for person in self.schedule.agents: #Übergang: Normal zu misinformiert - if person.id in self.NeigBot and person.state == "normal" and random.random() <= 0.2: + if person.id in self.NeigBot and person.state == "normal" and random.random() <= rate_BotToMis: person.state = "normal_mis" NorToMis.append(person.id) #Übergang: Immunisierung von Normalen - if person.id in self.NeigPolice and person.state in ["normal","normal_mis"] and random.random() <= 0.5: + if person.id in self.NeigPolice and person.state in ["normal","normal_mis"] and random.random() <= rate_PoliceToImmune: person.state = "immune" MisToNor.append(person.id) + #Übergang: Misinformiert zu Normalen + if person.id in self.NeigMis and person.state == "normal" and random.random() <= rate_MisToNormal: + person.state = "normal_mis" + NorToMis.append(person.id) + #Übergang: Normal zu Mis in Feed + if person.state == "normal" and random.random() <= rate_NormalSelf: + person.state = "normal_mis" + NorToMis.append(person.id) print("Zu mis: ", NorToMis, " Zu Imm: ", MisToNor, "\n") \ No newline at end of file diff --git a/run.py b/run.py index 906efd5d5692b413311cc6f53d98a402047d61f7..5734ebaf7e6679c5992c2ec2c08715c6923eaa1c 100644 --- a/run.py +++ b/run.py @@ -7,7 +7,7 @@ from matplotlib.colors import LinearSegmentedColormap from model import FakeModel #Initialisierung -FirstIteration = FakeModel(N=1000, police=23, bots=90, misinformed=1, ANDeg=60, directed=False) +FirstIteration = FakeModel(N=50, police=4, bots=6, misinformed=3, ANDeg=7, directed=False) # Beispielzustände für jeden Agenten/ Visualisierungsparameter states = {"police": "blue", "bot": "red", "normal": "grey", "normal_mis": "orange", "immune":"green"}