Exemple #1
0
def run():

    global em
    global counter
    global trades_per_interval
    global mHappens

    mHappens = []

    #run param space
    if run_space == True:
        runParameterSpace()
        return

    #reset counter
    counter = 0

    #reset trades
    trades_per_interval = []

    #na = c.numOfAgents, ng = c.numOfGoods, nr = c.numofRounds, ss = c.sampleSize
    numGoods = int(slist[0].var.get())
    numTrials = int(slist[1].var.get())
    memory = int(slist[2].var.get())
    alpha = (slist[3].var.get() / 100.0)
    maxCost = (slist[4].var.get() / 100.0)

    em = EmergingMoney(numGoods, numTrials, memory, alpha, maxCost)
    #set if real time true
    if realTime == True or graphOverTime == True:
        em.register(callback)

    em.playGame()
    visualize()

    goods = em.get_goods_money()
    list_goods = goods[1]
    print list_goods
Exemple #2
0
def run():

    global em
    global counter
    global trades_per_interval
    global mHappens

    mHappens = []

    # run param space
    if run_space == True:
        runParameterSpace()
        return

    # reset counter
    counter = 0

    # reset trades
    trades_per_interval = []

    # na = c.numOfAgents, ng = c.numOfGoods, nr = c.numofRounds, ss = c.sampleSize
    numGoods = int(slist[0].var.get())
    numTrials = int(slist[1].var.get())
    memory = int(slist[2].var.get())
    alpha = slist[3].var.get() / 100.0
    maxCost = slist[4].var.get() / 100.0

    em = EmergingMoney(numGoods, numTrials, memory, alpha, maxCost)
    # set if real time true
    if realTime == True or graphOverTime == True:
        em.register(callback)

    em.playGame()
    visualize()

    goods = em.get_goods_money()
    list_goods = goods[1]
    print list_goods
Exemple #3
0
def runParameterSpace():

    global em

    numGoods = int(slist[0].var.get())
    numTrials = int(slist[1].var.get())
    memory = int(slist[2].var.get())
    alpha = (slist[3].var.get() / 100.0)
    maxCost = (slist[4].var.get() / 100.0)

    #incrementing values
    increment = 10

    print "theshold", money_threshold, "memory, alpha, maxcost (s)"

    for i in range(0, 100, increment):
        for j in range(0, 100, increment):
            em = EmergingMoney(numGoods, numTrials, i, (j * .010), maxCost)
            em.register(regcb)
            moneyHappens = -1
            em.playGame()
            visualize()
            print i, j * .010, maxCost, moneyHappens

    print "memory, alpha, maxcost (s)"

    for i in range(0, 100, increment):
        for j in range(0, 100, increment):
            em = EmergingMoney(numGoods, numTrials, j, (i * .010), maxCost)
            em.register(regcb)
            moneyHappens = -1
            em.playGame()
            visualize()

            print j, i * .010, maxCost, moneyHappens

    print "memory (s), alpha, maxcost"

    for i in range(0, 100, increment):
        for j in range(0, 100, increment):
            em = EmergingMoney(numGoods, numTrials, memory, (i * .010),
                               (j * .010))
            em.register(regcb)
            moneyHappens = -1
            em.playGame()
            visualize()

            print memory, (i * .010), (j * .010), moneyHappens

    print "memory (s), alpha, maxcost"

    for i in range(0, 100, increment):
        for j in range(0, 100, increment):
            em = EmergingMoney(numGoods, numTrials, memory, (j * .010),
                               (i * .010))
            em.register(regcb)
            moneyHappens = -1
            em.playGame()
            visualize()
            print memory, (j * .010), (i * .010), moneyHappens

    print "memory , alpha(s), maxcost"

    for i in range(0, 100, increment):
        for j in range(0, 100, increment):
            em = EmergingMoney(numGoods, numTrials, i, alpha, (j * .010))
            em.register(regcb)
            moneyHappens = -1
            em.playGame()
            visualize()

            print i, alpha, (j * .010), moneyHappens

    print "memory , alpha(s), maxcost"

    for i in range(0, 100, increment):
        for j in range(0, 100, increment):
            em = EmergingMoney(numGoods, numTrials, j, alpha, i * .010)
            em.register(regcb)
            moneyHappens = -1
            em.playGame()
            visualize()
            print j, alpha, i * .010, moneyHappens

    print "done"
Exemple #4
0
def runParameterSpace():

    global em

    numGoods = int(slist[0].var.get())
    numTrials = int(slist[1].var.get())
    memory = int(slist[2].var.get())
    alpha = slist[3].var.get() / 100.0
    maxCost = slist[4].var.get() / 100.0

    # incrementing values
    increment = 10

    print "theshold", money_threshold, "memory, alpha, maxcost (s)"

    for i in range(0, 100, increment):
        for j in range(0, 100, increment):
            em = EmergingMoney(numGoods, numTrials, i, (j * 0.010), maxCost)
            em.register(regcb)
            moneyHappens = -1
            em.playGame()
            visualize()
            print i, j * 0.010, maxCost, moneyHappens

    print "memory, alpha, maxcost (s)"

    for i in range(0, 100, increment):
        for j in range(0, 100, increment):
            em = EmergingMoney(numGoods, numTrials, j, (i * 0.010), maxCost)
            em.register(regcb)
            moneyHappens = -1
            em.playGame()
            visualize()

            print j, i * 0.010, maxCost, moneyHappens

    print "memory (s), alpha, maxcost"

    for i in range(0, 100, increment):
        for j in range(0, 100, increment):
            em = EmergingMoney(numGoods, numTrials, memory, (i * 0.010), (j * 0.010))
            em.register(regcb)
            moneyHappens = -1
            em.playGame()
            visualize()

            print memory, (i * 0.010), (j * 0.010), moneyHappens

    print "memory (s), alpha, maxcost"

    for i in range(0, 100, increment):
        for j in range(0, 100, increment):
            em = EmergingMoney(numGoods, numTrials, memory, (j * 0.010), (i * 0.010))
            em.register(regcb)
            moneyHappens = -1
            em.playGame()
            visualize()
            print memory, (j * 0.010), (i * 0.010), moneyHappens

    print "memory , alpha(s), maxcost"

    for i in range(0, 100, increment):
        for j in range(0, 100, increment):
            em = EmergingMoney(numGoods, numTrials, i, alpha, (j * 0.010))
            em.register(regcb)
            moneyHappens = -1
            em.playGame()
            visualize()

            print i, alpha, (j * 0.010), moneyHappens

    print "memory , alpha(s), maxcost"

    for i in range(0, 100, increment):
        for j in range(0, 100, increment):
            em = EmergingMoney(numGoods, numTrials, j, alpha, i * 0.010)
            em.register(regcb)
            moneyHappens = -1
            em.playGame()
            visualize()
            print j, alpha, i * 0.010, moneyHappens

    print "done"