[Python] Linprog error - A_ub must have exactly two dimensions

Discussão em 'Python' iniciado por Stack, Março 11, 2025.

  1. Stack

    Stack Membro Participativo

    I tried to make calculations with linprog, but keeping to get this error; however, A_ub and c are the same size.

    A_eq = np.array([[1,0,0,0,0,1], [0,1,0,-1.05,1,0], [-0.4,-0.3,1,0,-1.05,1]])
    b_eq = np.array([200,100,0])
    A_ub = [0,0,0,-1,-1,-1]
    b_ub = -300
    c = np.array([1.2, 1.3, 1.3, 0, 0, 1.05])
    res = linprog(c, A_ub=A_ub, b_ub=b_ub, A_eq=A_eq, b_eq=b_eq, bounds=[0, None])


    ValueError: Invalid input for linprog: A_ub must have exactly two dimensions, and the number of columns in A_ub must be equal to the size of c

    Continue reading...

Compartilhe esta Página