Great info, thanks guys!
Yep I remember the knapsack problem from back in the day. Looks like there are some implementations here:
http://rosettacode.org/wiki/Knapsack_problem/0-1Gavin, your naive implementation seems like a great start. I was a little confused why you used num confirmations * amount as the priority, but after reading this (technical info at the bottom) it makes more sense:
https://en.bitcoin.it/wiki/Transaction_feesAnd yes, at this point I'm optimizing for ease of implementation.
I'm slowly understanding more of it, thanks guys!