code
stringlengths
3
6.57k
asp_file.write("% Define the fluents of the program. \n")
asp_file.write("status(-done)
asp_file.write("status(done)
asp_file.write("location(home)
asp_file.write("% location()
asp_file.write("% home is the ECU master directory on one machine in a given cluster. \n")
asp_file.write("% The machine which home is on is assumed to be directly connected to all other machines in the cluster. \n")
range(len(all_macs)
mac.replace(" ", "")
mac.lower()
asp_file.write("location("+mac+")
range(len(all_macs)
mac.replace(" ", "")
mac.lower()
asp_file.write("connection(home, "+mac+")
range(len(all_macs[i][2])
mac1.replace(" ", "")
mac1.lower()
asp_file.write("connection("+mac+", "+mac1+")
asp_file.write("holds(F,0)
init(F)
asp_file.write("#program step(t)
asp_file.write("{ move(X,Y,t)
task(X)
location(Y)
holds(on(X,M)
connection(M, Y)
asp_file.write("0{ turn(X,Y,t)
status(Y)
task(X)
holds(on(X,Z)
valid_on(X, Z)
asp_file.write(":- move(X,Y,t)
holds(on(X,Y1)
asp_file.write("% Programs can not be moved back into the home directory.\n")
asp_file.write(":- turn(X,Y,t)
holds(at(X,done)
asp_file.write("% Programs can not be executed if they are already complete.\n")
asp_file.write(":- turn(X,Y,t)
holds(on(X,M)
depends_on(X, X1)
holds(on(X1,M)
asp_file.write("moved(X,t)
move(X,Y,t)
asp_file.write("% moved()
moved()
asp_file.write("turned(X,t)
turn(X, Y, t)
asp_file.write("% turn()
turn()
asp_file.write("turned_at(X, M, t)
turned(X, t)
holds(on(X,M)
asp_file.write("% turned_at()
turned_at()
asp_file.write("turned_with_2(M, X, X1, Z, t)
turned(X,t)
holds(on(X,M)
thread_cost(X, C)
turned(X1,t)
holds(on(X1,M)
thread_cost(X1, C1)
asp_file.write("turned_with_3(M, X, X1, X2, Z, t)
turned(X,t)
holds(on(X,M)
thread_cost(X, C)
turned_with_2(M, X1, X2, C1, t)
asp_file.write("turned_with_4(M, X, X1, X2, X3, Z, t)
turned(X,t)
holds(on(X,M)
thread_cost(X, C)
turned_with_3(M, X1, X2, X3, C1, t)
asp_file.write(":- turned_with_2(M, X, X1, Z, t)
machine_threads(M, C)
asp_file.write(":- turned_with_3(M, X, X1, X2, Z, t)
machine_threads(M, C)
asp_file.write(":- turned_with_4(M, X, X1, X2, X3, Z, t)
machine_threads(M, C)
asp_file.write(":- turned(X,t)
holds(on(X,M)
thread_cost(X, C)
turned_with_4(M, X1, X2, X3, X4, C1, t)
asp_file.write("% These rules allow for up to 4 task to be ran in parrallel on any one machine at a time, \n")
asp_file.write("% if and only if the sum of the thread cost of said tasks does not add up to a number greater than \n")
asp_file.write("% the core count of said machine. \n")
asp_file.write(":- turned_at(X, M, t)
cuda_not_on(M)
cuda_needed(X)
asp_file.write(":- turned_at(X, M, t)
spacy_not_on(M)
spacy_needed(X)
asp_file.write(":- turned_at(X, M, t)
psutil_not_on(M)
psutil_needed(X)
asp_file.write(":- turned_at(X, M, t)
clingo_not_on(M)
clingo_needed(X)
asp_file.write("% This section will prevent a program which requires a given toolkit from being scheduled to run on a machine\n")
asp_file.write("% which does not have said toolkit.\n")
asp_file.write(":- move(X, Z, Y1)