コード例 #1
0
ファイル: fologic.py プロジェクト: nikoladimitroff/Adder
def __backward_chaining_and(kb, goals, theta):
    if theta is problem.FAILURE:
        return problem.FAILURE
    if len(goals) == 0:
        return theta

    for goal in goals:
        theta = __backward_chaining_or(kb, substitute(goal, theta), theta)

    return theta
コード例 #2
0
ファイル: fologic.py プロジェクト: nikoladimitroff/Adder
def __backward_chaining_and(kb, goals, theta):
    if theta is problem.FAILURE:
        return problem.FAILURE
    if len(goals) == 0:
        return theta

    for goal in goals:
        theta = __backward_chaining_or(kb, substitute(goal, theta), theta)

    return theta
コード例 #3
0
ファイル: fologic.py プロジェクト: nikoladimitroff/Adder
def __standardize_resolvent(resolvent, theta):
    replacer = StandartizationReplacer("x")
    result = set()
    for index, disjunct in enumerate(resolvent):
        # Do we need standartization? No, we don't
        result.add(substitute(disjunct, theta))

    StandartizationReplacer.GlobalIndex = replacer.index
    resolvent = frozenset(result)
    return resolvent
コード例 #4
0
ファイル: fologic.py プロジェクト: nikoladimitroff/Adder
def __standardize_resolvent(resolvent, theta):
    replacer = StandartizationReplacer("x")
    result = set()
    for index, disjunct in enumerate(resolvent):
        # Do we need standartization? No, we don't
        result.add(substitute(disjunct, theta))

    StandartizationReplacer.GlobalIndex = replacer.index
    resolvent = frozenset(result)
    return resolvent