Open stephenfmann opened 1 year ago
@manolomartinez What version of numpy do you have? I'm on 1.21.2 but sender_pairs = sender_payoff_matrix.T[pairs]
failed with a FutureWarning
.
I'm going to update my numpy, and I think we need to change the dependency in pyproject.toml (currently numpy = ">1.20"
) to whatever you have.
What does the warning say? If we can support older versions of numpy it's better, I suppose
I already upgraded numpy and didn't save the message, but it basically said "in future this will work differently, to ensure backwards compatibility please wrap your list of tuples in np.array()
. It wants sender_payoff_matrix.T[pairs]
to be sender_payoff_matrix.T[np.array(pairs)]
, ditto for the next line with receiver_payoff_matrix
.
Shall I put this in and make older versions of numpy happy? The earliest version I have that doesn't display the message is 1.24.2, so it's only some versions earlier than that which will have problems.
Shall I put this in and make older versions of numpy happy?
Yeah, I'd do that.
Loops that might be vectorizable:
DONEevolve.OnePop.avg_payoff_vector()
line 87: double for-loop.I assume we can't remove the for-loop that defines different steps of a simulation, e.g.IGNOREevolve.Reinforcement.run()
asymmetric_games.Chance.create_gambit_game()
. I don't know if they are removable, and I don't know how much harm they cause (it's usually not a slow method). It's possible that they could at least be combined into one triple-for loop rather than two consecutive ones. Similar inasymmetric_games.NonChance.create_gambit_game()
.asymmetric_games.Chance.has_info_using_equilibrium()
(starts line 297), but we're creating an object of typeinfo.Information
inside it. We could potentially remove this and just vectorize the calculation of mutual information. Ditto withhighest_info_using_equilibrium()
, the loop starts on line 387.calculate.one_batch()
, but I don't think our current workflow uses this function at all.skyrms2010signals
:Skyrms2010_1_2.run_simulation()
Skyrms2010_5_2.run_simulations()
(double for-loop that callsevolve.OnePop.avg_payoff_vector()
which itself has a double for-loop)Skyrms2010_8_2.run_simulation()
(double for-loop that calls a simulation)Skyrms2010_8_3.run_simulation()
(double for-loop that calls a simulation)Skyrms2010_10_5.run_simulation()
(for-loop that calls a simulation)godfreysmith2013communication
:DONEGodfreySmith2013_1.load_saved_games()
(double for-loop)DONEGodfreySmith2013_1.calculate_results_per_c()
(double for-loop)DONEGodfreySmith2013_2.load_saved_games()
(double for-loop)DONEGodfreySmith2013_2.calculate_results_per_c()
(double for-loop)DONEGodfreySmith2013_3.load_saved_games()
(double for-loop)DONEGodfreySmith2013_3.calculate_results_per_c()
(double for-loop)DONEcalculate_C()
(standalone method starts line 813): triple for-loopcalculate_Ks_and_Kr()
(line 864): quadruple for-loopanalyse_games_3x3()
(line 1039): double for-loop that creates an object each timeanalyse_games_3x3_c_and_k()
(line 1266): double for-loop that creates an object each time