One step linear programming pivot

asked 2020-07-31 01:29:40 -0500

Cyrille gravatar image

The following question is not because I do not appreciate the numerous linear programming tools disponible from Sage or Python, but because I want to force my student to have a reflexion on how the Dantzig algorithm works by themselves

Here is some data

A=matrix([[1,2,3,4],[4,3,2,1],[2,4,3,1]])   
b=vector([10,20,30])
c=vector([1,-2,3,-1])

With the help of this function

def tableau_(mat, cont, obj):
    Id = identity_matrix(mat.nrows())
    z = matrix(zero_vector(mat.ncols()-1))
    return block_matrix([[A,II,matrix(b).transpose()],[matrix(c),matrix(z),zero_matrix(1,1)]],subdivide=False)

I can construct the following table

mm=matrix(tableau_(A, b, c))
show(mm)

now I want a simple step a the Dantzig pivot algorithm applied to mm throug a calling function like

one_step_pivot(mm, mm[2][2]) where mm[2][2] is the pivot. I wonder if there is a simple tools in Sage or numpy or any other package that do the trick or if I would be oblige to write the code by myself nwhich will tazkes me a lot of time. By advance thanks for the help.

edit retag flag offensive close merge delete