[eclipse-clp-users] more doubts about sets....

From: Claudio Cesar de Sá <claudio_at_...222...>
Date: Tue, 8 May 2012 09:26:39 -0300
Dear Sirs..

The code below was working....
At moment, a error is given by:

calling an undefined procedure fd_sets : 364 #= _1063 + _1399 in module
eclipse

probably a error from this line:
    fd_sets:W3 #= W1+W2,


thanks in advance....


claudio



:-lib(fd_sets).

go :-
        Weights = [](61,66,63,69,4,90,11),
        model(Weights, Sets, Diff),
        minimize( label_sets(Sets), Diff ),
         %%% label_sets(Sets),
        writeln(sets=Sets; diff=Diff).

model(Weights, Sets, Diff) :-
        arity(Weights, N),
        N1 is N//2,
        N2 is N-N1,

        Sets = [L1,L2,L3],
        intsets(Sets, _, 1, N),   % shorthand for :: []..[1,2,...,N]

        #(L1, N1),
        #(L2, N2),
        #(L3, N),

        weight(L1, Weights, W1),
        weight(L2, Weights, W2),
        weight(L3, Weights, W3),

        fd_sets:W3 #= W1+W2,
        fd_sets:Diff #= abs(W1-W2),

        fd_sets:union(L1, L2, L3).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
label_sets([]).
    label_sets([S|Ss]) :-
    insetdomain(S,_,_,_),
    %%%Instantiate Set to a possible value
    label_sets(Ss).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-- 
claudio



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


**********************************************************************
Skype: claudio_cesar_sa
http://claudiocesar.wordpress.com/about/
***********************************************************************
Received on Tue May 08 2012 - 12:53:35 CEST

This archive was generated by hypermail 2.3.0 : Thu Feb 22 2024 - 18:13:20 CET