Skip to content

Instantly share code, notes, and snippets.

@barelyknown
Created December 9, 2015 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barelyknown/9af5c766aaf7e8ba9895 to your computer and use it in GitHub Desktop.
Save barelyknown/9af5c766aaf7e8ba9895 to your computer and use it in GitHub Desktop.
optimize-roster-3.js
function setSolution(solution) {
// for each player
for (var row = 1; row <= PLAYERS.getNumRows(); row++) {
var playerId = PLAYERS.getCell(
row,
PLAYERS_PLAYER_COLUMN
).getValue();
// set the selected column based on the optimization solution
PLAYERS.getCell(
row,
PLAYERS_SELECTED_COLUMN
).setValue(
solution.getVariableValue(playerId)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment