单纯形法介绍
详见我的另一篇文章https://blog.csdn.net/cpluss/article/details/100806516
python代码
import numpy as np
class Simplex(object):
def __init__(self, c, A, b):
self.c = c
self.A = A
self.b = b
def run(self):
c_shape = self.c.shape
A_shape = self.A.shape
b_shape = self.b.shape
assert c_shape[0] == A_shape[1], "Not Aligned A with C shape"
assert b_shape[0] == A_shape[0], "Not Aligned A with b shape"
end_index = A_shape[1] - A_shape[0]
N = self.A[:, 0:end_index]
N_columns = np.arange(0, end_index)
c_N = self.c[N_columns, :]
B = self.A[:, end_index: