Skip to content

Instantly share code, notes, and snippets.

@IgnoredAmbience
Created March 8, 2011 12:51
Show Gist options
  • Save IgnoredAmbience/860236 to your computer and use it in GitHub Desktop.
Save IgnoredAmbience/860236 to your computer and use it in GitHub Desktop.
Condor Stuff for Prolog AI Coursework
{
played[$1, $2] += $3
blue[$1, $2] += $4
red[$1, $2] += $5
draw[$1, $2] += $6
moves[$1, $2] += $7
if(mmin[$1,$2] == 0) mmin[$1,$2] = 999
mmin[$1, $2] = ($8 < mmin[$1, $2] ? $8 : mmin[$1, $2])
mmax[$1, $2] = ($9 > mmax[$1, $2] ? $9 : mmax[$1, $2])
time[$1, $2] += $10
}
END {
OFS = "\t"
print "Blue", "Red", "Played", "Blue won", "Red won", "Drawn", "Move min", "Move max", "Move avg", "Time total", "Time avg"
for (task in played) {
split(task, separate, SUBSEP)
b = separate[1]
r = separate[2]
print b, r, played[b,r], blue[b,r], red[b,r], draw[b,r], mmin[b,r], mmax[b,r], (moves[b,r]/played[b,r]), time[b,r], (time[b,r]/played[b,r])
}
}
# Runs many of your prolog game of life
# For best output, I'd recommend editing your prolog script to output a single row of csv, or similar
#
# Add $CONDOR_HOME/bin to your path.
# Change to the folder containing your .pl files.
# Add these predicates to your prolog to seed the random number generator:
# :- use_module(library(system)).
# :- now(Time), setrand(Time).
# Create directories of the form $(strat1)-$(strat2), for each of the test runs you want
# Edit this script to take account of the test runs you want (it re-substitutes at every queue command)
# Run `condor_submit condor.cmd`
# Wait for your email inbox to be spammed (I recommend setting up filters)
# Output files will be in the directories you created earlier, one for each job that was run.
# Aggregate the results with `awk -f aggregate.awk */*.out > results`
#
# condor_q from the same machine that condor_submit was run on will show you the progress
# condor_submit will show you the status of the cluster
universe = vanilla
Requirements = DoC_Package_Version_sicstus == "4.1.3"
executable = /usr/bin/sicstus-4.1.3
Initialdir = $(strat1)-$(strat2)
output = $(Process).out
error = $(Process).err
log = log
arguments = -l ../tw1509_wol.pl --noinfo --nologo --goal test_strategy(10,$(strat1),$(strat2)),halt.
strat1 = random
strat2 = minimax
queue 10
strat1 = bloodlust
queue 10
strat1 = self_preservation
queue 10
strat1 = land_grab
queue 10
strat1 = minimax
queue 10
strat2 = random
queue 10
strat2 = bloodlust
queue 10
strat2 = self_preservation
queue 10
strat2 = land_grab
queue 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment