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

From: Stephen Flinter <stephen_at_flinter.com>
Date: Thu, 10 Jan 2008 09:15:51 +0000
Kish,

thanks for the feedback.

I'm using the IC solver.  I should, of course, have written C #=
count_nongound(Xs).  Apologies for the error on my part.

The problem I'm considering has different numbers of constraints associated
with the different variables.  Hence, I'm interested in assigning values to
the maximum number of variables (all of whose assignments are valid), rather
than minimising the number of violated constraints.  Of course, these two
strategies may end up producing the same solution.

As an aside, are you aware of any max-csp implementations in eclipse?

Thanks,

Steve

On Jan 9, 2008 11:07 PM, Kish Shen <kisshen_at_cisco.com> wrote:

> 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_at_crosscoreop.com
> > http://www.crosscoreop.com/mailman/options/eclipse-users
> >
>
>
Received on Thu Jan 10 2008 - 09:15:59 CET

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