Nov-08-2020, 06:24 PM
Hello,
Let's say I have:
problem = Problem()
problem.addVariables(['a', 'b'], [1, 2, 3])
problem.addConstraint(AllDifferentConstraint())
problem.addConstraint(***Ignore Order***)
I want the solutions to be:
[{'a': 3, 'b': 2}, {'a': 3, 'b': 1}, {'a': 2, 'b': 1}]
Instead of:
[{'a': 3, 'b': 2}, {'a': 3, 'b': 1}, {'a': 2, 'b': 3}, {'a': 2, 'b': 1}, {'a': 1, 'b': 2}, {'a': 1, 'b': 3}]
So that, for example {'a': 3, 'b': 2} and {'a': 2, 'b': 3} would be considered the same solution and only one of those will appear in the solution set. How can I create a constraint like this?
Let's say I have:
problem = Problem()
problem.addVariables(['a', 'b'], [1, 2, 3])
problem.addConstraint(AllDifferentConstraint())
problem.addConstraint(***Ignore Order***)
I want the solutions to be:
[{'a': 3, 'b': 2}, {'a': 3, 'b': 1}, {'a': 2, 'b': 1}]
Instead of:
[{'a': 3, 'b': 2}, {'a': 3, 'b': 1}, {'a': 2, 'b': 3}, {'a': 2, 'b': 1}, {'a': 1, 'b': 2}, {'a': 1, 'b': 3}]
So that, for example {'a': 3, 'b': 2} and {'a': 2, 'b': 3} would be considered the same solution and only one of those will appear in the solution set. How can I create a constraint like this?