Re: [eclipse-clp-users] basic problem

From: Kish Shen <kisshen_at_...5...>
Date: Mon, 16 Feb 2009 17:54:25 +0000
Marcin Krol wrote:

> ..and I was under impression that I could use any predicate as bb_min's 
> Goal? How do I tell which predicate generates a search tree and which 
> does not?
> 

What bb_min/3 actually requires is that you bind Cost within Goal, and 
the search returns the best (minimal) value of Cost.

sum(X,S) will only instantiate S (your cost variable) if X is a ground 
list of numbers, which it isn't in your program, as you don't have 
anything that will instantiate the variables in X. If you call bb_min 
with X as a ground list of numbers, then bb_min/3 will succeed, but it
is not very interesting, as there is no real search at all (sum/2 
returns only a single answer).

What you need for a real search are goals which will produce choices (if 
you are unfamiliar with this, you should probably read any Prolog 
textbook), like labeling/1 (there is (normally) more than one way to 
label your variables) and member/2 (if you have more than one element in 
your list, then there is more than one member).

Cheers,

Kish

-- 
This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.
Received on Mon Feb 16 2009 - 17:54:51 CET

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST