Home > Mateda2.0 > seeding > seeding_unitation_constraint.m

seeding_unitation_constraint

PURPOSE ^

[Pop]=seeding_unitation_constraint(n,PopSize,Card,seeding_pop_params)

SYNOPSIS ^

function[Pop]=seeding_unitation_constraint(n,PopSize,Card,seeding_pop_params)

DESCRIPTION ^

 [Pop]=seeding_unitation_constraint(n,PopSize,Card,seeding_pop_params)
 seeding_unitation_constraint:  generates a population of binary vectors 
                               where all vectors have the same number of
                               ones passed in seeding_pop_params{1}
 INPUTS 
 n:                   Number of Variables
 PopSize:             Population size
 Card:                Cardinality of the variables
 seeding_pop_params{1} = Number_of_Ones \in [1,n-1]:  Number of ones in each binary solution 
 OUTPUTS
 Pop:                 Seeded population

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function[Pop]=seeding_unitation_constraint(n,PopSize,Card,seeding_pop_params)
0002 % [Pop]=seeding_unitation_constraint(n,PopSize,Card,seeding_pop_params)
0003 % seeding_unitation_constraint:  generates a population of binary vectors
0004 %                               where all vectors have the same number of
0005 %                               ones passed in seeding_pop_params{1}
0006 % INPUTS
0007 % n:                   Number of Variables
0008 % PopSize:             Population size
0009 % Card:                Cardinality of the variables
0010 % seeding_pop_params{1} = Number_of_Ones \in [1,n-1]:  Number of ones in each binary solution
0011 % OUTPUTS
0012 % Pop:                 Seeded population
0013 
0014  Number_of_Ones = seeding_pop_params{1};
0015  Pop = zeros(PopSize,n);
0016  
0017  for i=1:PopSize
0018   auxperm = randperm(n);  
0019   Pop(i,auxperm(1:Number_of_Ones)) = 1;   
0020  end
0021  
0022 return
0023  
0024  
0025

Generated on Fri 04-Dec-2009 13:38:29 by m2html © 2003