Example #1
0
def getSystem():

    en = encoder([],'weight')


    nums = ['MinIntensity','MaxIntensity','AvgIntensity','Red','Green','Blue']
    #nums +=['intensity_'+str(i)+'_'+str(j)    for i in range(width) for j in range(height)]
    #nums +=['colorR_'+str(i)+'_'+str(j)    for i in range(width) for j in range(height)]
    #nums +=['colorG_'+str(i)+'_'+str(j)    for i in range(width) for j in range(height)]
    #nums +=['colorB_'+str(i)+'_'+str(j)    for i in range(width) for j in range(height)] comment reason: this tree version has shown poor test results in performance per numStatement
    


    
    numparams= nums
    boolparams = []
    keyparams = list(en.boolNames)
    bit1 = Bitmap(width,height)
    for i in range(width):
        for j in range(height):
            bit1.SetPixel(i,j,Color.Black)

    bit2 = Bitmap(width,height)
    for i in range(width):
        for j in range(height):
            bit2.SetPixel(i,j,Color.White)
    slist = [sampleFromBitmap(bit2) for i in range(1)]
    for sample in slist: en.encode(sample,1)
    sadd = [sampleFromBitmap(bit1) for i in range(1)]
    for sample in sadd: en.encode(sample,1.1)
    slist += sadd   
    sys = system.system(keyparams,boolparams,numparams,slist,1500,100,7,majorant = True)
    sys.initialise()
    sys._injectedEncoder = en
    
    sys.setLogWriter(helpers.logWriter())


    #sys.compose()
    return sys
Example #2
0
state7 = statements.get_takeValue('L2')
state8 = statements.get_takeValue('L3')
state9 = statements.get_takeValue('L4')
boolStatements = [state2,state3,state4,state5]
numStatements = [state0,state1,state6,state7,state8,state9]

slist = [createSample(1) for i in range(1000)]
numparams= ['A','B','L1','L2','L3','L4']
boolparams = ['O','C1','C2','G']
keyparams = ['R','C']
                                  
t = time.time()
sys = system.system(keyparams,boolparams,numparams,slist,6000,300,15)
keyStates =sys.keyStatements

sysLog = helpers.logWriter()
sysDump = helpers.logWriter()

sys.setLogWriter(sysLog)
sys.setDumpWriter(sysDump)
def runSimulation(rounds = 100,tests = 500):
    print descr
    sys.initialise()
    sysLog.printToConsole()
    num = tests
    flog = open("lastLog.log",'w')
    fdump = open("lastDump.log",'w')
    effi = check(sys,keyStates,num)
    print 'initial efficiency',effi*100. /num,'%','\n\n\n\n'
    for ri in range(rounds):
        sysLog.writeLine( '\n\n\n\nround #',ri)