-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Matching algorithm stalled out #889
Labels
bug
Something isn't working
Comments
debugging
//callbacks.js
info(`dispatch: ${nPlayersInIntroSequence} in intro steps, ${availablePlayers.length} in lobby, ${nPlayersAssigned} in games`);
const assignments = dispatcher(availablePlayers);
// dispatch.js
function dispatch(availablePlayers) {
const startTime = new Date().getTime();
const nPlayersAvailable = availablePlayers.length;
// randomize the order in which we assign participants to remove bias due to arrival time
const playerIds = shuffle(availablePlayers.map((p) => p.id));
// check that playerIds are unique
if (new Set(playerIds).size !== playerIds.length) {
throw new Error("Duplicate playerIds in availablePlayers", playerIds);
// todo: should we just log this error, or should we actively fix it?
}
const maxPayoff = getUnconstrainedMaxPayoff(
persistentPayoffs,
nPlayersAvailable
);
const stoppingThreshold = maxPayoff * requiredFractionOfMaximumPayoff;
info(`Dispatch with ${nPlayersAvailable} players`);
function recurse({...}){...}
|
Turns out that the leftovers function is super inefficient: export function leftovers(target, factors) {
// Given an integer `target` and a list of integers `factors`,
// returns the smallest number needed to add to an arbitrary number of factors
// to sum to `target`.
// We use this to figure out how many participants we will not be able to assign
// to games of sizes in `factors`, even if we have optimum and unconstrained assignment.
let closest = target;
for (const factor of factors) {
if (factor === target) return 0;
}
for (const factor of factors) {
if (factor < target) {
const leftover = leftovers(target - factor, factors);
if (leftover < closest) {
closest = leftover;
}
}
}
return closest;
} It works fine when the number of factors are small, but it scales as something like In our case (12 players, 245 treatments) , it should have returned 0 within 6 iterations. Instead |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What happened?
The experiment stalled out at dispatch. we paid 14 people who didn't get to play.
We saw the initial message for the dispatcher, but it never completed:
What browsers do you see the problem on?
What operating system do you see the problem on?
How did we discover the bug?
Priority
Blocking all data collection
The text was updated successfully, but these errors were encountered: