#############################################################################################
        
        
#data to save
survivors = []
step_time = []
price_df = {}
total_time = []

#if __name__ == '__main__':
for run in range(1):
    print ("Run: " + str(run))
    #create an instance of the model
    start = time.time()
    test = NetScape(height = 50, width = 50, initial_population =200, regrow = 1,\
                    Moore = False)
    
    from distributedspace_mesa.space_distribute_test import Space_Distribute_Test    
    #create an instance of the pool process, parameter to pass in is
    #the model object
    d_mesa = Space_Distribute_Test(test, step_finish,\
                        split = 3)#, resolver = resolver) 

    #run the program, pass in the steps
    results = d_mesa.distro_geo(100)
    
        
    #print (results[1].schedule.get_breed_count('agent'))
    df = results[1].datacollector.get_table_dataframe("Time") 
    price_df["Run"+str(run)] = results[1].price_record
    agents = recorder.survivors(results[1])
Esempio n. 2
0
#pickle.dump(price_record, open( "price_record.p", "wb" ))
#pickle.dump(test.datacollector.get_table_dataframe("Health"), open("Agent_stats.p", "wb"))
#pickle.dump(test.datacollector.get_table_dataframe("Time"), open("Time_stats.p", "wb"))

'''

#MULTI RUN
survivors = []
time = []
price_df = {}

for run in range(100):
    print("Run: " + str(run))
    test = NetScape(height=50,
                    width=50,
                    initial_population=200,
                    regrow=1,
                    seed=42)

    for s in range(1000):
        test.step()
    df = test.datacollector.get_table_dataframe("Time")
    price_df["Run" + str(run)] = test.price_record
    agents = recorder.survivors(test)
    survivors.append(agents)
    time.append(df["Time Per Step"].sum())

#pickle.dump(price_df, open("brute_total_price.p", "wb"))
#pickle.dump(survivors, open( "brute_multi_sur.p", "wb" ))
#pickle.dump(time, open("brute_multi_time.p", "wb"))