From 18629edc0e37ea805a332a799b6619cfb5adf71f Mon Sep 17 00:00:00 2001 From: axiomlogicnexus Date: Tue, 28 Apr 2026 01:00:57 +0200 Subject: [PATCH] Persist deferred launch overflow history --- .../HyperTwistTrainingCoachLibrary.cpp | 4 ++ .../HyperTwistTrainingRepositoryLibrary.cpp | 38 +++++++++++++++++++ .../HyperTwistTrainingTypes.h | 9 +++++ 3 files changed, 51 insertions(+) diff --git a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingCoachLibrary.cpp b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingCoachLibrary.cpp index 4cf9d6d..89fef84 100644 --- a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingCoachLibrary.cpp +++ b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingCoachLibrary.cpp @@ -90,6 +90,10 @@ namespace HyperTwistTrainingCoachLibraryInternal { return TEXT("successful tightened-launch history"); } + if (SourceLabel == TEXT("recommendation-history-deferred-tightened-launch")) + { + return TEXT("successful deferred tightened-launch history"); + } return SourceLabel.IsEmpty() ? TEXT("none") : SourceLabel; } diff --git a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingRepositoryLibrary.cpp b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingRepositoryLibrary.cpp index 8afda40..da9cb26 100644 --- a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingRepositoryLibrary.cpp +++ b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingRepositoryLibrary.cpp @@ -5339,6 +5339,13 @@ FHyperTwistTrainingCoachMemorySnapshot UHyperTwistTrainingRepositoryLibrary::Der Snapshot.BroadenedLaunchBudgetHistoryCount = RecommendationHistory.BroadenedLaunchPlanCount; Snapshot.TightenedLaunchBudgetHistoryCount = RecommendationHistory.TightenedLaunchPlanCount; Snapshot.bHasRepeatRecommendationPressure = RecommendationHistory.bHasRepeatRecommendationPressure; + const int32 DeferredTightenedLaunchBias = FMath::Clamp( + RecommendationHistory.DeferredTightenedLaunchPlanCount, + 0, + 3 + ); + Snapshot.FollowUpGuidanceContinueBias += DeferredTightenedLaunchBias; + Snapshot.SuppressedPrimaryQueuePressureCount += DeferredTightenedLaunchBias; if (RecommendationHistory.BroadenedLaunchPlanCount >= 2 && RecommendationHistory.BroadenedLaunchAverageOutcomeScore >= RecommendationHistory.TightenedLaunchAverageOutcomeScore + 5.0f) @@ -5353,6 +5360,21 @@ FHyperTwistTrainingCoachMemorySnapshot UHyperTwistTrainingRepositoryLibrary::Der Snapshot.PreferredLaunchBudgetBias = -1; Snapshot.PreferredLaunchBudgetSourceLabel = TEXT("recommendation-history-tightened-launch"); } + if (RecommendationHistory.DeferredTightenedLaunchPlanCount >= 2 + && RecommendationHistory.DeferredTightenedLaunchAverageOutcomeScore + >= RecommendationHistory.TightenedLaunchAverageOutcomeScore - 3.0f) + { + Snapshot.PreferredLaunchBudgetBias = -1; + Snapshot.PreferredLaunchBudgetSourceLabel = + TEXT("recommendation-history-deferred-tightened-launch"); + if (Snapshot.PreferredGuidanceLane == EHyperTwistTrainingCoachGuidanceLane::Recommended + || Snapshot.PreferredGuidanceSourceLabel == TEXT("recommendation-history")) + { + Snapshot.PreferredGuidanceLane = EHyperTwistTrainingCoachGuidanceLane::FollowUp; + Snapshot.PreferredGuidanceSourceLabel = + TEXT("recommendation-history-deferred-tightened-launch"); + } + } if (!RecommendationHistory.FocusDeckId.IsEmpty() && (Snapshot.FocusDeckId.IsEmpty() @@ -8704,6 +8726,7 @@ FHyperTwistTrainingCoachRecommendationHistorySummary UHyperTwistTrainingReposito int32 PlannedLaunchSampleCount = 0; float BroadenedLaunchOutcomeAccumulator = 0.0f; float TightenedLaunchOutcomeAccumulator = 0.0f; + float DeferredTightenedLaunchOutcomeAccumulator = 0.0f; FString LatestPlanSortUtc; for (const FHyperTwistTrainingCoachActionPlan& Plan : UserPlans) @@ -8895,6 +8918,12 @@ FHyperTwistTrainingCoachRecommendationHistorySummary UHyperTwistTrainingReposito { Summary.TightenedLaunchPlanCount += 1; TightenedLaunchOutcomeAccumulator += OutcomeSummary.OutcomeScore; + if (OutcomeSummary.DeferredLaunchCaseIds.Num() > 0) + { + Summary.DeferredTightenedLaunchPlanCount += 1; + Summary.DeferredLaunchCaseCount += OutcomeSummary.DeferredLaunchCaseIds.Num(); + DeferredTightenedLaunchOutcomeAccumulator += OutcomeSummary.OutcomeScore; + } } } @@ -9003,6 +9032,12 @@ FHyperTwistTrainingCoachRecommendationHistorySummary UHyperTwistTrainingReposito Summary.TightenedLaunchAverageOutcomeScore = TightenedLaunchOutcomeAccumulator / static_cast(Summary.TightenedLaunchPlanCount); } + if (Summary.DeferredTightenedLaunchPlanCount > 0) + { + Summary.DeferredTightenedLaunchAverageOutcomeScore = + DeferredTightenedLaunchOutcomeAccumulator + / static_cast(Summary.DeferredTightenedLaunchPlanCount); + } Summary.bHasRepeatRecommendationPressure = Summary.RepeatRecommendationSequenceCount > 0 && (Summary.RecurringCaseCount > 0 @@ -9018,6 +9053,7 @@ FHyperTwistTrainingCoachRecommendationHistorySummary UHyperTwistTrainingReposito Summary.FollowUpLanePlanCount > 0 || Summary.FollowUpReadySequenceCount > 0 || Summary.EscalatedSequenceCount > 0 + || Summary.DeferredTightenedLaunchPlanCount > 0 || Summary.AverageFollowUpDepth >= 1.0f; const float RecommendedLaneScore = 1.0f @@ -9030,6 +9066,8 @@ FHyperTwistTrainingCoachRecommendationHistorySummary UHyperTwistTrainingReposito + static_cast(Summary.FollowUpLaneContinueBias) + static_cast(Summary.FollowUpReadySequenceCount) * 2.0f + static_cast(Summary.EscalatedSequenceCount) * 1.5f + + static_cast(Summary.DeferredTightenedLaunchPlanCount) * 1.5f + + FMath::Clamp(static_cast(Summary.DeferredLaunchCaseCount) * 0.25f, 0.0f, 4.0f) + Summary.AverageFollowUpDepth; Summary.PreferredGuidanceLane = bHasFollowUpLaneSignal && FollowUpLaneScore > RecommendedLaneScore diff --git a/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistTraining/HyperTwistTrainingTypes.h b/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistTraining/HyperTwistTrainingTypes.h index d7550db..050f80b 100644 --- a/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistTraining/HyperTwistTrainingTypes.h +++ b/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistTraining/HyperTwistTrainingTypes.h @@ -3909,6 +3909,12 @@ struct FHyperTwistTrainingCoachRecommendationHistorySummary UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") int32 TightenedLaunchPlanCount = 0; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + int32 DeferredTightenedLaunchPlanCount = 0; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + int32 DeferredLaunchCaseCount = 0; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") int32 RecurringCaseCount = 0; @@ -3933,6 +3939,9 @@ struct FHyperTwistTrainingCoachRecommendationHistorySummary UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") float TightenedLaunchAverageOutcomeScore = 0.0f; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + float DeferredTightenedLaunchAverageOutcomeScore = 0.0f; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") TArray RecurringCaseIds;