def feasible(x, constr):
    """
    Checks the inequality constraints at x. If x is a feasible point,
    returns True. If it is infeasible, returns the index of the first
    constraint violated.
    """
    if constr==None:
        return True
    for i in range(len(constr)):
        fi_x = constr[i](x)
        if fi_x > 0:
            return i
    return True