% actions and steps #const numSteps = 2. #const maxTime = 60. a(make_coffee;make_toast). step(1..numSteps). % exactly one action occurs at step S 1 {occurs(A,S) : a(A)} 1 :- step(S). % the same action does not occur twice :- occurs(A,S), occurs(A,T), T != S. %domain for all csp variables $domain(0..maxTime). %step S starts before step S+1 start(S) $< start(S+1) :- step(S), step(S+1). % making coffee takes 3 to 5 minutes end(S)-start(S) $>= 3 :- occurs(make_coffee,S). % :- occurs(make_coffee,S), end(S)-start(S) $< 3. end(S)-start(S) $<= 5 :- occurs(make_coffee,S). % :- occurs(make_coffee,S), end(S)-start(S) $> 5. % making toast takes 2 to 4 minutes end(S)-start(S) $>= 2 :- occurs(make_toast,S). % :- occurs(make_toast,S), end(S)-start(S) $< 2. end(S)-start(S) $<= 4 :- occurs(make_toast,S). % :- occurs(make_toast,S), end(S)-start(S) $> 4. % toast and coffee shall be ready within 2 minutes of each other abs(end(S)-end(T)) $<= 2 :- occurs(make_coffee,S), occurs(make_toast,T).