Skip to content

Instantly share code, notes, and snippets.

@julian-ramos
Created February 11, 2016 22:54
Show Gist options
  • Select an option

  • Save julian-ramos/19bc134e5c238338cd38 to your computer and use it in GitHub Desktop.

Select an option

Save julian-ramos/19bc134e5c238338cd38 to your computer and use it in GitHub Desktop.
if __name__=="__main__":
# A=[[1,2,1,0],[3,1,0,1]]
# A=np.array(A)
#
# b=np.array([6,9])
# c=np.array([[-2],[-1],[0],[0]])
# I=np.array([2,3])
#
# print(simplex(I, c, A, b))
#
for t in range(0,30):
data=np.load('test_cases/test{0}.npz'.format(t))
I,I_dual,A,b,c,f,x = data['I'], data['I_dual'], data['A'], data['b'], data['c'], data['f'], data['x']
f1,x1 = dual_simplex(I, c, A, b)
if np.linalg.norm(x1 - x) < 1e-10:
print "Passed test case {0}".format(t)
else:
print "Failed test case {0}".format(t)
print(x1)
print(x)
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment