コード例 #1
0
    def test_should_subsume_another_classifier_3(self, cfg):
        # Given
        cls = Classifier(quality=0.99, reward=11.4, experience=32, cfg=cfg)
        cls.condition[6] = '0'
        cls.action = 6

        other = Classifier(quality=0.5, reward=9.89, experience=1, cfg=cfg)
        other.condition[3] = '1'
        other.condition[6] = '0'
        other.action = 6

        # when & then
        assert cls.does_subsume(other) is True
コード例 #2
0
    def test_should_subsume_another_classifier_1(self, cfg):
        # given
        cls = Classifier(quality=0.93, reward=1.35, experience=23, cfg=cfg)
        cls.condition[3] = '0'
        cls.action = 3
        cls.effect[2] = '1'

        other = Classifier(quality=0.5, reward=0.35, experience=1, cfg=cfg)
        other.condition[0] = '1'
        other.condition[3] = '0'
        other.action = 3
        other.effect[2] = '1'

        # when & then
        assert cls.does_subsume(other) is True
コード例 #3
0
    def test_should_subsume_another_classifier_2(self, cfg):
        # given
        cls = Classifier(quality=0.84, reward=0.33, experience=3, cfg=cfg)
        cls.condition[0] = '1'
        cls.condition[1] = '0'
        cls.condition[4] = '0'
        cls.condition[6] = '1'
        cls.action = 6
        cls.effect[0] = '0'
        cls.effect[1] = '1'
        cls.effect[6] = '0'

        other = Classifier(quality=0.5, reward=0.41, experience=1, cfg=cfg)
        other.condition[0] = '1'
        other.condition[1] = '0'
        other.condition[6] = '2'
        other.action = 3
        other.effect[0] = '0'
        other.effect[1] = '1'
        other.effect[6] = '0'

        # when & then
        assert cls.does_subsume(other) is False