Reputation: 1
Lets say I have 2 lists: list_1
and list_2
of the same size containing Bool variables
list_1 = [ model.NewBoolVar('var1'), ..., model.NewBoolVar('var9')]
list_2 = [ model.NewBoolVar('var10'), ..., model.NewBoolVar('var19') ]
I then add other constraints and I finally want to maximize so that to 2 lists should be the most alike. I have though of doing of sum of the XNor result between each elements of both lists but I do not know how to do this? What should I do?
Upvotes: 0
Views: 77
Reputation: 11064
You can use enforced linear constraints.
bi => xi == yi
bi.not() => xi != yi
Then sum of bi
Upvotes: 2