Completed the script with combinatorics, now it plots. Next step is to use it for minimization, should be possible with minimal changes.