В принципе код выглядел так:
Код: Выделить всё
import time
# Function that pauses and checks if a value is above a certain threshold
def check_infeasible_status(delta_gap_test):
return delta_gap_test > 1.65 # Returns True if above 1.65, False if below
# Initial values for the bounds and test variable
Delta_gap_upper = 1.875
Delta_gap_lower = 0.9375
Delta_gap_test = (Delta_gap_upper + Delta_gap_lower) / 2
# While loop to find the midpoint
while abs(Delta_gap_upper - Delta_gap_lower) > 0.1:
#some code
time.sleep(1) # Pause for 1 second
#some code
print(f"Delta_gap test = {Delta_gap_test}")
print(["upper bound", Delta_gap_upper])
print(["lower bound", Delta_gap_lower])
if check_infeasible_status(Delta_gap_test):
print("The status is Infeasible.")
Delta_gap_upper = Delta_gap_test
else:
print("The status is not Infeasible.")
Delta_gap_lower = Delta_gap_test
Delta_gap_test = (Delta_gap_upper + Delta_gap_lower) / 2
print(f"Delta_gap test updated = {Delta_gap_test}")
Delta_gap_upper,Delta_gap_lower,Delta_gap_test
Код: Выделить всё
Delta_gap_upper=Delta_gap_test
Сталкивался ли кто-нибудь с подобным раньше? Или знаете, что это может быть?
Подробнее здесь: https://stackoverflow.com/questions/791 ... tel-laptop