Skip to content

Commit

Permalink
Revert "Update bistability_finder.py"
Browse files Browse the repository at this point in the history
This reverts commit 2dcfa85.
  • Loading branch information
vladpetyuk committed Aug 25, 2021
1 parent ec99d32 commit 2813e7b
Showing 1 changed file with 16 additions and 40 deletions.
56 changes: 16 additions & 40 deletions crnt4sbml/bistability_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,39 +453,6 @@ def __feasible_point_method(self, samples):

return x_candidates

# @staticmethod
# def __confidence_level(obtained_minimums, change_in_rel_error, important_info):
#
# a = 1
# b = 5
#
# unique_elements, counts_elements = numpy.unique(obtained_minimums, return_counts=True)
# min_val_index = numpy.nanargmin(unique_elements)
#
# f_til = unique_elements[min_val_index]
#
# numpy_float64_smalles_positive_value = numpy.nextafter(numpy.float64(0), numpy.float64(1))
#
# if f_til > numpy_float64_smalles_positive_value:
#
# r = numpy.count_nonzero(
# numpy.abs(f_til - obtained_minimums) / f_til < numpy.float64(change_in_rel_error))
#
# n_til = obtained_minimums.shape[0]
# a_bar = a + b - 1
# b_bar = b - r - 1
#
# prob = 1 - (math.factorial(n_til + a_bar) * math.factorial(2 * n_til + b_bar)) / (
# math.factorial(2 * n_til + a_bar) * math.factorial(n_til + b_bar))
#
# else:
#
# prob = 1.0
#
# important_info += f"It was found that {unique_elements[min_val_index]} is the minimum objective function value with a confidence level of {prob}.\n"
# return important_info


@staticmethod
def __confidence_level(obtained_minimums, change_in_rel_error, important_info):

Expand All @@ -497,14 +464,23 @@ def __confidence_level(obtained_minimums, change_in_rel_error, important_info):

f_til = unique_elements[min_val_index]

r = numpy.count_nonzero(numpy.abs(f_til - obtained_minimums) / f_til < numpy.float64(change_in_rel_error))
numpy_float64_smalles_positive_value = numpy.nextafter(numpy.float64(0), numpy.float64(1))

if f_til > numpy_float64_smalles_positive_value:

r = numpy.count_nonzero(
numpy.abs(f_til - obtained_minimums) / f_til < numpy.float64(change_in_rel_error))

n_til = obtained_minimums.shape[0]
a_bar = a + b - 1
b_bar = b - r - 1
n_til = obtained_minimums.shape[0]
a_bar = a + b - 1
b_bar = b - r - 1

prob = 1 - (math.factorial(n_til + a_bar) * math.factorial(2 * n_til + b_bar)) / (
math.factorial(2 * n_til + a_bar) * math.factorial(n_til + b_bar))

else:

prob = 1 - (math.factorial(n_til + a_bar) * math.factorial(2 * n_til + b_bar)) / (
math.factorial(2 * n_til + a_bar) * math.factorial(n_til + b_bar))
prob = 1.0

important_info += f"It was found that {unique_elements[min_val_index]} is the minimum objective function value with a confidence level of {prob}.\n"
return important_info
return important_info

0 comments on commit 2813e7b

Please sign in to comment.