Created
May 29, 2014 18:56
-
-
Save stevenRush/3eabd3b957c67edfd1ee to your computer and use it in GitHub Desktop.
Worst-case simplex method example generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __name__ == '__main__': | |
d = 18 | |
c = [str(10**(d-i)) for i in range(1, d+1)] | |
a = [] | |
b = [] | |
for row in range(d): | |
a.append(['0'] * d) | |
for j in range(0, row): | |
a[-1][j] = str(2 * 10 ** (row - j)) | |
a[-1][row] = '1' | |
b.append(str(10 ** (row))) | |
f = open("C:\\temp\\input.txt", 'w') | |
f.write(str(d)) | |
f.write("\n") | |
f.write(' '.join(c)) | |
f.write("\n") | |
f.write(str(d)) | |
f.write("\n") | |
for line in a: | |
f.write(' '.join(line)) | |
f.write("\n") | |
f.write(' '.join(b)) | |
f.write("\n") | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment