-
Notifications
You must be signed in to change notification settings - Fork 2
Cost analysis
Jakob Beckmann edited this page May 12, 2019
·
23 revisions
-
Sum= dim * 1 -
Sum of Squares= dim * 2 -
Sphere= dim * 2 -
Griewank= dim * 6 -
Rastigrin= dim * 7 -
Rosenbrock= (dim-1) * 8
Total Flops = 4n + population_size * objective_func_flopCount + max_iter(31n + population_size*objective_func_flopCount)
- n = population_size*dim
-
pso_rand_init= 5n -
pso_eval_fitness= population_size*objective_func_flopCount -
pso_gen_init_velocity= 5 + 2n -
pso_generate_vel_limit= 2 flops -
pso_update_velocity= 11n flops -
pso_update_position= n flops
-
7 + 7n + population_size*objective_func_flopCountflops
-
max_iter*(12n + swarm_size*obj_func_flops)flops
-
7 + 7n + swarm_size*obj_func_flops + max_iter*(12n + swarm_size*obj_func_flops)flops
All in number of floats:
-
min_vel= 1 -
max_vel= 1 -
current_positions= dim * swarm size -
local_best_position= dim * swarm size -
current_fitness= swarm size -
local_best_fitness= swarm size -
p_velocity= dim * swarm size -
global_best_fitness= 1 (copy) -
pso_best_fitness()uses 1 temporary float -
pso_gen_init_velocity()temporarily assigns swarm size * dim array
For every iteration:
-
pso_best_fitness()uses 1 temporary float, called once per iteration
Solution memory allocation:
-
best_solution= dim
This does not count the temporary allocation in the initialization of
pso_gen_init_velocity().
In floats:
4 + 3(dim * swarm) + (2 * swarm) + iter + dim
In bytes:
16 + 12(dim * swarm) + (8 * swarm) + [4 * (iter + dim)]
For dimension size 100, swarm size 10^6, iteration count 1000:
16 + 12*10^8 + 8*10^6 + 4*1100 = 1,208,004,416 = 2^(30.17)
This is slightly more than 1GB of memory (2^(30) bytes). Note that memory
consumption is mostly determined by the 12(dim * swarm) term.