Example #1
0
 def solve(self):
     '''
     Solves the cstwMPCmarket.
     '''
     if self.AggShockBool:
         for agent in self.agents:
             agent.getEconomyData(self)
         Market.solve(self)
     else:
         self.solveAgents()
         self.makeHistory()
Example #2
0
 def solve(self):
     '''
     Solves the cstwMPCmarket.
     '''
     if self.AggShockBool:
         for agent in self.agents:
             agent.getEconomyData(self)
         Market.solve(self)
     else:
         self.solveAgents()
         self.makeHistory()
         ThisType.solve()
         type_list.append(ThisType)
         ThisType = deepcopy(AltType)
         ThisType(punk_utility=u_vec[j])
         ThisType.solve()
         type_list.append(ThisType)
     for j in range(u_vec.size):
         ThisType = deepcopy(TestType)
         ThisType(jock_utility=u_vec[j])
         ThisType.solve()
         type_list.append(ThisType)
         ThisType = deepcopy(AltType)
         ThisType(jock_utility=u_vec[j])
         ThisType.solve()
         type_list.append(ThisType)
 
 # Now run the simulation inside a Market 
 TestMarket = Market(agents        = type_list,
                     sow_vars      = ['pNow'],
                     reap_vars     = ['sNow'],
                     track_vars    = ['pNow'],
                     dyn_vars      = ['pNextIntercept','pNextSlope','pNextWidth'],
                     millRule      = calcPunkProp,
                     calcDynamics  = calcFashionEvoFunc,
                     act_T         = 1000,
                     tolerance     = 0.01)
 TestMarket.pNow_init = 0.5
     
 TestMarket.solve()
 plt.plot(TestMarket.pNow_hist)
 plt.show()