[eclipse-users] Count number of non-ground variables in a list

From: Stephen Flinter <stephen_at_flinter.com>
Date: Tue, 8 Jan 2008 23:43:05 +0000
Hi,

I'm looking for a way to count the number of non-ground variables in a  
list, such that I can use that value as a minimizing goal in the  
bb_min or minimize predicate.

i.e. something like:

constraints(Xs, C) :-
	(foreach(X, Xs) do
		%% apply constraint on X
	),

	C $= count_nonground(Xs).

....

solve(Xs) :-
	constraints(Xs, C),
	minimize(search(Xs), C).

That is, I'm looking to implement a Max-CSP type search, where I'm  
trying to minimize the number of unassigned variables.

Any ideas?

Thanks,

Steve
Received on Tue Jan 08 2008 - 23:43:15 CET

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET