code done
 
Ok. I would say, we can call it the day. I tested and debugged the code. And now if you give it a list of parties, and the relative power that they should have, it can find reasonably good approximations of a parliament that satisfies it. In the limit of something which has no perfect solutions.