[eclipse-clp-users] Repair library issue

From: Martin Michalowski <martin.michalowski_at_...341...>
Date: Fri, 31 Jan 2014 17:24:28 -0600
Hi,
I’m trying to get the repair library from the documentation to work.  The following is my ECLiPSe code:

:- lib(repair).

test(X,Y,Z) :-
	(
		Vars = [X,Y,Z],
		fd:(Vars :: 1..3),  % the problem variables
		fd:(Y #\= X) r_conflict_prop confset,  % state the constraints
		fd:(Y #\= Z) r_conflict_prop confset,
		fd:(Y #=  3) r_conflict_prop confset,
		[X,Y,Z] tent_set [1,2,3],              % set initial assignment

		repair(confset),
		writeln("------------\nDone\n------------")
	).
 
repair(ConflictSet) :-
    ( conflict_vars([C|_]) ->       % label conflict 
        indomain(C),                %  variables first
        repair(ConflictSet)
    ; conflict_constraints(ConflictSet, [C|_]) ->
        term_variables(C, Vars),    % choose one variable in
        deleteffc(Var,Vars, _),     %  the conflict constraint
        Var tent_get Val,
        (Var = Val ; fd:(Var #\= Val)),  
        repair(ConflictSet)
    ;      
    						        % no more conflicts:
        true                        % a solution is found.
    ).

The problem is that indomain throws a type error, even though it is being passed a variable returned by conflict_vars.  I get:

type error in indomain(Z{fd : [1, 2], repair : 3})
Abort

Any help would be greatly appreciated.

Thanks,
Martin
Received on Fri Jan 31 2014 - 23:43:46 CET

This archive was generated by hypermail 2.3.0 : Tue Apr 16 2024 - 09:13:20 CEST