Originally posted by: SystemAdmin
Thank you for your support. I confirm that my problem is a Constraint Satisfaction one (no objective), and before your reply I implemented a way to check if a solution found by cp.Next() was already found:
List<ISolution> solutions;
while(cp.Next())
{ ISolution newSolution = InitializeSolution();
// InitializeSolution() is implemented by creating a new ISolution with cp.Solution() and then adding each pair variable/value of the model via Add() and SetValue()
if(Contains(solutions, newSolution))
// Contains() is implemented by calling GetValue() on each solution of the List and on newSolution looking for a matches: two solutions are identical if each pair of variables is assigned to the same pair of values
continue;
// newSolution is a duplicate, and should be discarded
else solutions.add(solution)
// newSolution is not a duplicate, and should be kept
// Do other things here
}
By setting the DepthFirst search type, not only I noticed a downgrade in the performance (i.e., the search is slower), but still Next() finds duplicate solutions. I checked it by adding a breakpoint on the
continue instruction and verifying that indeed it was still executed many times, meaning that that solution found by cp.Next() was a duplicate.
What could be the reason for that? Could it be that I'm defining some search phases, interfering with the way Next() computes results, regardless of Depth First search? What could be a solution?
Regards,
Stefano
#DecisionOptimization#OPLusingCPOptimizer