Skip to content

Commit

Permalink
Add commented part after checking if dp_bounds are infinite
Browse files Browse the repository at this point in the history
  • Loading branch information
giuliabaldini committed Jul 24, 2024
1 parent 7ed6e82 commit 7970096
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions exact_kmeans/ilp.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,27 +735,29 @@ def enumerate_sizes(
add_remaining_points=True,
)

# # TODO: This is still not working properly
# if not self.config.get("fill_cluster_sizes", False) and isinstance(
# found_bound, float
# ):
# n_fixed_points += search_end
# k_fixed += 1
# dp_bound = (
# found_bound
# + self.dp_bounds[self.n - n_fixed_points][self.k - k_fixed]
# )
# logger.info(
# f"Bound for {test_sizes} ({found_bound}) with DP bound ({dp_bound})"
# )
# if dp_bound > tightest_upper_bound.value:
# logger.info(
# f"Bound for {test_sizes} ({found_bound}) "
# f"with DP bound ({dp_bound}) "
# "is greater than the current upper bound "
# f"{tightest_upper_bound.value}, skipping..."
# )
# found_bound = "ilp_sum_bound_greater"
if not self.config.get("fill_cluster_sizes", False) and isinstance(
found_bound, float
):
n_fixed_points += search_end
k_fixed += 1
dp_bound = (
found_bound
+ self.dp_bounds[self.n - n_fixed_points][self.k - k_fixed]
)
logger.info(
f"Bound for {test_sizes} ({found_bound}) with DP bound ({dp_bound})"
)
if (
np.isfinite(dp_bound).all()
and dp_bound > tightest_upper_bound.value
):
logger.info(
f"Bound for {test_sizes} ({found_bound}) "
f"with DP bound ({dp_bound}) "
"is greater than the current upper bound "
f"{tightest_upper_bound.value}, skipping..."
)
found_bound = "ilp_sum_bound_greater"
if found_bound not in {"infeasible", "ilp_sum_bound_greater"}:
found_bound = "branch"
# If the program is feasible and we have less than k clusters
Expand Down

0 comments on commit 7970096

Please sign in to comment.