def obj(X):
    """
    Objective function: Rosenbrock function with n variables
    Minimum for obj(1.0,...,1.0) = 0.0
    """
    res = 0.0
    for i_param in range(len(X)-1):
        res += 100.0*(X[i_param+1]-X[i_param]**2)**2 + (X[i_param]-1.0)**2
    return res