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

From: Kish Shen <kisshen_at_...5...>
Date: Wed, 09 Jan 2008 23:07:03 +0000
Hi,

I am not sure I understand what you want correctly: in CLP, the `search' 
is the process of assigning values to all problem variables, resulting 
in a feasible solution, so the number of unassigned variables will 
always be zero if/when you have found a solution. Even for a MAX CSP 
problem, where you have `soft' constraints that can be violated, all the 
variables will still be assigned values. Am I missing something about 
your problem?

Which constraint solver are you using? It seems a little odd to use $=/2 
for your count_nonground predicate,
firstly this implies that count_nonground/2 should be a constraint for 
your solver (which you would probably have to implement yourself), and 
secondly, in the common solver interface we use, $=/2 accepts variables 
with real intervals (i.e. they can take on real (non-integeral) values), 
while the number of nonground variables must be an integer.

Cheers,

Kish

Stephen Flinter wrote:
> 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
>
> _______________________________________________
> ECLiPSe-Users mailing list
> ECLiPSe-Users@...2...
> http://www.crosscoreop.com/mailman/options/eclipse-users
>   
Received on Wed Jan 09 2008 - 23:07:33 CET

This archive was generated by hypermail 2.2.0 : Mon Jul 09 2018 - 02:05:29 CEST