This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/CHR/chr/examples/modelgenerator.pl

37 lines
681 B
Perl
Raw Normal View History

:- use_module(library(chr)).
handler modelgenerator.
constraints attends/3, requires/2, less/2, leq/2.
operator(700,xfx,less).
operator(700,xfx,leq).
X less Y <=> nonvar(X), nonvar(Y) | X < Y.
X less Y \ X less Z <=> Y =< Z | true.
X less Y, X leq Y <=> false.
X leq X <=> true.
attends(S, Y, TY), requires(Y, X) ==> attends(S, X, TX), TX less TY.
attends(john,C,T) ==> true | (T leq 1996 ; T less 1994).
example :-
attends(john,constraintprogrammierung,1996),
requires(constraintprogrammierung,logik).
/*
?- example.
requires(constraintprogrammierung,logik),
_A less 1994,
attends(john,constraintprogrammierung,1996),
attends(john,logik,_A) ?
*/