def main():
    """ Runs independently from command line to test the GAssist 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_GAssist_ProgressTrack"
    outPop = "GH_GAssist_PopulationOut"
    bitLength = 1    # This implementation is not yet set up to handle other rule representations, or bit encoding lengths.
    CVpartitions = 10
    trackCycles = 1
    
    # Run Parameters - User specified.
    iterInput = '20.50.100' 
    pop = 100
    wild = 0.5
    defaultClass = "0"  #auto, 0, disabled   
    init = "cw"  #'none', 'smart', 'cw'
    MDL = 1
    windows = 2
    
    #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.
    e = GAssist_Environment(trainData,testData,bitLength, init) 
    cons.setConstants(pop, wild, defaultClass, e, MDL, windows) 
    sampleSize = e.getNrSamples()
    gassist = GAssist(e, outProg, outPop, bitLength, CVpartitions, graphPerformance) 
    
    #Set some GAssist parameters.
    if trackCycles == 'Default':
        gassist.setTrackingIterations(sampleSize)
    else:
        gassist.setTrackingIterations(trackCycles) 
    gassist.setNumberOfTrials(lastIter, iterList)  
    gassist.setInitialization(init)
    #Run the GAssist Algorithm 
    gassist.runGAssist()
    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.
        e = GAssist_Environment(str(argv[2]), str(argv[3]), int(argv[6]), str(argv[10]))
        cons.setConstants(int(argv[11]), float(argv[12]), str(argv[13]), e, str(argv[14]), str(argv[15])) 
        sampleSize = e.getNrSamples()
        gassist = GAssist(e, argv[4], argv[5], int(argv[6]), int(argv[7]), graphPerformance)
        
        #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 GAssist parameters.
        if argv[9] == 'Default':
            gassist.setTrackingIterations(sampleSize)
        else:
            gassist.setTrackingIterations(int(argv[8]))   
        gassist.setNumberOfTrials(lastIter, iterList)   
        gassist.setInitialization(str(argv[10])) #NEW - for intelligent initialization
        
        #Run the GAssist Algorithm 
        gassist.runGAssist()        
        
    else:
        print "There is no environment handling code for the specified environment"
else:
    print helpstr
    sys.exit()