Skip to content

Commit dcc2092

Browse files
Fix bug with dict
1 parent e121911 commit dcc2092

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

Lab2/frontshow/calc_algorithm/aritificialImmuneSystemShow.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from Lab2.backend.algorithmArtificialImmuneSystem import algorithm_artificial_immune_system
44
from Lab2.backend.helper import getMatrixFromList
5-
from Lab2.backend.helper_predicat import isNotEmptyFields,isNotOutGraphic
5+
from Lab2.backend.helper_predicat import isNotEmptyFields, isNotOutGraphic, isNotOutGraphicDict
66

77
import global_variable as gv
88
import frontshow.animation as anim
@@ -16,7 +16,13 @@ def call_AIimmuneSystem(arr_textField) -> None:
1616
max_x = float(arr_textField[1].get())
1717
min_y = float(arr_textField[2].get())
1818
max_y = float(arr_textField[3].get())
19-
if isNotOutGraphic(gv.START,gv.END,min_x,max_x,min_y,max_y):
19+
isNotOutGraphic = False
20+
if (type(gv.START) == dict):
21+
isNotOutGraphic = isNotOutGraphicDict(gv.START, gv.END, min_x, max_x, min_y, max_y)
22+
else:
23+
isNotOutGraphic = isNotOutGraphic(gv.START, gv.END, min_x, max_x, min_y, max_y)
24+
25+
if isNotOutGraphic:
2026
sizePopulize = int(arr_textField[4].get())
2127
countGenerations = int(arr_textField[5].get())
2228
best_point, points = algorithm_artificial_immune_system(min_x, max_x, min_y, max_y, sizePopulize, gv.current_function, countGenerations)

Lab2/frontshow/calc_algorithm/beesShow.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from backend.algorithm_of_bees import algorithm_of_bees
44
from Lab2.backend.helper import deleteDuplicateValue
5-
from Lab2.backend.helper_predicat import isNotEmptyFields,isNotOutGraphic
5+
from Lab2.backend.helper_predicat import isNotEmptyFields, isNotOutGraphic, isNotOutGraphicDict
66

77
import global_variable as gv
88
import frontshow.animation as anim
@@ -16,7 +16,14 @@ def call_Bees(arr_textField) -> None:
1616
max_x = float(arr_textField[1].get())
1717
min_y = float(arr_textField[2].get())
1818
max_y = float(arr_textField[3].get())
19-
if isNotOutGraphic(gv.START,gv.END,min_x,max_x,min_y,max_y):
19+
20+
isNotOutGraphic = False
21+
if (type(gv.START) == dict):
22+
isNotOutGraphic = isNotOutGraphicDict(gv.START, gv.END, min_x, max_x, min_y, max_y)
23+
else:
24+
isNotOutGraphic = isNotOutGraphic(gv.START, gv.END, min_x, max_x, min_y, max_y)
25+
26+
if isNotOutGraphic:
2027
numBees = int(arr_textField[4].get())
2128
time = int(arr_textField[5].get())
2229
rezusl, points = algorithm_of_bees(min_x, max_x, min_y, max_y, numBees, gv.current_function, time)

0 commit comments

Comments
 (0)