diff --git a/generate_rules.py b/generate_rules.py index c92602e..5a0bae4 100644 --- a/generate_rules.py +++ b/generate_rules.py @@ -221,8 +221,11 @@ for workgroup in workgroups: rules += f':- schedule({workgroup.id}, TIMESLOT, _), timeslot(TIMESLOT, ORDER, _, _, _), ORDER >= {first_timeslot}, ORDER <= {last_timeslot}.\n' rules += "pool_schedule(ROOM) :- schedule(_,_,ROOM), pool(ROOM).\n"\ - "poolpen(T) :- T = {pool_schedule(_)}.\n"\ - "#minimize { T : poolpen(T) }.\n" \ +"poolpen(T) :- T = {pool_schedule(_)}.\n"\ +"otherroomsametrack(AK1, AK2) :- ak(AK1,_, TRACK, _,_,_), schedule(AK1, _, ROOM1), ak(AK2,_, TRACK, _,_,_), schedule(AK2, _, ROOM2), ROOM1 != ROOM2.\n"\ +"otherroomsametrackpen(T) :- T = {otherroomsametrack(_, _)}.\n"\ +"finalpen(T) :- poolpen(P),otherroomsametrackpen(O), T = P+O.\n"\ +"#minimize { T : finalpen(T) }.\n"\ "#show schedule/3." ####################### @@ -238,6 +241,7 @@ process = ['clingo', output_file_name, '--outf=2'] # run subprocess, not sure, if busy-waiting.. completed_process = subprocess.run(process, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) + output = completed_process.stdout open('solver_output.json', 'w').write(output)