コード例 #1
0
ファイル: alp.py プロジェクト: mk5135795/pyalcs
def apply(p0: Perception, p1: Perception, cl: Classifier,
          population: ClassifiersList):
    if not _perception_changed(p0, p1):
        handle_useless_case(cl)
    elif cl.does_anticipate_correctly(p0, p1):
        handle_expected_case(cl)
    elif not cl.does_anticipate_correctly(p0, p1) and _perception_changed(
            p0, p1) and cl.can_be_corrected(p0, p1):
        handle_correctable_case(p0, p1, cl, population)
    else:
        handle_not_correctable_case(cl, p0)

    # Remove inadequate classifiers
    for cl in population:
        if cl.is_inadequate() and not cl.is_general():
            population.remove(cl)
コード例 #2
0
ファイル: test_Classifier.py プロジェクト: mk5135795/pyalcs
    def test_distinguish_general_classifier(self, _c, _e, _result, cfg):
        cl = Classifier(condition=Condition(_c), effect=Effect(_e), cfg=cfg)

        assert cl.is_general() == _result