Skip to content

Commit 2072ec0

Browse files
committed
Allow Generator wrappers to use lift with one new state
It's just a nicer interface than calling `liftModifiedSolution(sol, InterfaceState{s}, InterfaceState{s}, child)` everywhere.
1 parent 223b5d1 commit 2072ec0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

core/src/container.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,9 +761,16 @@ void ParallelContainerBase::liftModifiedSolution(SolutionBasePtr&& modified_solu
761761
void ParallelContainerBase::liftModifiedSolution(SolutionBasePtr&& new_solution, InterfaceState&& new_propagated_state, const SolutionBase& child_solution) {
762762
assert(child_solution.creator());
763763
assert(child_solution.creator()->parent() == this);
764-
assert(pimpl()->requiredInterface() == PROPAGATE_FORWARDS || pimpl()->requiredInterface() == PROPAGATE_BACKWARDS);
765764

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

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

0 commit comments

Comments
 (0)