commit b36404eca17c5236565a7a7e57903d879508b444 Author: Anja Date: Sun Jun 21 14:09:59 2020 +0200 initial commit rules diff --git a/rules.pl b/rules.pl new file mode 100644 index 0000000..b7e0c00 --- /dev/null +++ b/rules.pl @@ -0,0 +1,30 @@ +schedule("BA1"). +schedule("BA2"). + +group("G1", 5). +group("G2", 3). +group("G3", 2). +group("G4", 1). + +rank("G1", "BA1", 2). +rank("G2", "BA1", 3). +rank("G3", "BA1", 1). +rank("G4", "BA1", 1). + +rank("G1", "BA2", 3). +rank("G2", "BA2", 2). +rank("G3", "BA2", 4). +rank("G4", "BA2", 4). + + +1 = {matching(G,S) : schedule(S)} :- group(G, _). + +count(Sum,S) :- Sum = #sum{ A,G : group(G,A), matching(G,S)}, schedule(S). +:- count(Sum, _), Sum > 6. + +penalty(P) :- P = #sum{ R,G,S : rank(G,S,R), matching(G,S)}. + +#minimize{ S : penalty(S)}. +#show matching/2. +#show count/2. +#show penalty/1. \ No newline at end of file