def is_prediction_in_threshold_regression(y_acceptable_range, prediction):
    """Calculates the constraints 2 (g2) and 3 (g3). Constraint 2 determines 
    if the predicted value is greater than or equal the minimum acceptable 
    value for the output. Constraint 3 determines if the predicted value is 
    lesser than or equal the maximum acceptable value for the output. Valid 
    only for regression problems.

    :param y_acceptable_range: the lower (first value) and upper 
        (second value) limits allowed for the prediction
    :type y_acceptable_range: numpy.array
    :param prediction: the predicted values
    :type prediction: numpy.array
    
    :return: two objects. The first are the constraint 2 (g2) values and
        the second are the constraint 3 (g3) values. Each element of both objects
        represents the results for an individual.
    :rtype: np.array (first object) and np.array (second object)
    """
    # g2 and g3: the predicted value must fall in a certain range
    g2 = y_acceptable_range[0] - prediction
    g3 = prediction - y_acceptable_range[1]
    return g2, g3