def inertia_update(iteration,n_iterations,wmin,wmax):
    """
    Time varying acceleration inertia:
    
    w^k = wmax - (wmax - wmin)/kmax * k

    Parameters:
        iteration: int
            The number of the iteration
        n_iterations: int
            The number of total iterations
        wmin: float
            The minimum value of the itertia weight
        wmax: float
            The maximum value of the inertia weight

    Returns: float
        The new intertia weight value
    """

    W=wmax-((wmax-wmin)/n_iterations)*iteration
    return W