added constraint for tracks in same room, takes forever to run (not save for usage)

This commit is contained in:
Anja Reusch 2019-06-11 17:38:09 +02:00
parent ae6b2abf66
commit 3480569b67

View file

@ -222,7 +222,10 @@ for workgroup in workgroups:
rules += "pool_schedule(ROOM) :- schedule(_,_,ROOM), pool(ROOM).\n"\ rules += "pool_schedule(ROOM) :- schedule(_,_,ROOM), pool(ROOM).\n"\
"poolpen(T) :- T = {pool_schedule(_)}.\n"\ "poolpen(T) :- T = {pool_schedule(_)}.\n"\
"#minimize { T : poolpen(T) }.\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." "#show schedule/3."
####################### #######################
@ -238,6 +241,7 @@ process = ['clingo', output_file_name, '--outf=2']
# run subprocess, not sure, if busy-waiting.. # run subprocess, not sure, if busy-waiting..
completed_process = subprocess.run(process, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) completed_process = subprocess.run(process, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
output = completed_process.stdout output = completed_process.stdout
open('solver_output.json', 'w').write(output) open('solver_output.json', 'w').write(output)