Skip to content

Conversation

@rmdmattingly
Copy link
Collaborator

Continuing to chain PRs here. I can ship this when #135 has been shipped

@rmdmattingly rmdmattingly requested a review from ndimiduk January 14, 2025 20:47
Comment on lines +421 to +430
float localSumMultiplier = 0; // in case sumMultiplier is not initialized
for (CostFunction c : costFunctions) {
if (!c.isNeeded()) {
LOG.trace("{} not needed", c.getClass().getSimpleName());
continue;
}
total += c.cost() * c.getMultiplier();
localSumMultiplier += c.getMultiplier();
}
sumMultiplier = localSumMultiplier;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a small change, but sumMultiplier is initialized in balanceTable, and needsBalance is both visible to the package, and could reasonably be called before balancing. We're iterating through cost functions anyway here, we might as well have a local copy of the total multiplier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants