def f2_time_param_penalization(P_r, w, limits, phase="val"):

    """
    Computes a numerical fitness value regarding 3 objectives:
        Fit() = w1*norm(acc) + w2*norm(time) + w3*norm(params)
    The three: acc, time and params are normalized with min-max normalization

    :param P_r: Evaluated results of population P
    :param w: Weights rewarding/penalizing each objective
    :param limits: min&max constants for normalizaing
    :param phase: Dataset split. Train/Test/Validation
    :return: A python list ==> fitness value for each individual
    """

    assert len(w) == 3, "Lenth of w should be = 3"
    assert phase == "val" or phase == "test" or phase == "train", "ERROR: Fitness computed on test, val or train splits"

    fit = [0] * len(P_r)

    for i_ind, i in enumerate(P_r):
        if phase == 'val':
            absolute_acc = i.val['system'].accuracy
            absolute_time = i.val['system'].time
            absolute_params = i.val['system'].params
        elif phase == 'test':
            absolute_acc = i.test['system'].accuracy
            absolute_time = i.test['system'].time
            absolute_params = i.test['system'].params
        else:
            absolute_acc = i.train['system'].accuracy
            absolute_time = i.train['system'].time
            absolute_params = i.train['system'].params

        relative_acc = (absolute_acc - limits['min_accuracy'])/(limits['max_accuracy'] - limits['min_accuracy'])
        relative_inference_time = (absolute_time - limits['max_time'])/(limits['min_time'] - limits['max_time'])
        relative_model_params = (absolute_params - limits['max_params'])/(limits['min_params'] - limits['max_params'])

        fit[i_ind] = (w[0] * relative_acc) + (w[1] * relative_inference_time) + (w[2] * relative_model_params)

    return fit