def main():
    """ Runs independently from command line to test the GALE algorithm. """
    graphPerformance = False # Built in graphing ability, currently not functional, but mechanism is in place.
    trainData = "2_1000_0_1600_0_0_CV_0_Train.txt"
    testData = "2_1000_0_1600_0_0_CV_0_Test.txt"
    outProg = "GH_GALE_ProgressTrack"
    outPop = "GH_GALE_PopulationOut"
    bitLength = 1    # This implementation is not yet set up to handle other rule representations, or bit encoding lengths.
    CVpartitions = 10
    trackCycles = 1
    
    iterInput = '5.10.20'  
    xdim = 10
    ydim = 10
    dist = 2
    wild = 0.75
    prune = 1
    
    #Figure out the iteration stops for evaluation, and the max iterations.
    iterList = iterInput.split('.')
    for i in range(len(iterList)):
        iterList[i] = int(iterList[i])
    lastIter = iterList[len(iterList)-1]  

    #Sets up up algorithm to be run.
    GALEConstants.setConstants(prune, wild)
    e = GALE_Environment(trainData,testData,bitLength)
    sampleSize = e.getNrSamples()
    gale = GALE(e, outProg, outPop, bitLength, CVpartitions, graphPerformance, xdim, ydim, dist)
    
    #Set some GALE parameters.
    if trackCycles == 'Default':
        gale.setTrackingIterations(sampleSize)
    else:
        gale.setTrackingIterations(trackCycles) 
    gale.setNumberOfTrials(lastIter, iterList)  
    
    #Run the GALE Algorithm 
    gale.runGALE()
    11: Data Distribution - '0' or '1' or '2' or '3' = uniform, random, pyrimidal, random pyrimidal
    12: Pruning - '0' or '1'
    13: Wild frequency - 0.5, 0.75
"""
# *************************************************************************************************

graphPerformance = False # Built in graphing ability, currently not functional, but mechanism is in place. NOT MEANT TO BE USED ON CLUSTER.
numArgs = len(argv)
print "Arguments: " + str(numArgs)
if numArgs == 14:
    if argv[1] == 'gh': #Different rule representations could be programmed but have not been in this implementation.
        print ("Format Training data: "+argv[2]+"  using a "+argv[6]+" bit coding scheme.")
        
        #Sets up up algorithm to be run.
        GALEConstants.setConstants(int(argv[12]), float(argv[13]))
        e = GALE_Environment(str(argv[2]), str(argv[3]), int(argv[6]))
        sampleSize = e.getNrSamples()
        gale = GALE(e, argv[4], argv[5], int(argv[6]), int(argv[7]), graphPerformance, int(argv[10]), int(argv[10]), int(argv[11]))
        
        #Figure out the iteration stops for evaluation, and the max iterations.
        iterList = argv[9].split('.')
        for i in range(len(iterList)):
            iterList[i] = int(iterList[i])
        lastIter = iterList[len(iterList)-1]
        
        #Set some GALE parameters.
        if argv[9] == 'Default':
            gale.setTrackingIterations(sampleSize)
        else:
            gale.setTrackingIterations(int(argv[8]))   
        gale.setNumberOfTrials(lastIter, iterList)