-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate.py
More file actions
executable file
·66 lines (64 loc) · 4.81 KB
/
generate.py
File metadata and controls
executable file
·66 lines (64 loc) · 4.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# -*- coding: utf-8 -*-
import os, stat, glob
listType = ['grouprobin']
listFeature = ['f37,f38,f39,f40,f41,f42,f46,f47,f48']
listImpact = ['0']
listGroup = ['5']
listRound = ['5']
listBest = ['0.1']
listCollection = ['trec_adhoc_max','trec_adhoc_lee','trec_adhoc_discWidth']
listLife = ['0','40']
listNbFeats = ['8','48']
listStrategy = ['0','5']
nbExp = len(glob.glob('./Experiment*')) + 1
dirname = './Experiment'+str(nbExp)
os.mkdir(dirname)
mainscript_filename = dirname+'/osirim_battle_Exp'+str(nbExp)+'.sh'
with open(mainscript_filename,'w') as script_file:
os.chmod(mainscript_filename,stat.S_IRWXU|stat.S_IRGRP|stat.S_IXGRP|stat.S_IROTH)
for elCollection in listCollection:
for elImpact in listImpact:
for elStrategy in listStrategy:
for elLife in listLife:
for elNbFeats in listNbFeats:
for elFeature in listFeature:
for elType in listType:
if elType == 'grouprobin' or elType == 'groupswiss':
if elType == 'groupswiss':
for elRound in listRound:
for elGroup in listGroup:
for elBest in listBest:
sbatch_filename = 'osirim_battle-t:'+elType+'-r:'+elRound+'-b:'+elBest+'-c:'+elCollection+'-l:'+elLife+'-i:'+elImpact+'-g:'+elGroup+'-n:'+elNbFeats+'-s:'+elStrategy+'-d-f:'+elFeature+'.sh'
sbatch_fullfilename = dirname+'/'+sbatch_filename
with open(sbatch_fullfilename, 'w') as the_file:
os.chmod(sbatch_fullfilename,stat.S_IRWXU|stat.S_IRGRP|stat.S_IXGRP|stat.S_IROTH)
the_file.write("#!/bin/sh\n#SBATCH --job-name=battle_group\n#SBATCH --mail-type=ALL\n#SBATCH --mail-user=hubert@irit.fr\n#SBATCH --output=group.out\n#SBATCH --error=group.err\n#SBATCH -n 25\n#SBATCH -N 1\n")
the_file.write('srun -n 1 python /projets/sig/PROJET/PRINCESS/code/princess/princess.py -t '+elType+' -r '+elRound+' -b '+elBest+' -c '+elCollection+' -l '+elLife+' -i '+elImpact+' -g '+elGroup+' -n '+elNbFeats+' -s '+elStrategy+' -d -f '+elFeature+"\n")
script_file.write("sbatch "+sbatch_filename+"\n")
else:
for elGroup in listGroup:
for elBest in listBest:
sbatch_filename = 'osirim_battle-t:'+elType+'-b:'+elBest+'-c:'+elCollection+'-l:'+elLife+'-i:'+elImpact+'-g:'+elGroup+'-n:'+elNbFeats+'-s:'+elStrategy+'-d-f:'+elFeature+'.sh'
sbatch_fullfilename = dirname+'/'+sbatch_filename
with open(sbatch_fullfilename, 'w') as the_file:
os.chmod(sbatch_fullfilename,stat.S_IRWXU|stat.S_IRGRP|stat.S_IXGRP|stat.S_IROTH)
the_file.write("#!/bin/sh\n#SBATCH --job-name=battle_group\n#SBATCH --mail-type=ALL\n#SBATCH --mail-user=hubert@irit.fr\n#SBATCH --output=group.out\n#SBATCH --error=group.err\n#SBATCH -n 25\n#SBATCH -N 1\n")
the_file.write('srun -n 1 python /projets/sig/PROJET/PRINCESS/code/princess/princess.py -t '+elType+' -b '+elBest+' -c '+elCollection+' -l '+elLife+' -i '+elImpact+' -g '+elGroup+' -n '+elNbFeats+' -s '+elStrategy+' -d -f '+elFeature+"\n")
script_file.write("sbatch "+sbatch_filename+"\n")
elif elType == 'swiss':
for elRound in listRound:
sbatch_filename = 'osirim_battle-t:'+elType+'-r:'+elRound+'-c:'+elCollection+'-l:'+elLife+'-i:'+elImpact+'-n:'+elNbFeats+'-s:'+elStrategy+'-d-f:'+elFeature+'.sh'
sbatch_fullfilename = dirname+'/'+sbatch_filename
with open(sbatch_fullfilename, 'w') as the_file:
os.chmod(sbatch_fullfilename,stat.S_IRWXU|stat.S_IRGRP|stat.S_IXGRP|stat.S_IROTH)
the_file.write("#!/bin/sh\n#SBATCH --job-name=battle_group\n#SBATCH --mail-type=ALL\n#SBATCH --mail-user=hubert@irit.fr\n#SBATCH --output=group.out\n#SBATCH --error=group.err\n#SBATCH -n 25\n#SBATCH -N 1\n")
the_file.write("srun -n 1 python /projets/sig/PROJET/PRINCESS/code/princess/princess.py -t "+elType+" -r "+elRound+" -c "+elCollection+" -l "+elLife+" -i "+elImpact+" -n "+elNbFeats+" -s "+elStrategy+" -d -f "+elFeature)
script_file.write("sbatch "+sbatch_filename+"\n")
else:
sbatch_filename = 'osirim_battle-t:'+elType+'-c:'+elCollection+'-l:'+elLife+'-i:'+elImpact+'-n:'+elNbFeats+'-s:'+elStrategy+'-d-f:'+elFeature+'.sh'
sbatch_fullfilename = dirname+'/'+sbatch_filename
with open(sbatch_fullfilename, 'w') as the_file:
os.chmod(sbatch_fullfilename,stat.S_IRWXU|stat.S_IRGRP|stat.S_IXGRP|stat.S_IROTH)
the_file.write("#!/bin/sh\n#SBATCH --job-name=battle_group\n#SBATCH --mail-type=ALL\n#SBATCH --mail-user=hubert@irit.fr\n#SBATCH --output=group.out\n#SBATCH --error=group.err\n#SBATCH -n 25\n#SBATCH -N 1\n")
the_file.write("srun -n 1 python /projets/sig/PROJET/PRINCESS/code/princess/princess.py -t "+elType+" -c "+elCollection+" -l "+elLife+" -i "+elImpact+" -n "+elNbFeats+" -s "+elStrategy+" -d -f "+elFeature)
script_file.write("sbatch "+sbatch_filename+"\n")