-
Notifications
You must be signed in to change notification settings - Fork 173
Fix Pruning #309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Pruning #309
Conversation
Keep the previous logic around for Generator stages. Note that this only makes sense for *pure* Generators and not for MonitoringGenerator, because for the latter we would expect monitored solutions to be passed individually (similar to pruning).
give an elaborate reason for an empty overload that doesn't call the parent.
Note that while this ensures other stages outside the Fallbacks container can compute as well, it does not solve the problem internally. A new incoming state will only ever be considered once the current stage cannot compute any more. We have no way of telling a child to compute for *a specific state* for now. So once we copied a state to its interface we have to let it compute until all possibilities are exhausted to detect whether or not it could generate a solution for it. If we wouldn't do so, there were no way of knowing when to fall back to the next child as long as the stage can still compute on *any* copied solution.
Setting up a demo for
Fallbacks({CartesianPath,PTP,RRTConnect})
I found the logic did not work as expected yet.
- process last job spec as well
- ignore failures when looking for a solution
- add more debug output
4368c41 to
011e4be
Compare
Codecov Report
@@ Coverage Diff @@
## master #309 +/- ##
==========================================
+ Coverage 52.99% 54.59% +1.60%
==========================================
Files 102 102
Lines 7598 7832 +234
==========================================
+ Hits 4026 4275 +249
+ Misses 3572 3557 -15
Continue to review full report at Codecov.
|
Both, failed and pruned states might get re-enabled later! This also required rework (simplification) of the sorting function for pending pairs.
- Centrally distinguish between have owner() or not in InterfaceState::updatePriority() - Have a separate updateStatus() method to just update the pruning status - Split Interface::updatePriority() into a method taking the InterfaceState* and one taking an Interface::iterator (for efficiency) - Early return in container.cpp's updateStatePrios()
c88d353 to
29d1e44
Compare
- Switch directions: FORWARD <-> BACKWARD to make the function reusable for status propagation. - We need to ignore the source state when looking for opposite states of the target state. Thus add both, source and target state arguments.
|
Finally fixed #308. The culprit was that |
... to avoid explicit template initialization
a3ab8de to
1dda3d1
Compare
Reenabling pruned solution branchesWe need to distinguish the origin of a pruned branch:
Summarizing, I suggest the following
Before starting to implement this, it would be great to get some feedback, @v4hn. Next, I will look into #287. |
TODOs
|
... to better indicate that such a state can be immediately re-enabled.
- Drop variable current_external_state_ - Instead encode the info that the external state wasn't yet forwarded to any child via stage = children().cend() - If all children have exhausted their solutions for this state, it is removed from the pending list
Adapt test results FallbacksFixturePropagate.computeFirstSuccessfulStagePerSolutionOnly due to 2e63c15: The order of computations has changed, because we lock the processed state as soon as it is forwarded to the first fallback child. In this case, after processing GEN1 und FWD1 once, we have the two states with costs 2, 4 in the queue. The first one, i.e. with cost 2 is forwarded to the child FWD2, which fails. In the next cycle, although we have new states in the queue (1, 2, 3, 4), we stick with state "2" and forward it two FWD3, which adds costs 210, resulting in 212. With previous code, the Fallback container switched to state "1", forwarded to FWD2.
Logger config can be more easily handled via ROSCONSOLE_CONFIG_FILE.
- Enable moving/swapping of other container impls (e.g. Fallbacks) - Clarify (via move semantics) that content of source impl will be lost - Get rid of friend declarations
... as we are now missing the implementation for CONNECT interfaces
Further factorize and simplify FallbacksPrivate classes employing ideas from @v4hn. The key difference between the variants his how they advance to the next job. Thus, the only virtual method required is nextJob().
Just set a flag when we received a full solution
- printChildrenInterfaces(): fix/add usage - printPendingPairs(): full colorization according to status
Let's consider the following simple situation, where generators produce solutions in the given order. GEN 1 3 Fallbacks |X GEN 2 4 When passing state 4 to the Fallbacks' connector, it forms pending pairs with both 1 and 3. Thus, the container needs to check whether 1-4 or 3-4 was processed when receiving a success or failure, to correctly forward the failed one to the next child.
... factoring out functionality shared between FallbacksPrivateGenerator and FallbacksPrivatePropagator to switch to next child in nextJob().
rename method to emphasize that state updates are propagated to all children
Implement Fallbacks behavior for children of type Connecting. All other connect-like children are currently infeasible to handle, because we cannot forward a single job, i.e. a pair (from, to) to the next child, but only individual states. However, passing states, will cause creation of undesired state pairs as jobs in subsequent children.
|
I merged #311 here, resolving all conflicts. This finalizes this PR (and #311), proving that they nicely play together. |

Building on some new (failing) tests introduced by @JafarAbdi and @v4hn, this PR aims to improve (and eventually fix) pruning.
This follows these general ideas: