You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defsolve(c, b, A, debug_output=False, blands_rule=False):
13
+
n=len(c)
14
+
m=len(b)
15
+
16
+
simplex_tableau=make_tableau(c, b, A)
17
+
18
+
returnsolve_tableau(n, m, simplex_tableau, debug_output, blands_rule)
19
+
20
+
defsolve_tableau(n, m, simplex_tableau, debug_output=False, blands_rule=False):
21
+
ifdebug_output:
22
+
print("Simplex tableau :")
23
+
print(simplex_tableau)
24
+
25
+
whileTrue:
26
+
# Column selection
27
+
# Equivalent to searching for the variable in the base that would increase the output function the most
28
+
optimal=True
29
+
column=0
30
+
ifblands_rule:
31
+
fori, einenumerate(simplex_tableau[-1]):
32
+
ife<0:
33
+
optimal=False
34
+
column=i
35
+
break
36
+
else:
37
+
fori, einenumerate(simplex_tableau[-1]):
38
+
ife<0:
39
+
optimal=False
40
+
ife<simplex_tableau[-1, column]:
41
+
column=i
42
+
43
+
ifoptimal:
44
+
ifdebug_output:
45
+
print("Optimal simplex tableau found")
46
+
break
47
+
48
+
# Row selection
49
+
# Equivalent to searching for the variable outside the base that constraints the augmentation of the output function the most (smallest b_i / leaving variable coefficient)
0 commit comments