示例#1
0
def ZDTtest():
    z = ZDT4(5)
    hi = [1] + [5] * 4
    lo = [0] + [-5] * 4
    gengine = GALE(hi, lo, z.argD, z.objD, 50, z.getObj, z.vaildX, z.candidate)
    pdb.set_trace()
    out = gengine.gale()
    pdb.set_trace()
    print out
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()
    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)   
        
        #Run the GALE Algorithm 
示例#4
0
def schafferTest():
    s = Schaffer()
    gengine = GALE(s.hi, s.lo, s.argD, s.objD, 100, s.getObj, s.validX, s.candidate)
    #pdb.set_trace()
    out = gengine.gale()
    print out
示例#5
0
def squareTest():
    q = Square()
    gengine = GALE(q.hi, q.lo, q.argD, q.objD, 100, q.getObj, q.validX, q.candidate)
    out = gengine.gale()
    print out