Skip to content

Commit

Permalink
Send edges via context
Browse files Browse the repository at this point in the history
  • Loading branch information
leo848 committed Apr 5, 2024
1 parent 7732757 commit 0958f3a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/path/create/ilp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,21 @@ pub fn solve<C: CreateContext>(ctx: C) -> C::Path {
let mut paths = print_paths_solution(&mut model, &x);

while paths.len() > 1 {
ctx.send_edges(
paths
.iter()
.flat_map(|path| {
path.iter().tuple_windows::<(_, _)>().chain(
if path[0] == path[path.len() - 1] {
vec![(&path[path.len() - 1], &path[0])]
} else {
vec![]
},
)
})
.map(|(&i, &j)| (i, j)),
None,
);
add_cycle_constraints(&mut model, &paths, &x);
paths = print_paths_solution(&mut model, &x);
}
Expand Down

0 comments on commit 0958f3a

Please sign in to comment.