[eclipse-clp-users] Repair library issue: follow-up

From: Martin Michalowski <martin.michalowski_at_adventiumlabs.com>
Date: Fri, 31 Jan 2014 19:06:53 -0600
As a follow-up to the email below, switching to ic fixed the issue.

Martin

_______________

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 Sat Feb 01 2014 - 01:06:01 CET

This archive was generated by hypermail 2.2.0 : Mon Feb 03 2014 - 18:13:18 CET