Skip to content

Commit

Permalink
Fix steiner acyclic constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
pablormier committed May 22, 2024
1 parent 25362e0 commit 3548593
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions corneto/methods/steiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,15 @@ def exact_steiner_tree(
P += F[ids] >= 10 / (len(terminals) + 1) # Force all terminals to be present
else:
id_edge_prized = np.array([dummy_edges[v] for v in prized_nodes])
P += K.NonZeroIndicator(F, indexes=id_edge_prized, tolerance=tolerance)
P += K.NonZeroIndicator(
F,
indexes=id_edge_prized,
tolerance=tolerance,
suffix_pos="_nz_ipos",
suffix_neg="_nz_ineg",
)
I_prized_selected = (
P.symbols[f"{flow_name}_ipos"] + P.symbols[f"{flow_name}_ineg"]
P.symbols[f"{flow_name}_nz_ipos"] + P.symbols[f"{flow_name}_nz_ineg"]
)
P.add_objectives(np.array(prizes) @ I_prized_selected, weights=-1)

Expand Down

0 comments on commit 3548593

Please sign in to comment.