Fix inputs output, start fixing Vogel

This commit is contained in:
emil
2024-11-09 18:38:24 +03:00
parent e599fdaec9
commit 0726e6a349
+13 -5
View File
@@ -84,6 +84,7 @@ def Vogel(
for xi in range(C_init_length): for xi in range(C_init_length):
if (yi == y and xi == x): if (yi == y and xi == x):
solution_matrix[y][x] = val solution_matrix[y][x] = val
while (len(C[0]) > 1 and len(C) > 1): while (len(C[0]) > 1 and len(C) > 1):
iteration += 1 iteration += 1
@@ -160,10 +161,19 @@ def Vogel(
C = np.delete(C, column_index_to_eleminate, 1) C = np.delete(C, column_index_to_eleminate, 1)
D = np.delete(D, column_index_to_eleminate, 0) D = np.delete(D, column_index_to_eleminate, 0)
print(C)
print(C)
print(selected_value) print(selected_value)
print(solution_matrix) print(solution_matrix)
Z = np.sum(np.dot(solution_matrix, C_initial.T))
Z_matrix = np.zeros((C_init_height, C_init_length), dtype=np.int64)
for y in range(C_init_height):
for x in range(C_init_length):
Z_matrix[y][x] = solution_matrix[y][x] * C_initial[y][x]
Z = np.sum(Z_matrix)
print(f"Z = {Z}") print(f"Z = {Z}")
result = Result(State.SOLVED, Z, solution_matrix) result = Result(State.SOLVED, Z, solution_matrix)
return result return result
@@ -173,7 +183,7 @@ def Vogel(
else: else:
return Result(State.UNAPPLICABLE)''' return Result(State.UNAPPLICABLE)'''
#Vogel(S,C,D) Vogel(S,C,D)
def Russell( def Russell(
@@ -234,8 +244,6 @@ def print_problem_statement(
matrix = np.hstack((matrix, S)) matrix = np.hstack((matrix, S))
matrix = matrix.astype(object) matrix = matrix.astype(object)
matrix[matrix == M] = "M" matrix[matrix == M] = "M"
print("Initial full matrix:")
print(matrix)
table = "" table = ""
for y in range(len(matrix)): for y in range(len(matrix)):
row = "" row = ""