def rosenbrock(x):
    """Rosenbrock test fitness function"""
    n = len(x)
    if n < 2:
        raise ValueError('dimension must be greater than one')
    return -sum(100 * (x[i+1] - x[i]**2)**2 + (1 - x[i])**2
                for i in range(n-1))