def test_find_subsumer_finds_single_subsumer_among_nonsubsumers(self, cfg): # given subsumer = Classifier(condition='###0####', action=3, effect='##1#####', quality=0.93, reward=1.35, experience=23, cfg=cfg) nonsubsumer = Classifier(cfg=cfg) classifier = Classifier(condition='1##0####', action=3, effect='##1#####', quality=0.5, reward=0.35, experience=1, cfg=cfg) classifiers_list = ClassifiersList( *[nonsubsumer, subsumer, nonsubsumer], cfg=cfg) # when actual_subsumer = classifiers_list.find_subsumer( classifier, choice_func=lambda l: l[0]) # then assert actual_subsumer == subsumer
def test_find_subsumer_random_select_one_of_equally_general_sbsmers( self, cfg): # given subsumer1 = Classifier(condition='1##0####', action=3, effect='##1#####', quality=0.93, reward=1.35, experience=23, cfg=cfg) subsumer2 = Classifier(condition='#1#0####', action=3, effect='##1#####', quality=0.93, reward=1.35, experience=23, cfg=cfg) nonsubsumer = Classifier(cfg=cfg) classifier = Classifier(condition='11#0####', action=3, effect='##1#####', quality=0.5, reward=0.35, experience=1, cfg=cfg) classifiers_list = ClassifiersList( *[nonsubsumer, subsumer1, subsumer2, nonsubsumer], cfg=cfg) # when actual_subsumer = classifiers_list.find_subsumer( classifier, choice_func=lambda l: l[0]) # then assert actual_subsumer == subsumer1 # when actual_subsumer = classifiers_list.find_subsumer( classifier, choice_func=lambda l: l[1]) # then assert actual_subsumer == subsumer2