def constrain_gurobi_infty(v):
    """
    Limit values of vector v between +/- infinity as
    defined in the Gurobi package
    """
    import gurobipy as grb
    n = len(v)
    for i in range(n):
        if v[i] >= 1e+20:
            v[i] = grb.GRB.INFINITY
        if v[i] <= -1e+20:
            v[i] = -grb.GRB.INFINITY
