def selection(inventory, revenue): "Takes in the item and time and checks its corresponding inventory" print "Selection called" bernoulli_n = 1 if (inventory.cur < inventory.maxi): decision = 0 number_items_dp = 0 else: # add item to selection with some probability number_items_dp = inventory.cur - inventory.maxi # Commpute the probability prob = (float)(revenue.dp / (revenue.dp + revenue.cp)) # make a Bernoulli draw with probability "prob" #decision=bernoulli.rvs(prob,loc=0,size=1) # part of scipy decision = binomial(bernoulli_n, prob, 1) it = d.get1(db_name, 'product', inventory.id) it['number_items_dp'] = number_items_dp it['decision'] = it['decision'] d.replace1(db_name, 'product', it, it['id']) return decision
def selection(inventory,revenue): "Takes in the item and time and checks its corresponding inventory" print "Selection called" bernoulli_n=1 if(inventory.cur<inventory.maxi): decision=0 number_items_dp=0 else:# add item to selection with some probability number_items_dp=inventory.cur-inventory.maxi # Commpute the probability prob=(float)(revenue.dp/(revenue.dp+revenue.cp)) # make a Bernoulli draw with probability "prob" #decision=bernoulli.rvs(prob,loc=0,size=1) # part of scipy decision=binomial(bernoulli_n,prob,1) it=d.get1(db_name,'product',inventory.id) it['number_items_dp']=number_items_dp it['decision']=it['decision'] d.replace1(db_name,'product',it,it['id']) return decision
def bidding(item, buyer_offer, customer_loyalty, buyer_demand, profit_margin): it = d.get1(db_name, 'product', item) return bidding_compute(it, buyer_offer, customer_loyalty, buyer_demand, profit_margin)
def bidding(item, buyer_offer,customer_loyalty,buyer_demand,profit_margin): it=d.get1(db_name,'product',item) bidding_compute(it,buyer_offer,customer_loyalty,buyer_demand,profit_margin) return