You've solved the problem with an incorrect assumption. You have assumed that the ideal situation is to use all of the chips in your collection. A better solution is to ask, what is the most playable breakdown for the poker games I am playing. If I am playing 25c/50c no limit hold'em with 8 players... and a typical buy-in of $20 per player... as an experienced poker host at these limits, I maintain that the ideal breakdown is:
12x 25c
12x $1
1x $5
If you have a set with 100x of white, blue, red, green, etc... your total number of chips used for 8 players is:
96x white (25c)
96x blue ($1)
8x red ($5)
If players lose all of their chips... they can re-buy with $5 (red) chips and make change from the players that have all of the lower denomination chips.
What I have proposed above is a proper solution if you want to play poker.
Also an experienced poker player, and this is 100% correct.
Ideally you want to use common casino chip colors (though these are somewhat fungible) and just shift orders of magnitudes.
If 1BI is 20 bucks, you can make it equivalent to a $200 BI at the casino, which really only uses 2 colors 95% of the time: whites for 1 dollar, reds for $5. Deeper games might need a $25 (green) or even $100 (black chip). So whites in your home game are 10c, reds are 50c, greens are $2.50, blacks $10.
As someone who has run many, many home games, including cash and tournaments, also consider how easy it is to stack a fresh buy-in. Having 6 of one color, 5 of another, 3 of another, 8 of the next... Yuck. Many ways to make a mistake. If I'm doing a tournament where the starting small blind is 25, then I'm going to ALWAYS use:
8 qty 25 chips = 200
8 qty 100 chips = 800
4 qty 500 chips = 2000
N qty 1000 chips = N000, where N controls how much the starting stack is.
When I'm preparing a bunch of new stacks, I mostly just have to deal with stacks 4 or 8 high, which can be measured next to each other in under a second. Also, the first two colors add up to 1000 exactly, and the first three colors add up to 3000 exactly, simplifying the math. Also, standard chip racks hold stacks of 20 chips, so the first three colors can be pre-built and stored in the racks. If I'm doing a cash game, with $0.25/$0.50 blinds, I use the same formula as above, but divide by 100. Just as easy.
For a $1/$2 cash game, I'm going to ALWAYS use:
20 qty $1 chips = $20, for blinds
N qty $5 chips for the rest of the buy-in
And that's it. Since again, standard chip racks hold stacks of 20 chips, these can be set up in seconds. Later in the game, we can break out the $25 chips.
Also +1 to using "standard" casino chip colors. In the US, $1 is almost always white, $5 is almost always red, $25 is almost always green, $100 is almost always black, and so on. Don't confuse people.
Buy your chip set based on how you allocate your chips when playing, don't allocate your chips based on whatever chip set you happen to have.
I'm never going to have 500s and 1000s in the same chip set, but in that case you just fill it out with 500s and introduce a larger denomination chip if you're playing deep stacks.
Yea the "optimal" solution shown by the default input is pretty silly. You're giving everyone 5 chips with which they can post blinds, and they're going to use 3 of them per turn through the blinds, so after 1 turn through the blinds someone who has won no hands will need to make change with someone else. And making change from the next smallest denomination will require 5 of that persons small chips!
Other, less important usability consideration is that you would typically want "round" amounts of chips, ideally stacks of 10 or 20, though having a few big chips in odd amounts is fine. Not as big a deal, but again, very much diverging from typical poker ux expectations.
Neat project technically, but highly impractical for actually playing poker.
edit: to be fair, just saw the advanced options, which would allow it to produce a more useful result, so that's cool. maybe just update the defaults :)
This comment is correct. This seems like it might have been programmed by someone who has never played poker, or not in a home game. You don't want people to have 112 white chips, no matter how many are in the box.
Note that the players in the described game are buying in really short. A typical buy-in would normally be about 100BB, or $50. The easiest way to handle the extra $30 is with 6 $5 chips. If rebuys start running you low on $5s, you can introduce $25s.
I'm not very experienced at hosting, but this is pretty close to what I'd do. If chip supply isn't a constraint, I'll aim for halving the quantity each step up then redistribute from there, so 12x25c 7x$1 2x$5 in your example. If chips are limited, I go based on the ratios of available chips.
At first glance, seems like you could do this with linear programming instead of mixed-integer if you're ok shaving off the fractions at the end and handing them out naively. Nobody will mind getting 1-2 more chips than theoretically necessary.
> At first glance, seems like you could do this with linear programming instead of mixed-integer if you're ok shaving off the fractions at the end and handing them out naively. Nobody will mind getting 1-2 more chips than theoretically necessary.
You're almost certainly totally right for this problem, but in general that's one of the pitfalls in beginner mixed-integer programming implementations. Rounding a reasonable real-number solution has almost no guarantees in terms of approximate optimality or error bounds compared to the optimal integer solution.
If you have a set with 100x of white, blue, red, green, etc... your total number of chips used for 8 players is: 96x white (25c) 96x blue ($1) 8x red ($5)
If players lose all of their chips... they can re-buy with $5 (red) chips and make change from the players that have all of the lower denomination chips.
What I have proposed above is a proper solution if you want to play poker.