Skip to content

Commit

Permalink
Allow Generator wrappers to use lift with one new state
Browse files Browse the repository at this point in the history
It's just a nicer interface than calling
`liftModifiedSolution(sol, InterfaceState{s}, InterfaceState{s}, child)` everywhere.
  • Loading branch information
v4hn committed Apr 13, 2021
1 parent 1ec5fec commit 98d1fe3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions core/src/container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,9 +762,16 @@ void ParallelContainerBase::liftModifiedSolution(SolutionBasePtr&& modified_solu
void ParallelContainerBase::liftModifiedSolution(SolutionBasePtr&& new_solution, InterfaceState&& new_propagated_state, const SolutionBase& child_solution) {
assert(child_solution.creator());
assert(child_solution.creator()->parent() == this);
assert(pimpl()->requiredInterface() == PROPAGATE_FORWARDS || pimpl()->requiredInterface() == PROPAGATE_BACKWARDS);

pimpl()->liftSolution(std::move(new_solution), child_solution.start(), child_solution.end(), &new_propagated_state, &new_propagated_state);
if(pimpl()->requiredInterface() == GENERATE){
// in this case we need a second InterfaceState to move from
InterfaceState new_to{ new_propagated_state };
pimpl()->liftSolution(std::move(new_solution), child_solution.start(), child_solution.end(), &new_propagated_state, &new_to);
}
else {
// pass new_propagated_state as start *and* end. We know at most one will be used.
pimpl()->liftSolution(std::move(new_solution), child_solution.start(), child_solution.end(), &new_propagated_state, &new_propagated_state);
}
}

void ParallelContainerBase::liftModifiedSolution(SolutionBasePtr&& new_solution, InterfaceState&& new_from, InterfaceState&& new_to, const SolutionBase& child_solution) {
Expand Down

0 comments on commit 98d1fe3

Please sign in to comment.