Bias queue ordering by recovery action

This commit is contained in:
axiomlogicnexus 2026-04-27 19:11:55 +02:00
parent 42a4f48198
commit 13f598d0bf

View file

@ -131,6 +131,62 @@ namespace HyperTwistTrainingCoachLibraryInternal
return 0.0f;
}
float ResolvePreferredRecoveryActionQueueBias(
const FString& SourceLabel,
const FHyperTwistTrainingCoachMemorySnapshot& CoachMemorySnapshot,
const bool bHasCompetingGuidanceEntry,
const bool bHasArchiveEntry)
{
if (!CoachMemorySnapshot.bNeedsScheduleFrictionRecovery
|| CoachMemorySnapshot.PreferredQueueRecoveryAction == EHyperTwistTrainingQueueRecoveryAction::None)
{
return 0.0f;
}
const EHyperTwistTrainingCoachGuidanceLane EntryLane = GuidanceLaneFromSourceLabel(SourceLabel);
const bool bMatchesPreferredLane =
EntryLane != EHyperTwistTrainingCoachGuidanceLane::None
&& EntryLane == CoachMemorySnapshot.PreferredGuidanceLane;
if (CoachMemorySnapshot.PreferredQueueRecoveryAction
== EHyperTwistTrainingQueueRecoveryAction::PromoteDeferred)
{
if (bMatchesPreferredLane)
{
return 5.0f;
}
if (SourceLabel == TEXT("archive-policy") && bHasArchiveEntry)
{
return -2.5f;
}
if (bHasCompetingGuidanceEntry && EntryLane != EHyperTwistTrainingCoachGuidanceLane::None)
{
return -2.0f;
}
return 0.0f;
}
if (CoachMemorySnapshot.PreferredQueueRecoveryAction
== EHyperTwistTrainingQueueRecoveryAction::LaunchRecovery)
{
if (bMatchesPreferredLane)
{
return 2.5f;
}
if (SourceLabel == TEXT("archive-policy") && bHasArchiveEntry && bHasCompetingGuidanceEntry)
{
return -1.5f;
}
if (bHasCompetingGuidanceEntry && EntryLane != EHyperTwistTrainingCoachGuidanceLane::None)
{
return -0.75f;
}
}
return 0.0f;
}
float ResolvePreferredGuidanceSignalBias(
const EHyperTwistTrainingCoachGuidanceLane SignalLane,
const FHyperTwistTrainingCoachMemorySnapshot& CoachMemorySnapshot,
@ -1021,8 +1077,15 @@ FHyperTwistCoachSessionQueueSummary UHyperTwistTrainingCoachLibrary::DeriveCoach
bHasFollowUpEntry,
bHasArchiveEntry
);
const float RecoveryActionBias =
HyperTwistTrainingCoachLibraryInternal::ResolvePreferredRecoveryActionQueueBias(
SourceLabel,
CoachMemorySnapshot,
bHasCompetingGuidanceEntry,
bHasArchiveEntry
);
Entry.PriorityScore = FMath::Clamp(
Entry.PriorityScore + GuidanceBias + ArchiveCompetitionBias,
Entry.PriorityScore + GuidanceBias + ArchiveCompetitionBias + RecoveryActionBias,
0.0f,
100.0f
);