예제 #1
0
파일: ACS2.py 프로젝트: masterchef8/ACS2
def gen_match_set(pop: list, percept: list):
    """
    Generate a list of Classifier thats match current perception
    :param pop:
    :type pop: list
    :param percept:
    :type percept: list
    :return:
    :rtype: list
    """
    ma = []
    if time == 0 or len(pop) == 0:
        for i in range(cons.nbAction):
            newcl = Classifier()
            newcl.condition = [cons.symbol] * cons.lenCondition
            newcl.action = i
            newcl.effect = [cons.symbol] * cons.lenCondition
            newcl.exp = 0
            newcl.t = time
            newcl.q = 0.5
            pop.append(newcl)
    for c in pop:
        if does_match(c, percept):
            ma.append(c)
    return ma
예제 #2
0
파일: ACS2.py 프로젝트: masterchef8/ACS2
def cover_triple(percept_: list, action: int, percept: list, t: int) -> Classifier:
    child = Classifier()

    for i in range(len(percept)):
        if percept_[i] != percept[i]:
            child.condition[i] = percept_[i]
            child.effect[i] = percept[i]
    child.action = action
    child.exp = 0
    child.r = 0
    child.aav = 0
    child.alp = t
    child.tga = t
    child.t = t
    child.q = 0.5
    child.num = 1
    return child