diff --git a/examples/car.lp b/examples/car.lp index 037b963..4290362 100644 --- a/examples/car.lp +++ b/examples/car.lp @@ -1,21 +1,21 @@ #const n = 8. time(0..n). step(I,I+1) :- time(I), I < n. -&fsum {s(I)+D} =: s(I') :- acc(D,I'), step(I,I'). -&fsum {s(I)-D} =: s(I') :- slow(D,I'), step(I,I'). +&sus {s(I)+D} =: s(I') :- acc(D,I'), step(I,I'). +&sus {s(I)-D} =: s(I') :- slow(D,I'), step(I,I'). -&fsum {s(I)} =: s(I') :- not &fsum{ s(I') } != s(I), step(I,I'). +&sus {s(I)} =: s(I') :- not &sus{ s(I') } != s(I), step(I,I'). -&fsum {p(I)+s(I)} =: p(I') :- step(I,I'). +&sus {p(I)+s(I)} =: p(I') :- step(I,I'). -&fsum {400000} =: rdpos. -&fsum {90000} =: rdlimit. % <<< ADDED <<< +&sus {400000} =: rdpos. +&sus {90000} =: rdlimit. % <<< ADDED <<< -fine(I') :- &fsum{ p(I) } < rdpos, &fsum{ p(I') } >= rdpos, step(I,I'), - &fsum{ s(I') } > rdlimit. +fine(I') :- &sus{ p(I) } < rdpos, &sus{ p(I') } >= rdpos, step(I,I'), + &sus{ s(I') } > rdlimit. -&fsum {0} =: p(0). -&fsum {80000} =: s(0). +&sus {0} =: p(0). +&sus {80000} =: s(0). acc(11350,4). slow(2301,6). diff --git a/examples/config_assignment.lp b/examples/config_assignment.lp new file mode 100644 index 0000000..6a91e9e --- /dev/null +++ b/examples/config_assignment.lp @@ -0,0 +1,10 @@ +price(standardframe,15). + + selected(standardframe). +{ selected(saddlebag) }. + +&sus{price(P)} = V :- selected(P), price(P,V). +&sus{price(P) : selected(P)} =: price(total). + +#show selected/1. +&show{price/1}. \ No newline at end of file diff --git a/examples/config_default.lp b/examples/config_default.lp new file mode 100644 index 0000000..d6fd8de --- /dev/null +++ b/examples/config_default.lp @@ -0,0 +1,11 @@ +price(standardframe,15). + + selected(standardframe). +{ selected(saddlebag) }. + +&sus{price(P)} = V :- selected(P), price(P,V). +&sus{price(P)} = 1 :- selected(P), not price(P,_). +&sus{price(P) : selected(P)} =: price(total). + +#show selected/1. +&show{price/1}. \ No newline at end of file diff --git a/examples/config_default_df.lp b/examples/config_default_df.lp new file mode 100644 index 0000000..783ef6b --- /dev/null +++ b/examples/config_default_df.lp @@ -0,0 +1,16 @@ +price(standardframe,15). + +default_price(20). + + selected(standardframe). +{ selected(saddlebag) }. + +&sus{price(P)} = V :- selected(P), price(P,V). +&sus{price(P) : selected(P)} =: calculated_price(total). + +&sus{price(total)} = calculated_price(total) :- &df{calculated_price(total)}. +&sus{price(total)} = D :- not &df{calculated_price(total)}, + default_price(D). + +#show selected/1. +&show{price/1}. \ No newline at end of file diff --git a/examples/config_default_in.lp b/examples/config_default_in.lp new file mode 100644 index 0000000..433d622 --- /dev/null +++ b/examples/config_default_in.lp @@ -0,0 +1,13 @@ +price(standardframe,15). +default_range(1,2). + + selected(standardframe). +{ selected(saddlebag) }. + +&sus{price(P)} = V :- selected(P), price(P,V). +&in{L..U} =: price(P) :- selected(P), not price(P,_), + default_range(L,U). +&sus{price(P) : selected(P)} =: price(total). + +#show selected/1. +&show{price/1}. \ No newline at end of file diff --git a/examples/config_optional.lp b/examples/config_optional.lp new file mode 100644 index 0000000..f3e2251 --- /dev/null +++ b/examples/config_optional.lp @@ -0,0 +1,10 @@ +price(standardframe,15). +price(saddlebag,5). + + selected(standardframe). +{ selected(saddlebag) }. + +&sus{price(P)} = V :- selected(P), price(P,V). + +#show selected/1. +&show{price/1}. \ No newline at end of file diff --git a/examples/config_pricelimit_choice.lp b/examples/config_pricelimit_choice.lp new file mode 100644 index 0000000..c6f98ce --- /dev/null +++ b/examples/config_pricelimit_choice.lp @@ -0,0 +1,16 @@ +part(sportsframe). price(sportsframe,15). type(sportsframe,frame). +part(standardframe). price(standardframe,14). type(standardframe,frame). +part(fancysaddle). price(fancysaddle,6). type(fancysaddle,saddle). +part(standardsaddle). price(standardsaddle,5). type(standardsaddle,saddle). + +&sum{price(P)} = V :- price(P,V). + +pricelimit(20). + +&sum{price(P) :: selected(P) : part(P)} <= X :- pricelimit(X). +:- selected(P), selected(P'), P= L, + pricelimit(L). + +#show selected/1. +&show{price/1}. \ No newline at end of file diff --git a/examples/config_pricelimit_sus.lp b/examples/config_pricelimit_sus.lp new file mode 100644 index 0000000..6a1f336 --- /dev/null +++ b/examples/config_pricelimit_sus.lp @@ -0,0 +1,13 @@ +price(standardframe,15). + +pricelimit(14). + + selected(standardframe). +{ selected(saddlebag) }. + +&sus{price(P)} = V :- selected(P), price(P,V). +:- &sus { price(P) : selected(P) } >= L, + pricelimit(L). + +#show selected/1. +&show{price/1}. \ No newline at end of file diff --git a/examples/fsD.lp b/examples/fsD.lp deleted file mode 100644 index 2e0ae61..0000000 --- a/examples/fsD.lp +++ /dev/null @@ -1,24 +0,0 @@ -% select a cycle -1 { cycle(T,U) : task(U), U != T } 1 :- task(T). -1 { cycle(T,U) : task(T), U != T } 1 :- task(U). - -% make sure the cycle is connected -reach(M) :- M = #min { T : task(T) }. -reach(U) :- reach(T), cycle(T,U). -:- task(T), not reach(T). - -% select a start point -1 { start(T) : task(T) } 1. - -% obtain an order -permutation(T,U) :- cycle(T,U), not start(U). - -% place tasks sequentially on machines -seq((T,M),(T,M+1),D) :- task(T), duration(T,M,D), machine(M+1). -seq((T1,M),(T2,M),D) :- permutation(T1,T2), duration(T1,M,D). - -&diff { T1-T2 } <= -D :- seq(T1,T2,D). -&diff { 0-(T,M) } <= 0 :- duration(T,M,D). -&diff { (T,M)-bound } <= -D :- duration(T,M,D). - -#show permutation/2. diff --git a/examples/fsE.lp b/examples/fsE.lp deleted file mode 100644 index 3baee37..0000000 --- a/examples/fsE.lp +++ /dev/null @@ -1,25 +0,0 @@ -% select a cycle - -1 { cycle(T,U) : task(U), U != T } 1 :- task(T). -1 { cycle(T,U) : task(T), U != T } 1 :- task(U). - -% make sure the cycle is connected -reach(M) :- M = #min { T : task(T) }. -reach(U) :- reach(T), cycle(T,U). -:- task(T), not reach(T). - -% select a start point -1 { start(T) : task(T) } 1. - -% obtain an order -permutation(T,U) :- cycle(T,U), not start(U). - -% place tasks sequentially on machines -seq((T,M),(T,M+1),D) :- task(T), duration(T,M,D), machine(M+1). -seq((T1,M),(T2,M),D) :- permutation(T1,T2), duration(T1,M,D). - -&sum { T2 - T1 } >= D :- seq(T1,T2,D). -&sum { (T,M) } >= 0 :- duration(T,M,D). -&sum { (T,M) } <= bound-D :- duration(T,M,D). - -#show permutation/2. diff --git a/examples/fsI.lp b/examples/fsI.lp deleted file mode 100644 index 5f30e62..0000000 --- a/examples/fsI.lp +++ /dev/null @@ -1,4 +0,0 @@ - machine(1). machine(2). -task(a). duration(a,1,3). duration(a,2,4). -task(b). duration(b,1,1). duration(b,2,6). -task(c). duration(c,1,5). duration(c,2,5). diff --git a/examples/fsO.lp b/examples/fsO.lp deleted file mode 100644 index e0c439a..0000000 --- a/examples/fsO.lp +++ /dev/null @@ -1,26 +0,0 @@ -% select a cycle - -1 { cycle(T,U) : task(U), U != T } 1 :- task(T). -1 { cycle(T,U) : task(T), U != T } 1 :- task(U). - -% make sure the cycle is connected -reach(M) :- M = #min { T : task(T) }. -reach(U) :- reach(T), cycle(T,U). -:- task(T), not reach(T). - -% select a start point -1 { start(T) : task(T) } 1. - -% obtain an order -permutation(T,U) :- cycle(T,U), not start(U). - -% place tasks sequentially on machines -seq((T,M),(T,M+1),D) :- task(T), duration(T,M,D), machine(M+1). -seq((T1,M),(T2,M),D) :- permutation(T1,T2), duration(T1,M,D). - -&sum { 1*T1 + -1*T2 } <= -D :- seq(T1,T2,D). -&sum { -1*(T,M) } <= 0 :- duration(T,M,D). -&sum { 1*(T,M) + -1*bound } <= -D :- duration(T,M,D). -&minimize { bound }. - -#show permutation/2. diff --git a/examples/golomb.lp b/examples/golomb.lp deleted file mode 100644 index 1ea4d9f..0000000 --- a/examples/golomb.lp +++ /dev/null @@ -1,8 +0,0 @@ -#const l = 35. -#const o = 8. -&dom { 1..l } = p(P) :- P=1..o. - -&sum { p(1) } = 1. -&sum { p(P) } < p(P+1) :- P=1..o-1. - -&distinct{ p(Q) - p(P) : P < Q, P=1..o-1, Q=P+1..o }. diff --git a/examples/money.lp b/examples/money.lp deleted file mode 100644 index 0c3a260..0000000 --- a/examples/money.lp +++ /dev/null @@ -1,12 +0,0 @@ -letter(s;e;n;d;m;o;r;y). - -&dom {0..9} = X :- letter(X). - -&sum { 1000*s + 100*e + 10*n + 1*d - ; 1000*m + 100*o + 10*r + 1*e - } = 10000*m + 1000*o + 100*n + 10*e + 1*y. -&sum { m } != 0. - -&distinct {X : letter(X)}. - -&show {X : letter(X)}. diff --git a/examples/move.lp b/examples/move.lp deleted file mode 100644 index 2cf8f15..0000000 --- a/examples/move.lp +++ /dev/null @@ -1,24 +0,0 @@ -#const end=20. -#const stepsize=7. -step(0..end). - -% domain knowledge -&dom { 0..T*stepsize } = at(T) :- step(T). - -% initial state -&sum {at(0)} = 0. - -% actions -{move(T)} :- step(T); T > 0. - -% effects -&sum {at(T-1); stepsize} = at(T) :- move(T). - -% frame axiom -&sum {at(T-1)} = at(T) :- not move(T); step(T); step(T-1). - -% goals -:- &sum {at(end)} <= 100. - -%&show {at(X):step(X)}. -#show move/1. diff --git a/examples/queens.lp b/examples/queens.lp deleted file mode 100644 index d62ff6f..0000000 --- a/examples/queens.lp +++ /dev/null @@ -1,9 +0,0 @@ -#const n = 10. - -p(1..n). - -&dom { 1..n } = q(N) :- p(N). - -&distinct { q(N)+0 : p(N) }. -&distinct { q(N)-N : p(N) }. -&distinct { q(N)+N : p(N) }. diff --git a/examples/simple.lp b/examples/simple.lp deleted file mode 100644 index 0fc485f..0000000 --- a/examples/simple.lp +++ /dev/null @@ -1,2 +0,0 @@ -&fsum{x}=1 :- &fsum{ 1 : a }>= 0. -a :- &fsum{x}=1. diff --git a/examples/taxes.lp b/examples/taxes.lp index af9ba40..2279618 100644 --- a/examples/taxes.lp +++ b/examples/taxes.lp @@ -12,17 +12,17 @@ deduction(mary, 10000, 10001). 1 { lives(P,R) : region(R) } 1 :- person(P). -&fsum{ 0 } =: deduction(P) :- person(P), not deduction(P,_,_). -&fin{ L..H } =: deduction(P) :- deduction(P,L,H). -&fsum{ T } =: rate(P) :- lives(P,R), income(P,I), +&sus{ 0 } =: deduction(P) :- person(P), not deduction(P,_,_). +&in{ L..H } =: deduction(P) :- deduction(P,L,H). +&sus{ T } =: rate(P) :- lives(P,R), income(P,I), T = #max{ T' : rate(R,L,T'), I>=L}. -&fsum{ I*rate(P)-100*deduction(P) } =: 100*tax(P) :- income(P,I). -&fsum{ tax(P) : lives(P,R) } =: total(R) :- region(R). -&fmin{ tax(P) : person(P) } =: min. -&fmax{ tax(P) : person(P) } =: max. -min_taxes(P) :- &fmin{ tax(P') : person(P') } = tax(P), person(P). -max_taxes(P) :- &fmax{ tax(P') : person(P') } = tax(P), person(P). +&sus{ I*rate(P)-100*deduction(P) } =: 100*tax(P) :- income(P,I). +&sus{ tax(P) : lives(P,R) } =: total(R) :- region(R). +&min{ tax(P) : person(P) } =: min. +&max{ tax(P) : person(P) } =: max. +min_taxes(P) :- &min{ tax(P') : person(P') } = tax(P), person(P). +max_taxes(P) :- &max{ tax(P') : person(P') } = tax(P), person(P). #show lives/2. #show min_taxes/1. diff --git a/examples/tests.lp b/examples/tests.lp deleted file mode 100644 index 6736c4b..0000000 --- a/examples/tests.lp +++ /dev/null @@ -1,98 +0,0 @@ -%* -% Standard GZ unsat -&sus{x}=1 :- &sus{ 1 : a }>= 0. -a :- &sus{x}=1. - - - -% TODO: Weird conditional minimum body example (1 or no stable models?) -&sus{x} = 1. -a :- &min{3; x:a} > 2. - - -#show a/0. -*% - -% Assignment fact -&sus{1} =: x. -&sus{z} =: y. - -%* -% Conditional assignment fact - -{a}. -&sus{z : a; 1} =: x. -&sus{x} =: y. - -#show __def/1. - -% Assignment head, body check -{a}. -&sus{1} =: x :- a. -b :- &sus{x} > 0. - -% In assignment -&in{0..2} =: x. - -% In assignment, vars undef -&in{y..z} =: x. - -% In assignment, vars def, unsat - -&sus{z} = 1. -&sus{y} = 2. -&in{y..z} =: x. - -% In assignment, vars def, sat -&sus{z} = 2. -&sus{y} = 1. -&in{y..z} =: x. - -% In assignment, vars def conditional, sat -{a}. -&sus{z} = 2 :- a. -&sus{y} = 1. -&in{y..z} =: x. - -% Conditional linear constraint, head -{a}. -&sus{1:a} = x. - -% Conditional linear constraint, body -{a}. -&sus{1} = x. -b :- &sus{1:a} < x. - -% Minimum assignment fact -&min{3;2;1}=:x. - -% Minimum body -&sus{x} = 1. -a :- &min{3;x} < 2. - -% Conditional minimum assignment fact -{a}. -&min{3;2;1:a}=:x. - -% Conditional minimum body -{b}. -&sus{x} = 1. -a :- &min{3; x:b} < 2. - -% Maximum assignment fact -&max{3;2;1}=:x. - -% Maximum body -&sus{x} = 3. -a :- &max{1;x} > 2. - -% Conditional maximum assignment fact -{a}. -&max{3;2;4:a}=:x. - -% Conditional maximum body -{b}. -&sus{x} = 2. -a :- &max{1; x:b} <= 1. - -*% diff --git a/examples/vicious_cycle.lp b/examples/vicious_cycle.lp new file mode 100644 index 0000000..f173e2a --- /dev/null +++ b/examples/vicious_cycle.lp @@ -0,0 +1,2 @@ +&sus{x}=1 :- &sus{ 1 : a }>= 0. +a :- &sus{x}=1.