'''
number of restarts   : 3
number of ants       : 20
converge threshold   : 0.0001
local optimization   : 21
evaporation rate     : 0.1
dampening            : 0.99
alpha                : 1.0
beta                 : 1.0
mode                 : both
optimize on          : touch
transmit threshold   : 0.000001
receive threshold    : 0.000001
k                    : 4
cpus                 : 4
lineGraph            : linegraph
permutes             : 1000
sim nodes            : 15
sim edges            : 15
sim degree power     : 6
timesteps            : 1000
disipate             : 0.1
full run             : fullrun
'''



def main():
    cpus = 4
    nodes = 40    
    for k in [2,3,4,5,6,7,8]:
        for i in xrange(3):
            print "K: " + str(k) + "   " + str(i)
            graphname = "bollobas200.txt"
            outname = "varyK_output_" + str(k) + "_" + str(i) + ".txt"
            configname = "varyK_config_"+ str(k) + "_" + str(i) + ".txt"
            printConfig(configname, k, 6, 60)
            theCmd = "ipython mipdao/pydev/main.py "+configname+ " " + graphname + " > " + outname
            os.system(theCmd)



def printConfig(filename, k, cpus, nodes):
    fout = open(filename,'w')
    steps = nodes * 2000
    fout.write("number of restarts   : 3\n")
    fout.write("number of ants       : 18\n")
    fout.write("converge threshold   : 0.0001\n")
    fout.write("local optimization   : 20\n")
    fout.write("evaporation rate     : 0.1\n")
    fout.write("dampening            : 0.99\n")
    fout.write("alpha                : 1.0\n")
    fout.write("beta                 : 1.0\n")
    fout.write("mode                 : both\n")
    fout.write("optimize on          : score\n")
    fout.write("transmit threshold   : 0.0001\n")
    fout.write("receive threshold    : 0.0001\n")
    fout.write("k                    : "+ str(k) + "\n")
    fout.write("cpus                 : "+str(cpus)+"\n")
    fout.write("lineGraph            : linegraph\n")
    fout.write("permutes             : 1000\n")
    fout.write("sim nodes            : "+str(nodes)+"\n")
    fout.write("sim edges            : 0\n")
    fout.write("sim degree power     : 0\n")
    fout.write("timesteps            : "+str(steps)+"\n")
    fout.write("dissipate             : 0.01\n")
    fout.write("full run             : fullrun\n")
    fout.write("store size         : 20\n")
    fout.close()



if __name__ == "__main__":
    import sys
    import os
    main()

@@ -635,35 +635,409 @@
     
-cpus = 4%0A    nodes = 40    
+try:%0A        opts, args = getopt.getopt(sys.argv%5B1:%5D, %22h%22, %5B%22help%22%5D)%0A    except getopt.error, msg:%0A        print msg%0A        print %22for help use --help%22%0A        sys.exit(2)%0A    # process options%0A    for o, a in opts:%0A        if o in (%22-h%22, %22--help%22):%0A            print __doc__%0A            sys.exit(0)%0A%0A    pathtomipdao = args%5B1%5D%0A    graphname = args%5B2%5D%0A    outputpath = args%5B3%5D%0A    cpus = int(args%5B4%5D)
 %0A   
@@ -1047,16 +1047,18 @@
 r k in %5B
+1,
 2,3,4,5,
@@ -1372,12 +1372,14 @@
  k, 
-6
+cpus
 , 
-6
 0)%0A 

test script varyK update