def func_slack_profit(k, s, greedy_closed, slack_closed):
    """Computes the extra profit from slack, and the linear program relaxation.

    The extra profit is the second summand in expression (30) Theorem 12.
    Then computes expression (30) and (33d).


    Args:
        k: Int. The capacity of the Knapsack Problem instance.
        s: float. The expected value of the splitting item random variable.
        greedy_closed: float. The expected value of the objective function reached by greedy algorithm
        slack_closed: float. The expected value of the slack random variable K.

    Returns:
        lp_closed: float. The expected value of the objective function reached by Linear Programming solution. Is the
                    greedy solution plus slack solution. Expression (30) Theorem 12.
        lp_approx: float. Approximation of the expected value of the Linear Programming o.f. solution.
                   See expression (33d) Theorem 13 (Asymptotic Relations).

        error_approximation: float. Error % when using the expected value approximation of the solution to the linear
                            programming problem
        radio_greedy_linear: ratio Greedy vs Linear Programming Relaxation

    """
    b = 1 + 1 / k  # Defining a cumbersome base

    slack_profit = (k + 1) * b ** (k - 1) / (2 * k)
    slack_profit = slack_profit - (k + 2) * (k + 1) * (b ** k - 1) / (k)
    slack_profit = slack_profit + (k + 2) * (k + 5) * (b ** (k + 1) - 1 - b) / 2
    slack_profit = slack_profit - k * (k + 3) * (b ** (k + 2) - 1 - (k + 2) / k - (k + 2) * (k + 1) / (
            2 * k ** 2))  # Extra Slack for Linear Programming Relaxation

    lp_closed = greedy_closed + slack_profit  # Computing the expected Linear Programming Solution

    lp_approx = greedy_closed + slack_closed * (k - s + 1) / 2 # Approximating Linear Programming Assuming Independence

    error_approximation = 100 * (lp_closed - lp_approx) / lp_closed

    radio_greedy_linear = 100 * greedy_closed / lp_closed # Computing ratio Greedy vs Linear Programming Relaxation

    return lp_closed, lp_approx, error_approximation, radio_greedy_linear