Originally posted by: mremn
Dear forum,
I'm trying to write a knapsack constraint by using cp Optimizer. The program worked well for the problem with only one constraint. But when I tried to solve more than 2 constraints, it gave me a wrong result. Here is the log with some explanation for a small problem with 4 variables and 2 constraints:
1 is not in the domain of variable 0 //CPO tries to branch on variable 0 here
propagate constraint 1: variable 0 is processed (reduce 1 from variable 0)
remove 0 from variable 1
remove 0 from variable 2
remove 0 from variable 3
propagate constraint 2: variable 0 is processed (reduce 1 from variable 0)
//nothing here: constraint 2 cannot reduce any domain
propagate constraint 1: variable 1 is processed (reduce 0 from variable 1)
//nothing here
propagate constraint 2: variable 1 is processed (reduce 0 from variable 1)
//nothing here
Until here, the search is terminated, CPO returns a wrong solution without continuing to process variable 2 and 3. (the problem is in fact unfeasible). I tried both version of CPO 12.5.1 and 12.6, the phenomenon is still the same.
Could somebody explain me why this can happen?
Thank you very much for your help,
#CPOptimizer#DecisionOptimization