# Path: lcs/strategies/subsumption.py
# def does_subsume(cl, other_cl, theta_exp: int) -> bool:
#     """
#     Returns if a classifier `cl` subsumes `other_cl` classifier
# 
#     Parameters
#     ----------
#     cl:
#         subsumer classifier
#     other_cl:
#         other classifier
#     theta_exp: int
#         experience threshold
# 
#     Returns
#     -------
#     bool
#         True if `other_cl` classifier is subsumed, False otherwise
#     """
#     if is_subsumer(cl, theta_exp) and \
#         cl.is_more_general(other_cl) and \
#         cl.condition.subsumes(other_cl.condition) and \
#             cl.action == other_cl.action and \
#             cl.effect.subsumes(other_cl.effect):
#         return True
# 
#     return False


from lcs.strategies.subsumption import does_subsume


def add_classifier(child, population, new_list, theta_exp: int) -> None:
    """
    Looks for subsuming / similar classifiers in the population of classifiers
    and those created in the current ALP run (`new_list`).

    If a similar classifier was found it's quality is increased,
    otherwise `child_cl` is added to `new_list`.

    Parameters
    ----------
    child:
        New classifier to examine
    population:
        list of classifiers
    new_list:
        A list of newly created classifiers in this ALP run
    theta_exp: int
        experience threshold for subsumption
    """
    # TODO: p0: write tests
    old_cl = None

    # Look if there is a classifier that subsumes the insertion candidate
    for cl in population:

# Path: lcs/strategies/subsumption.py
# def does_subsume(cl, other_cl, theta_exp: int) -> bool:
#     """
#     Returns if a classifier `cl` subsumes `other_cl` classifier
# 
#     Parameters
#     ----------
#     cl:
#         subsumer classifier
#     other_cl:
#         other classifier
#     theta_exp: int
#         experience threshold
# 
#     Returns
#     -------
#     bool
#         True if `other_cl` classifier is subsumed, False otherwise
#     """
#     if is_subsumer(cl, theta_exp) and \
#         cl.is_more_general(other_cl) and \
#         cl.condition.subsumes(other_cl.condition) and \
#             cl.action == other_cl.action and \
#             cl.effect.subsumes(other_cl.effect):
#         return True
# 
#     return False


# Path: lcs/strategies/anticipatory_learning_process.py
from lcs.strategies.subsumption import does_subsume



def add_classifier(child, population, new_list, theta_exp: int) -> None:
    """
    Looks for subsuming / similar classifiers in the population of classifiers
    and those created in the current ALP run (`new_list`).

    If a similar classifier was found it's quality is increased,
    otherwise `child_cl` is added to `new_list`.

    Parameters
    ----------
    child:
        New classifier to examine
    population:
        list of classifiers
    new_list:
        A list of newly created classifiers in this ALP run
    theta_exp: int
        experience threshold for subsumption
    """
    # TODO: p0: write tests
    old_cl = None

    # Look if there is a classifier that subsumes the insertion candidate
    for cl in population:

        if does_subsume(cl, child, theta_exp):