In Prolog, i have a simple list of twelve strings. I also have a list of rules that together assign a score to that list. So according to how those elements are placed in my list, they may or may not break a rule.
I need to find the permutation of that list that gives me the highest possible score. How can i do that?
Here is what i have:
compute(InitialSettings, NewSettings, NewSettingsScore):-
perm(InitialSettings, NewSettings),
check_bonds(NewSettings, NewSettings, -1, 0, NewSettingsScore).
I omitted the code inside check_bonds
because it's not relevant to the question and it would only make it more complicated. Basically i need to loop through all the permutations and find the one that has the highest NewSettingsScore
. Is there any way to do this? Thanks in advance!