Automatically re-weight scoring to add up to 1 internally.
This commit is contained in:
@@ -669,9 +669,6 @@ public sealed class Settings : Window, IDisposable
|
|||||||
|
|
||||||
using (var panel = ImRaii2.GroupPanel("Score Weights (Advanced)", -1, out _))
|
using (var panel = ImRaii2.GroupPanel("Score Weights (Advanced)", -1, out _))
|
||||||
{
|
{
|
||||||
ImGui.TextWrapped("All values should add up to 1.");
|
|
||||||
ImGuiHelpers.ScaledDummy(10);
|
|
||||||
|
|
||||||
DrawOption(
|
DrawOption(
|
||||||
"Progress",
|
"Progress",
|
||||||
"Amount of weight to give to the craft's progress.",
|
"Amount of weight to give to the craft's progress.",
|
||||||
@@ -722,26 +719,6 @@ public sealed class Settings : Window, IDisposable
|
|||||||
v => config = config with { ScoreSteps = v },
|
v => config = config with { ScoreSteps = v },
|
||||||
ref isDirty
|
ref isDirty
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ImGui.Button("Normalize Weights", OptionButtonSize))
|
|
||||||
{
|
|
||||||
var total = config.ScoreProgress +
|
|
||||||
config.ScoreQuality +
|
|
||||||
config.ScoreDurability +
|
|
||||||
config.ScoreCP +
|
|
||||||
config.ScoreSteps;
|
|
||||||
config = config with
|
|
||||||
{
|
|
||||||
ScoreProgress = config.ScoreProgress / total,
|
|
||||||
ScoreQuality = config.ScoreQuality / total,
|
|
||||||
ScoreDurability = config.ScoreDurability / total,
|
|
||||||
ScoreCP = config.ScoreCP / total,
|
|
||||||
ScoreSteps = config.ScoreSteps / total
|
|
||||||
};
|
|
||||||
isDirty = true;
|
|
||||||
}
|
|
||||||
if (ImGui.IsItemHovered())
|
|
||||||
ImGuiUtils.Tooltip("Normalize all weights to sum up to 1");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isDirty)
|
if (isDirty)
|
||||||
|
|||||||
+11
-5
@@ -32,11 +32,17 @@ public readonly record struct MCTSConfig
|
|||||||
MaxScoreWeightingConstant = config.MaxScoreWeightingConstant;
|
MaxScoreWeightingConstant = config.MaxScoreWeightingConstant;
|
||||||
ExplorationConstant = config.ExplorationConstant;
|
ExplorationConstant = config.ExplorationConstant;
|
||||||
|
|
||||||
ScoreProgress = config.ScoreProgress;
|
var total = config.ScoreProgress +
|
||||||
ScoreQuality = config.ScoreQuality;
|
config.ScoreQuality +
|
||||||
ScoreDurability = config.ScoreDurability;
|
config.ScoreDurability +
|
||||||
ScoreCP = config.ScoreCP;
|
config.ScoreCP +
|
||||||
ScoreSteps = config.ScoreSteps;
|
config.ScoreSteps;
|
||||||
|
|
||||||
|
ScoreProgress = config.ScoreProgress / total;
|
||||||
|
ScoreQuality = config.ScoreQuality / total;
|
||||||
|
ScoreDurability = config.ScoreDurability / total;
|
||||||
|
ScoreCP = config.ScoreCP / total;
|
||||||
|
ScoreSteps = config.ScoreSteps / total;
|
||||||
|
|
||||||
ActionPool = config.ActionPool;
|
ActionPool = config.ActionPool;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user