Исходные данные задачи в стандартной форме

In [194]:
function get_problem()
    A = Float64[3 2 1 1 0; 2 5 3 0 1]
    b = Float64[10, 15]
    c = Float64[-2, -3, -4, 0, 0]
    A, b, c

WARNING: Method definition get_problem() in module Main at In[185]:2 overwritten at In[194]:2.
get_problem (generic function with 1 method)

In [195]:
function update_vars(A, basis, nonbasis)
    B = A[:,basis]
    N = A[:,nonbasis]
    B⁻¹ = inv(B)
     = B⁻¹ * b
    return B, B⁻¹, N, 

WARNING: Method definition update_vars(Any, Any, Any) in module Main at In[186]:2 overwritten at In[195]:2.
update_vars (generic function with 1 method)

In [196]:
function CHUZR(A, )
    m, n = size(A)
    e = eye(m)
    rations = [[p] / norm(B⁻¹ * e[:,p]) for p in 1:m]
    p = collect(take(sortperm(rations, rev=true), 1))
    return p[1]

WARNING: Method definition CHUZR(Any, Any) in module Main at In[187]:2 overwritten at In[196]:2.
CHUZR (generic function with 1 method)

In [197]:
function BTRAN(A, B⁻¹, p)
    m, n = size(A)
    e = eye(m)
    πᵀ = e[:,p]' * B⁻¹
    return πᵀ

WARNING: Method definition BTRAN(Any, Any, Any) in module Main at In[188]:2 overwritten at In[197]:2.
BTRAN (generic function with 1 method)

In [198]:
function PRICE(πᵀ, N)
    âᵀ = πᵀ * N
    return âᵀ

WARNING: Method definition PRICE(Any, Any) in module Main at In[189]:2 overwritten at In[198]:2.
PRICE (generic function with 1 method)

In [199]:
function CHUZC(c, nonbasis, âᵀ)
     = c[nonbasis]
    rations = [[j] / âᵀ'[j] for j in 1:length(âᵀ)]
    q = collect(take(sortperm(rations), 1))
    ĉₙ = c[nonbasis]
    β = [q] / âᵀ[q]
    c[nonbasis] = (ĉₙ' - β * âᵀ)'
    return q[1]

WARNING: Method definition CHUZC(Any, Any, Any) in module Main at In[190]:2 overwritten at In[199]:2.
CHUZC (generic function with 1 method)

In [200]:
function FTRAN(A, B⁻¹, , p, âᵀ, q)
    âq = B⁻¹ * A[:,q]
    α = ([p] / âᵀ[q])[1]
     =  - α * âq

WARNING: Method definition FTRAN(Any, Any, Any, Any, Any, Any) in module Main at In[191]:2 overwritten at In[200]:2.
FTRAN (generic function with 1 method)

In [201]:
function update(basis, nonbasis, p, q)
    basis[p], nonbasis[q] = nonbasis[q], basis[p]

WARNING: Method definition update(Any, Any, Any, Any) in module Main at In[192]:2 overwritten at In[201]:2.
update (generic function with 1 method)

In [202]:
function iter(A, b, c, basis, nonbasis)
    B, B⁻¹, N,  = update_vars(A, basis, nonbasis)
    p = CHUZR(A, )

    πᵀ = BTRAN(A, B⁻¹, p)

    âᵀ = PRICE(πᵀ, N)

    q = CHUZC(c, nonbasis, âᵀ)

    FTRAN(A, B⁻¹, , p, âᵀ, q)

    update(basis, nonbasis, p, q)

WARNING: Method definition iter(Any, Any, Any, Any, Any) in module Main at In[193]:2 overwritten at In[202]:2.
iter (generic function with 1 method)

In [203]:
A, b, c = get_problem()

basis = [4, 5]
nonbasis = [1, 2, 3]

iter(A, b, c, basis, nonbasis)