Hi, Did you try the nvalues constraint? It sounds that this will do the trick for you.
You might then be able to minimize/maximize based on the integer variable that nvalues uses for conting. I have to admit that I do not really understand what you mean by pruning: if you prune away solutions, this is just a bug in your model, isn't it? Best Christian -- Christian Schulte, www.ict.kth.se/~cschulte/ > -----Original Message----- > From: users-boun...@gecode.org [mailto:users-boun...@gecode.org] On > Behalf Of Tommaso Urli > Sent: Monday, April 29, 2013 9:10 PM > To: 'gecode user list' > Subject: [gecode-users] Reifying constraints without posting them > > Hello, > I'm trying to introduce the following constraint in my model: let x be a set of > variables (an IntVarArray) and y a proper subset (a slice) of them, I want to know > how many variables in y get values among a given set of values. Problem is: I > want to implement this as a "soft" > constraint, i.e. I want to minimize/maximize the number of times this condition > is satisfied, but without actually posting the constraint. > I have tried with reified membership constraints, but apart from reification > (that did exactly what I wanted it to do), they actually post propagators and thus > prune my search space. I have tried counting constraints as well, but none of > them matches the semantics I need, so I suspect that this kind of constraint > cannot simply be expressed, am I wrong? > > Thanks, > Tommaso > > _______________________________________________ > Gecode users mailing list > users@gecode.org > https://www.gecode.org/mailman/listinfo/gecode-users _______________________________________________ Gecode users mailing list users@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users