[eclipse-clp-users] The "labeling" works but the "search" predicate no....

From: Claudio Cesar de Sá <claudio.sa_at_udesc.br>
Date: Sun, 22 Sep 2013 11:36:20 -0300
Dear Sirs

In my small example, it's works fine with "labeling" but
not with "search" predicate.
The error message is about undefined predicate.

Is it missing some library?
Is the labeling predicate a "search" specified with first-fail and indomain?


Thanks in advance


claudio


%%%%  3-CNF SATISFATIBILITY

:-lib(fd).
%:- use_module(library(fd)). OR


go :- model(L),
      busca(L),
      print_list_by_array(L),
      fail. %% for ALL SOLUTIONS
go. %% finish with true

%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Model
model(Vars):-
Vars=[A,B,C,D],
Vars #:: [0..1],
(#\+A #\/  #\+ B  #\/ #\+C ) , %% (not A or not B or not C) AND (.....) AND
....
    (A #\/ #\+B #\/   #\+D) ,
    (B #\/ C #\/  D) ,
    (#\+ B #\/  #\+C #\/ D)
     . %% END DA 3-CNF

%%% OR-EXCLUSIVE
model2(Vars):-
Vars=[A,B],
Vars #:: [0..1],
(A  #\/   B) , %%
    #\+( A #/\ B).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Explore
busca(L_Search) :-
    labeling(L_Search).
%% search(L_Search, 0 , occurrence,  indomain_min,complete, [] ).
%%  Why the  search does not works?

%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Print out
print_list_by_array(L_all):-
   nl,
%% writeln( l_all  : L_all),
   list2array(L_all, Vetor),
    dim(Vetor,[L]),
(for( I , 1 , L ),
 param( Vetor  )
 do
       (
     XX_truque is Vetor[I],
     printf(" Vetor[%d]: %d " , [I, XX_truque])
        )
      ).


%%%%%%%%%%%%%%%%%%%%%%%%%%%%% AUXs
list2array(L,A) :-
                length(L, Size),
                dim(A,[Size]),
                (foreacharg(X,A),
        foreach(X,L) do true).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% AUXs

-- 

Obrigado

claudio
    (
    ))
   |""|-.
   |__|-'


**********************************************************************
http://claudiocesar.wordpress.com/about/
***********************************************************************
Received on Sun Sep 22 2013 - 15:04:00 CEST

This archive was generated by hypermail 2.2.0 : Mon Sep 23 2013 - 06:13:25 CEST