How to program a permutation combination function with filter for rules
Posted on 2009-05-02
I am working on a metal related software where in I have to programmatically make numerous metal alloy combination ; For example if there are 5 types of metals it will use combination function to make combination of metal ; suppose metals are X, Y,A,B, & Z then there combination could be XYABZ , ZABYX and so on& however there are some predefined rules set by users like X cannot go with B
Or Y cannot with Z and such combination will be removed programmatically
Has any one any idea as to how to approach this programmatically; should I use brute force of computer to make these combination and then filter them by Rules .. or is there any better efficient logic?