[Pop]=Bias_Init(n,PopSize,Card,seeding_pop_params) Bias_Init: Biased initialization of a population of binary vectors, where the probability of generating 1 is p and the probability of generating 0 is 1-p. INPUTS n: Number of Variables PopSize: Population size Card: Cardinality of the variables seeding_pop_params{1} = p: Probability of generating 1 OUTPUTS Pop: Seeded population EXAMPLE [Pop]=Bias_Init(10,15,2*ones(1,10),{0.8}); Last version 11/10/2008. Ruben Armananzas and Roberto Santana (roberto.santana@ehu.es)
0001 function[Pop]=Bias_Init(n,PopSize,Card,seeding_pop_params) 0002 % [Pop]=Bias_Init(n,PopSize,Card,seeding_pop_params) 0003 % Bias_Init: Biased initialization of a population of binary vectors, 0004 % where the probability of generating 1 is p and the probability of generating 0 0005 % is 1-p. 0006 % INPUTS 0007 % n: Number of Variables 0008 % PopSize: Population size 0009 % Card: Cardinality of the variables 0010 % seeding_pop_params{1} = p: Probability of generating 1 0011 % OUTPUTS 0012 % Pop: Seeded population 0013 % EXAMPLE 0014 % [Pop]=Bias_Init(10,15,2*ones(1,10),{0.8}); 0015 % 0016 % Last version 11/10/2008. Ruben Armananzas and Roberto Santana (roberto.santana@ehu.es) 0017 0018 p = seeding_pop_params{1}; 0019 0020 Pop = rand(PopSize,n) <= p; 0021 0022 return 0023 0024 0025