예제 #1
0
    def __init__(self, number, myWorldState, agType):
        super().__init__(number, myWorldState, agType)
        # the environment
        self.agOperatingSets = []
        self.number = number
        # self.news = np.zeros(common.dim+3) # contiene l'ultima notizia
        # [id-fonte, id-mittente, data, topics(dim)]

        if myWorldState != 0:
            self.myWorldState = myWorldState
        self.agType = agType

        #self.msgLog = np.empty((0, 7))
        common.msglog = self
        if not os.path.exists(common.project.replace("src", "tmp")):
            os.makedirs(common.project.replace("src", "tmp"))
        self.filename = common.project.replace(
            "src", 'tmp/msg_log_temp.%s.txt' % os.getpid())
        self.ff = open(self.filename, 'w')
        self.writer = csv.writer(self.ff)
        self.chunk = []
        self.active = common.writeActivations
        printHeader(
            self.writer,
            firstline=['#messagelog'],
            lastline=["source", "timec", "news", "ag1", "ag2", "time", "type"])
예제 #2
0
    def __init__(self, number, myWorldState, agType, *args, **kwargs):
        super().__init__(number, myWorldState, agType, *args, **kwargs)
        # the environment
        self.agOperatingSets = []
        self.number = number
        # self.news = np.zeros(common.dim+3) # contiene l'ultima notizia
        # [id-fonte, id-mittente, data, topics(dim)]

        if myWorldState != 0:
            self.myWorldState = myWorldState
        self.agType = agType

        self.filename = common.project.replace(
            "src", 'tmp/deg_log_temp.%s.txt' % os.getpid())

        #self.connectionLog = np.empty((0, 5))

        if not os.path.exists(common.project.replace("src", "tmp")):
            os.makedirs(common.project.replace("src", "tmp"))
        self.ff = open(self.filename, 'w')
        self.writer = csv.writer(self.ff)
        self.chunk = []
        self.active = common.writeActivations  # TODO add writeSpreadStates to config.ini file
        printHeader(
            self.writer,
            firstline=['# degreeLog'],
            lastline=['time', 'agent', 'degree'])
        common.deglog = self
예제 #3
0
    def __init__(self, number, myWorldState, agType):
        super().__init__(number, myWorldState, agType)
        # the environment
        self.agOperatingSets = []
        self.number = number
        # self.news = np.zeros(common.dim+3) # contiene l'ultima notizia
        # [id-fonte, id-mittente, data, topics(dim)]

        if myWorldState != 0:
            self.myWorldState = myWorldState
        self.agType = agType

        #self.memoryLog = np.empty((0, 3 + common.memorySize))
        self.filename = common.project.replace(
            "src", 'tmp/mem_log_temp.%s.txt' % os.getpid())
        # end overload from parent class

        if not os.path.exists(common.project.replace("src", "tmp")):
            os.makedirs(common.project.replace("src", "tmp"))
        self.ff = open(self.filename, 'w')
        self.writer = csv.writer(self.ff)
        self.chunk = []
        self.active = common.writeMemories
        printHeader(self.writer,
                    firstline=['# memorylog'],
                    lastline=["agent", "time", "state", "spreadstate"] +
                    ["news" + str(i) for i in range(common.memorySize)])
        common.memlog = self