изменен алгоритм расчета погрешности
This commit is contained in:
@@ -137,19 +137,23 @@ def sample_search(
|
|||||||
x2_last = x2.copy()
|
x2_last = x2.copy()
|
||||||
x2_last_err = x2_err.copy()
|
x2_last_err = x2_err.copy()
|
||||||
|
|
||||||
|
error_growth_coeff = 0.05 # КОЭФФИЦИЕНТ РОСТА ОШИБКИ
|
||||||
|
|
||||||
while fit(f(x2), f(x1)):
|
while fit(f(x2), f(x1)):
|
||||||
x2_last = x2.copy()
|
x2_last = x2.copy()
|
||||||
x2_last_err = x2_err.copy()
|
x2_last_err = x2_err.copy()
|
||||||
|
|
||||||
if not r(x2 + (x2 - x1)):
|
step = x2 - x1
|
||||||
|
if not r(x2 + step):
|
||||||
log("Ограничение ОДЗ")
|
log("Ограничение ОДЗ")
|
||||||
break
|
break
|
||||||
|
|
||||||
x2, x1 = x2 + (x2 - x1), x2
|
x2, x1 = x2 + step, x2
|
||||||
|
|
||||||
t_err = x2_err.copy()
|
# Новая погрешность
|
||||||
x2_err = x2_err + (x2_err + x1_err)
|
step_error = error_growth_coeff * np.abs(step)
|
||||||
x1_err = t_err.copy()
|
x2_err = x2_err + step_error
|
||||||
|
x1_err = x2_err.copy()
|
||||||
|
|
||||||
log("Найдена точка", x2_last, f(x2_last))
|
log("Найдена точка", x2_last, f(x2_last))
|
||||||
return x2_last, x2_last_err
|
return x2_last, x2_last_err
|
||||||
@@ -177,7 +181,7 @@ def example():
|
|||||||
> - ищем максимум
|
> - ищем максимум
|
||||||
< - ищем минимум
|
< - ищем минимум
|
||||||
"""
|
"""
|
||||||
return a > b
|
return a < b
|
||||||
|
|
||||||
def r(x):
|
def r(x):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user