From b601d9595ea954f76cc0f876e11884608a5596a6 Mon Sep 17 00:00:00 2001 From: axiomlogicnexus Date: Wed, 29 Apr 2026 04:57:05 +0200 Subject: [PATCH] Shape handoff plans by drill recovery memory --- .../HyperTwistTrainingRepositoryLibrary.cpp | 135 ++++++++++++++++-- 1 file changed, 125 insertions(+), 10 deletions(-) diff --git a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingRepositoryLibrary.cpp b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingRepositoryLibrary.cpp index 632b35c..1fac8cf 100644 --- a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingRepositoryLibrary.cpp +++ b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingRepositoryLibrary.cpp @@ -140,11 +140,20 @@ namespace HyperTwistTrainingRepositoryLibraryInternal return EHyperTwistTrainingCoachHandoffKind::None; } + enum class EMethodDrillRecoveryMemoryBias : uint8 + { + None, + Strong, + Weak + }; + FString CoachMemoryDashboardSourceLabel( const EHyperTwistTrainingCoachHandoffKind HandoffKind, const bool bDeferredOverflowDriven, const bool bDeferredFirstDriven = false, - const bool bMethodDrillDriven = false + const bool bMethodDrillDriven = false, + const EMethodDrillRecoveryMemoryBias MethodDrillRecoveryMemoryBias = + EMethodDrillRecoveryMemoryBias::None ) { switch (HandoffKind) @@ -152,6 +161,16 @@ namespace HyperTwistTrainingRepositoryLibraryInternal case EHyperTwistTrainingCoachHandoffKind::Queue: if (bMethodDrillDriven) { + if (MethodDrillRecoveryMemoryBias + == EMethodDrillRecoveryMemoryBias::Strong) + { + return TEXT("coach-memory-dashboard-method-drill-recovery-strong-queued"); + } + if (MethodDrillRecoveryMemoryBias + == EMethodDrillRecoveryMemoryBias::Weak) + { + return TEXT("coach-memory-dashboard-method-drill-recovery-weak-queued"); + } return TEXT("coach-memory-dashboard-method-drill-queued"); } if (bDeferredFirstDriven) @@ -164,6 +183,16 @@ namespace HyperTwistTrainingRepositoryLibraryInternal case EHyperTwistTrainingCoachHandoffKind::FollowUp: if (bMethodDrillDriven) { + if (MethodDrillRecoveryMemoryBias + == EMethodDrillRecoveryMemoryBias::Strong) + { + return TEXT("coach-memory-dashboard-method-drill-recovery-strong-follow-up"); + } + if (MethodDrillRecoveryMemoryBias + == EMethodDrillRecoveryMemoryBias::Weak) + { + return TEXT("coach-memory-dashboard-method-drill-recovery-weak-follow-up"); + } return TEXT("coach-memory-dashboard-method-drill-follow-up"); } if (bDeferredFirstDriven) @@ -176,6 +205,16 @@ namespace HyperTwistTrainingRepositoryLibraryInternal case EHyperTwistTrainingCoachHandoffKind::Recommended: if (bMethodDrillDriven) { + if (MethodDrillRecoveryMemoryBias + == EMethodDrillRecoveryMemoryBias::Strong) + { + return TEXT("coach-memory-dashboard-method-drill-recovery-strong-recommended"); + } + if (MethodDrillRecoveryMemoryBias + == EMethodDrillRecoveryMemoryBias::Weak) + { + return TEXT("coach-memory-dashboard-method-drill-recovery-weak-recommended"); + } return TEXT("coach-memory-dashboard-method-drill-recommended"); } if (bDeferredFirstDriven) @@ -630,35 +669,53 @@ namespace HyperTwistTrainingRepositoryLibraryInternal if (ExplicitQueuedHandoffSignal >= ExplicitFollowUpHandoffSignal && ExplicitQueuedHandoffSignal >= ExplicitRecommendedHandoffSignal) { + const EMethodDrillRecoveryMemoryBias MethodDrillRecoveryMemoryBias = + ExplicitMethodDrillQueuedHandoffSignal > 0 + && RetainedMethodDrillRecoveryLaunchBias > 0 + ? EMethodDrillRecoveryMemoryBias::Strong + : EMethodDrillRecoveryMemoryBias::None; Snapshot.PreferredCoachHandoffKind = EHyperTwistTrainingCoachHandoffKind::Queue; Snapshot.PreferredCoachHandoffSourceLabel = HyperTwistTrainingRepositoryLibraryInternal::CoachMemoryDashboardSourceLabel( EHyperTwistTrainingCoachHandoffKind::Queue, ExplicitDeferredOverflowQueuedHandoffSignal > 0, ExplicitDeferredFirstQueuedHandoffSignal > 0, - ExplicitMethodDrillQueuedHandoffSignal > 0 + ExplicitMethodDrillQueuedHandoffSignal > 0, + MethodDrillRecoveryMemoryBias ); } else if (ExplicitFollowUpHandoffSignal >= ExplicitRecommendedHandoffSignal) { + const EMethodDrillRecoveryMemoryBias MethodDrillRecoveryMemoryBias = + ExplicitMethodDrillFollowUpHandoffSignal > 0 + && RetainedMethodDrillRecoveryLaunchBias > 0 + ? EMethodDrillRecoveryMemoryBias::Strong + : EMethodDrillRecoveryMemoryBias::None; Snapshot.PreferredCoachHandoffKind = EHyperTwistTrainingCoachHandoffKind::FollowUp; Snapshot.PreferredCoachHandoffSourceLabel = HyperTwistTrainingRepositoryLibraryInternal::CoachMemoryDashboardSourceLabel( EHyperTwistTrainingCoachHandoffKind::FollowUp, ExplicitDeferredOverflowFollowUpHandoffSignal > 0, ExplicitDeferredFirstFollowUpHandoffSignal > 0, - ExplicitMethodDrillFollowUpHandoffSignal > 0 + ExplicitMethodDrillFollowUpHandoffSignal > 0, + MethodDrillRecoveryMemoryBias ); } else { + const EMethodDrillRecoveryMemoryBias MethodDrillRecoveryMemoryBias = + ExplicitMethodDrillRecommendedHandoffSignal > 0 + && RetainedMethodDrillRecoveryPromoteBias > 0 + ? EMethodDrillRecoveryMemoryBias::Weak + : EMethodDrillRecoveryMemoryBias::None; Snapshot.PreferredCoachHandoffKind = EHyperTwistTrainingCoachHandoffKind::Recommended; Snapshot.PreferredCoachHandoffSourceLabel = HyperTwistTrainingRepositoryLibraryInternal::CoachMemoryDashboardSourceLabel( EHyperTwistTrainingCoachHandoffKind::Recommended, ExplicitDeferredOverflowRecommendedHandoffSignal > 0, ExplicitDeferredFirstRecommendedHandoffSignal > 0, - ExplicitMethodDrillRecommendedHandoffSignal > 0 + ExplicitMethodDrillRecommendedHandoffSignal > 0, + MethodDrillRecoveryMemoryBias ); } } @@ -882,11 +939,21 @@ namespace HyperTwistTrainingRepositoryLibraryInternal HyperTwistTrainingRepositoryLibraryInternal::IsDeferredOverflowDashboardHandoffSource( CoachMemorySnapshot.PreferredCoachHandoffSourceLabel ); + const bool bStrongMethodDrillRecoveryMemoryHandoffSource = + CoachMemorySnapshot.PreferredCoachHandoffSourceLabel.StartsWith( + TEXT("coach-memory-dashboard-method-drill-recovery-strong-")) + || CoachMemorySnapshot.PreferredQueueRecoveryActionSourceLabel + == TEXT("coach-memory-method-drill-recovery-memory-strong"); + const bool bWeakMethodDrillRecoveryMemoryHandoffSource = + CoachMemorySnapshot.PreferredCoachHandoffSourceLabel.StartsWith( + TEXT("coach-memory-dashboard-method-drill-recovery-weak-")) + || CoachMemorySnapshot.PreferredQueueRecoveryActionSourceLabel + == TEXT("coach-memory-method-drill-recovery-memory-weak"); if (CoachMemorySnapshot.PreferredCoachHandoffKind == EHyperTwistTrainingCoachHandoffKind::Queue && !CoachBrief.bNeedsCoachReview && CoachBrief.FollowUpDepth <= 0) { - if (bDeferredOverflowHandoffSource) + if (bDeferredOverflowHandoffSource || bStrongMethodDrillRecoveryMemoryHandoffSource) { if (CoachBrief.bPreferRecognitionReplayReview && CoachMemorySnapshot.DominantCoachSuggestedMode @@ -934,7 +1001,8 @@ namespace HyperTwistTrainingRepositoryLibraryInternal CoachBrief.FollowUpDepth > 0 || CoachBrief.bNeedsCoachReview || CoachMemorySnapshot.FollowUpReadyCoachSequenceCount > 0 - || CoachMemorySnapshot.ScheduleBlockedFollowUpEventCount > 0; + || CoachMemorySnapshot.ScheduleBlockedFollowUpEventCount > 0 + || bStrongMethodDrillRecoveryMemoryHandoffSource; if (bShouldBiasFollowUpHandoff) { if (CoachBrief.bPreferRecognitionReplayReview @@ -952,7 +1020,8 @@ namespace HyperTwistTrainingRepositoryLibraryInternal { InOutSelectionPolicy = EHyperTwistTrainingSelectionPolicy::Scripted; } - if (bDeferredOverflowHandoffSource && InOutSelectionPolicy != EHyperTwistTrainingSelectionPolicy::Scripted) + if ((bDeferredOverflowHandoffSource || bStrongMethodDrillRecoveryMemoryHandoffSource) + && InOutSelectionPolicy != EHyperTwistTrainingSelectionPolicy::Scripted) { InOutSelectionPolicy = EHyperTwistTrainingSelectionPolicy::Scripted; } @@ -984,6 +1053,31 @@ namespace HyperTwistTrainingRepositoryLibraryInternal } return; } + if (bWeakMethodDrillRecoveryMemoryHandoffSource) + { + if (CoachBrief.bPreferRecognitionReplayReview + && CoachMemorySnapshot.DominantCoachSuggestedMode + == EHyperTwistTrainingDeliveryMode::RecognitionAssisted) + { + InOutMode = EHyperTwistTrainingDeliveryMode::RecognitionAssisted; + } + else if (InOutMode == EHyperTwistTrainingDeliveryMode::CoachReviewed + && CoachMemorySnapshot.DominantCoachSuggestedMode + != EHyperTwistTrainingDeliveryMode::CoachReviewed) + { + InOutMode = CoachMemorySnapshot.DominantCoachSuggestedMode; + } + + if (InOutSelectionPolicy == EHyperTwistTrainingSelectionPolicy::Scripted) + { + InOutSelectionPolicy = + CoachMemorySnapshot.DominantCoachSelectionPolicy + != EHyperTwistTrainingSelectionPolicy::Scripted + ? CoachMemorySnapshot.DominantCoachSelectionPolicy + : EHyperTwistTrainingSelectionPolicy::Weighted; + } + return; + } if (CoachBrief.bPreferRecognitionReplayReview && CoachMemorySnapshot.DominantCoachSuggestedMode == EHyperTwistTrainingDeliveryMode::RecognitionAssisted) @@ -6734,35 +6828,56 @@ FHyperTwistTrainingCoachMemorySnapshot UHyperTwistTrainingRepositoryLibrary::Der if (ExplicitQueuedHandoffSignal >= ExplicitFollowUpHandoffSignal && ExplicitQueuedHandoffSignal >= ExplicitRecommendedHandoffSignal) { + const HyperTwistTrainingRepositoryLibraryInternal::EMethodDrillRecoveryMemoryBias + MethodDrillRecoveryMemoryBias = + ExplicitMethodDrillQueuedHandoffSignal > 0 + && RetainedMethodDrillRecoveryLaunchBias > 0 + ? HyperTwistTrainingRepositoryLibraryInternal::EMethodDrillRecoveryMemoryBias::Strong + : HyperTwistTrainingRepositoryLibraryInternal::EMethodDrillRecoveryMemoryBias::None; Snapshot.PreferredCoachHandoffKind = EHyperTwistTrainingCoachHandoffKind::Queue; Snapshot.PreferredCoachHandoffSourceLabel = HyperTwistTrainingRepositoryLibraryInternal::CoachMemoryDashboardSourceLabel( EHyperTwistTrainingCoachHandoffKind::Queue, ExplicitDeferredOverflowQueuedHandoffSignal > 0, ExplicitDeferredFirstQueuedHandoffSignal > 0, - ExplicitMethodDrillQueuedHandoffSignal > 0 + ExplicitMethodDrillQueuedHandoffSignal > 0, + MethodDrillRecoveryMemoryBias ); } else if (ExplicitFollowUpHandoffSignal >= ExplicitRecommendedHandoffSignal) { + const HyperTwistTrainingRepositoryLibraryInternal::EMethodDrillRecoveryMemoryBias + MethodDrillRecoveryMemoryBias = + ExplicitMethodDrillFollowUpHandoffSignal > 0 + && RetainedMethodDrillRecoveryLaunchBias > 0 + ? HyperTwistTrainingRepositoryLibraryInternal::EMethodDrillRecoveryMemoryBias::Strong + : HyperTwistTrainingRepositoryLibraryInternal::EMethodDrillRecoveryMemoryBias::None; Snapshot.PreferredCoachHandoffKind = EHyperTwistTrainingCoachHandoffKind::FollowUp; Snapshot.PreferredCoachHandoffSourceLabel = HyperTwistTrainingRepositoryLibraryInternal::CoachMemoryDashboardSourceLabel( EHyperTwistTrainingCoachHandoffKind::FollowUp, ExplicitDeferredOverflowFollowUpHandoffSignal > 0, ExplicitDeferredFirstFollowUpHandoffSignal > 0, - ExplicitMethodDrillFollowUpHandoffSignal > 0 + ExplicitMethodDrillFollowUpHandoffSignal > 0, + MethodDrillRecoveryMemoryBias ); } else { + const HyperTwistTrainingRepositoryLibraryInternal::EMethodDrillRecoveryMemoryBias + MethodDrillRecoveryMemoryBias = + ExplicitMethodDrillRecommendedHandoffSignal > 0 + && RetainedMethodDrillRecoveryPromoteBias > 0 + ? HyperTwistTrainingRepositoryLibraryInternal::EMethodDrillRecoveryMemoryBias::Weak + : HyperTwistTrainingRepositoryLibraryInternal::EMethodDrillRecoveryMemoryBias::None; Snapshot.PreferredCoachHandoffKind = EHyperTwistTrainingCoachHandoffKind::Recommended; Snapshot.PreferredCoachHandoffSourceLabel = HyperTwistTrainingRepositoryLibraryInternal::CoachMemoryDashboardSourceLabel( EHyperTwistTrainingCoachHandoffKind::Recommended, ExplicitDeferredOverflowRecommendedHandoffSignal > 0, ExplicitDeferredFirstRecommendedHandoffSignal > 0, - ExplicitMethodDrillRecommendedHandoffSignal > 0 + ExplicitMethodDrillRecommendedHandoffSignal > 0, + MethodDrillRecoveryMemoryBias ); } }