Skip to content

Commit

Permalink
Solutions to the integer linear program for fixing faulty cocyle lift…
Browse files Browse the repository at this point in the history
…s are now allowed to take negative values.
  • Loading branch information
vincent-grande committed Aug 19, 2024
1 parent 5ba27e5 commit d1e01f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 3 additions & 0 deletions dreimac/complexprojectivecoords.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,13 @@ def get_coordinates(
n_edges = delta2.shape[1]
objective = np.zeros((n_edges), dtype=int)
integrality = np.ones((n_edges), dtype=int)
bounds = scipy.optimize.Bounds() # empty bounds

optimizer_solution = milp(
objective,
integrality=integrality,
constraints=constraints,
bounds=bounds,
)

if not optimizer_solution["success"]:
Expand Down
12 changes: 4 additions & 8 deletions dreimac/toroidalcoords.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,14 @@ def get_coordinates(
n_edges = delta1.shape[1]
objective = np.zeros((n_edges))
integrality = np.ones((n_edges))
bounds = scipy.optimize.Bounds() # trivial bounds

optimizer_solution = milp(
objective,
integrality=integrality,
constraints=constraints,
bounds=bounds,
)

if not optimizer_solution["success"]:
raise Exception(
"The cohomology class at index "
Expand Down Expand Up @@ -320,10 +321,7 @@ def _is_one_cocycle(
for j in range(i + 1, n_points):
if dist_mat[i, j] < threshold:
for k in range(j + 1, n_points):
if (
dist_mat[i, k] < threshold
and dist_mat[j, k] < threshold
):
if dist_mat[i, k] < threshold and dist_mat[j, k] < threshold:
index_ij = combinatorial_number_system_d1_forward(
i, j, lookup_table
)
Expand All @@ -335,9 +333,7 @@ def _is_one_cocycle(
)

if (
cochain[index_ij]
+ cochain[index_jk]
- cochain[index_ik]
cochain[index_ij] + cochain[index_jk] - cochain[index_ik]
!= 0
):
is_cocycle = False
Expand Down

0 comments on commit d1e01f6

Please sign in to comment.