Skip to content

Commit 98d1fe3

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 1ec5fec commit 98d1fe3

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
@@ -762,9 +762,16 @@ void ParallelContainerBase::liftModifiedSolution(SolutionBasePtr&& modified_solu
762762
void ParallelContainerBase::liftModifiedSolution(SolutionBasePtr&& new_solution, InterfaceState&& new_propagated_state, const SolutionBase& child_solution) {
763763
assert(child_solution.creator());
764764
assert(child_solution.creator()->parent() == this);
765-
assert(pimpl()->requiredInterface() == PROPAGATE_FORWARDS || pimpl()->requiredInterface() == PROPAGATE_BACKWARDS);
766765

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

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

0 commit comments

Comments
 (0)