(no subject)

From: chegivara <chegivara_at_pobox.sk>
Date: Tue 22 Mar 2005 04:17:42 PM GMT
Message-Id: <200503221617.j2MGHgZP004379@www7.pobox.sk>
Hi all,
I handle with constraints logical programing.
If i use constraints, labeling and last one cost function, it find a 
solution (many solutions) with it's cost. But when I try to minimize 
solution it goes wrong (instantiation fault in *(-7, _288, H3) in 
module eclipse).Also when i use cost predicate before labeling.


i append a short program.

yours truly
        robert fedus

% Eclipse 5.8

:-lib(ic).
:-lib(branch_and_bound).
:-lib(ic_global).

solve :-
	TT = [3,-2,4,-7],
	length(List,4),
	List :: 1..10,
	constraints(List),
	
%	cost(TT,List,Value),
	
	labeling(List),
%	minimize(labeling(List),Value),

	cost(TT,List,Value),	
	
	writeln(List),
	writeln(Value).
	
constraints(List) :-
	append([A,B,C,D],[],List),
	A+B #= 3*_+1,
	C+D #= 4*_+2.
	
cost(TT,List,Value) :-
	cost1(TT,List,L),
	sumlist(L,Value).
	
cost1([],[],[]).
cost1([H1|TT],[H2|List],[H3|L]) :-
	cost1(TT,List,L),
	H3 is H1*H2.
____________________________________
Vsetko o SuperStar
http://superstar.atlas.sk

Received on Tue Mar 22 16:14:31 2005

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:34 PM GMT GMT