link a custom creation function
Show older comments
Hello,
i am using optimization toolbox and i want to link m.file that contains my initial population matrix .
% Input Data
M= 1;
I=2;
J = 9;
P_Prop_left = [3200,2690,4500,2900,2300,2000,1000,500,0];
P_EL = [2190,3100,4100,900,2000,2300,125.5,2125.57,82.19];
P_EL_Max = max(P_EL);
P_Prop_max = max(P_Prop_left);
nvars = 30
% Initial values functions
P_mcr_m_Target_initial = (max(P_Prop_left)*1.2) ./ (M.* ones(1,M))
P_mcr_i_Target_initial = (P_EL_Max * 1.1) ./ (I .* ones(1,I))
Ld_left_initial = ( P_Prop_left + (0.5 .* P_EL)) ./ P_mcr_m_Target_initial';
Ld_left_initial (Ld_left_initial > 0.9) = 0.85
Ld_left_initial (Ld_left_initial < 0.25) = 0 % make it Like a constraint later on
Ld_left_initial = reshape (Ld_left_initial', 1, M*J)
P_BTot_initial= P_mcr_m_Target_initial' * Ld_left_initial
PTI_initial = P_Prop_left - ( P_mcr_m_Target_initial * Ld_left_initial) ;
PTO_initial = -1 .* PTI_initial;
PTO_initial(PTO_initial<0) = 0
PTI_initial(PTI_initial<0) = 0
LF_initial = (P_EL - 2 .* PTO_initial + 2 .* PTI_initial ) ./ (I .* P_mcr_i_Target_initial')
LF_initial = reshape( LF_initial', 1, I*J)
% IP Initial Population matrix of size 1x NoOfVariables
IP = [P_mcr_m_Target_initial, P_mcr_i_Target_initial, Ld_left_initial, LF_initial]
my m file returns a matrix of size 1x nvars.
Q1: can i consider this matrix as initial population matrix?
in my understanding, this creates only one individual of the whole population, which may be not enoght. if yes,
Q2: how i create a whole population close to the values returned by the IP .
Q3: and what the differnece between using Initial Population matrix and create a custom population creation function
i suppose to use uniform creation function , or constraint dependant creation function, and use the IP matrix on (initial population) cell on the optimization toolbox
Accepted Answer
More Answers (0)
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!