Spaces:
Running
Running
Commit ·
e58b5ec
1
Parent(s): ef0556b
fix: clamp scores after rounding and ensure all sub-scores are clamped
Browse files96 unmodified lines97989910010110210315 unmodified lines11912012112212312412525 unmodified lines15115215315415515615715815952 unmodified lines21221321421521621721821922022122222322496 unmodified linesgrade.Score = math.Max(0, grade.Score-grade.PenaltyApplied)}grade.Score = clampOpenInterval(math.Round(grade.Score*10000) / 10000) // 4 decimal placesreturn grade}15 unmodified linescostScore = math.Max(0, 1.0-ratio)}grade.SubScores["cost"] = clampOpenInterval(math.Min(1.0, costScore))grade.Score = grade.SubScores["cost"]grade.Details["agent_cost"] = agentCostgrade.Details["baseline_cost"] = baselineCost25 unmodified linesconstraintScore = float64(withinBounds) / float64(totalSteps)}grade.SubScores["cost"] = costScoregrade.SubScores["temperature"] = clampOpenInterval(constraintScore)grade.Score = clampOpenInterval(costScore*0.6 + constraintScore*0.4)grade.Details["within_bounds_steps"] = withinBoundsgrade.Details["total_steps"] = totalStepsreturn grade52 unmodified linescarbonScore = math.Max(0, 1.0-agentCarbon/baselineCarbon)}grade.SubScores["cost"] = costScoregrade.SubScores["temperature"] = tempScoregrade.SubScores["grid_response"] = clampOpenInterval(gridScore)grade.SubScores["batch_deadline"] = clampOpenInterval(batchScore)grade.SubScores["carbon"] = clampOpenInterval(math.Min(1.0, carbonScore))grade.Score = clampOpenInterval(costScore*0.28 + tempScore*0.20 + gridScore*0.20 + batchScore*0.12 + carbonScore*0.20)grade.Details["grid_stress_steps"] = gridStressStepsgrade.Details["grid_response_steps"] = gridResponseSteps96 unmodified lines97989910010110210310410510610710810915 unmodified lines12512612712812913013113213325 unmodified lines15916016116216316416516616716816952 unmodified lines22222322422522622722822923023123223323423523696 unmodified linesgrade.Score = math.Max(0, grade.Score-grade.PenaltyApplied)}// Clamp AFTER rounding to ensure boundary values are handledgrade.Score = clampOpenInterval(math.Round(grade.Score*10000) / 10000) // 4 decimal places// Also ensure all sub-scores are properly clamped after roundingfor key, val := range grade.SubScores {grade.SubScores[key] = clampOpenInterval(math.Round(val*10000) / 10000)}return grade}15 unmodified linescostScore = math.Max(0, 1.0-ratio)}// Clamp after min operationclamped := clampOpenInterval(math.Min(1.0, costScore))grade.SubScores["cost"] = clampOpenInterval(math.Round(clamped*10000) / 10000)grade.Score = grade.SubScores["cost"]grade.Details["agent_cost"] = agentCostgrade.Details["baseline_cost"] = baselineCost25 unmodified linesconstraintScore = float64(withinBounds) / float64(totalSteps)}// Clamp sub-scores and final score after roundinggrade.SubScores["cost"] = clampOpenInterval(math.Round(costScore*10000) / 10000)grade.SubScores["temperature"] = clampOpenInterval(math.Round(constraintScore*10000) / 10000)finalScore := costScore*0.6 + constraintScore*0.4grade.Score = clampOpenInterval(math.Round(finalScore*10000) / 10000)grade.Details["within_bounds_steps"] = withinBoundsgrade.Details["total_steps"] = totalStepsreturn grade52 unmodified linescarbonScore = math.Max(0, 1.0-agentCarbon/baselineCarbon)}// Clamp all sub-scores after roundinggrade.SubScores["cost"] = clampOpenInterval(math.Round(costScore*10000) / 10000)grade.SubScores["temperature"] = clampOpenInterval(math.Round(tempScore*10000) / 10000)grade.SubScores["grid_response"] = clampOpenInterval(math.Round(gridScore*10000) / 10000)grade.SubScores["batch_deadline"] = clampOpenInterval(math.Round(batchScore*10000) / 10000)grade.SubScores["carbon"] = clampOpenInterval(math.Round(math.Min(1.0, carbonScore)*10000) / 10000)finalScore := costScore*0.28 + tempScore*0.20 + gridScore*0.20 + batchScore*0.12 + carbonScore*0.20grade.Score = clampOpenInterval(math.Round(finalScore*10000) / 10000)grade.Details["grid_stress_steps"] = gridStressStepsgrade.Details["grid_response_steps"] = gridResponseSteps
env/tasks.go+22-10