Design of an Automatic Control Algorithm for Energy-Efficient ...
Design of an Automatic Control Algorithm for Energy-Efficient ...
Design of an Automatic Control Algorithm for Energy-Efficient ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Optimiser code 155<br />
52 return 10;<br />
54 ordPrio = (int_T∗) malloc (( Obj .numObj+1)∗Obj .numObj∗ size<strong>of</strong>(int_T) ) ;<br />
if(ordPrio == NULL)<br />
56 return 10;<br />
58 fitness = (real_T∗) malloc (Opt. popSize∗size<strong>of</strong>(real_T) ) ;<br />
if(fitness == NULL)<br />
60 return 10;<br />
62 parents = (int_T∗) malloc (2∗Opt . numChild∗ size<strong>of</strong>(int_T) ) ;<br />
if(parents == NULL)<br />
64 return 10;<br />
66 /∗ initialise RNG ∗/<br />
68<br />
/∗Pl<strong>an</strong>tSeeds(time(NULL)) ; needs to be done once outside this function∗/<br />
/∗ C a l c u l a t e maximum c<strong>an</strong>ges based on t h e ch<strong>an</strong>ge <strong>of</strong> the fitness (hypermutation) ∗/<br />
70 if(ExVal . f i t [ 0 ] == ERROR_FITNESS) /∗ Start or limit exceeded ∗/<br />
max_ch<strong>an</strong>ge = Opt . adapMutFractionMax ;<br />
72 else if (( ExVal . f i t [0] Opt . adapMutFractionMin ) /∗ always allow minimal ch<strong>an</strong>ge<br />
∗/<br />
74 max_ch<strong>an</strong>ge = ExVal . explFactor [0] Opt. adapMutFractIncr ;<br />
else if (( ExVal . f i t [0] >ExVal . f i t _last [0])<br />
76 && ExVal . explFactor [ 0 ] < Opt . adapMutFractionMax) /∗ Never allow more th<strong>an</strong><br />
78 else<br />
maximum ∗/<br />
max_ch<strong>an</strong>ge = ExVal . explFactor [0]+Opt . adapMutFractIncr ;<br />
max_ch<strong>an</strong>ge = ExVal . explFactor [ 0 ] ;<br />
80 #if DEBUG_IMEA >= 2<br />
82 #endif<br />
84<br />
printf("==last= %f ===old= %f===\n" , ExVal . f i t [ 0 ] , ExVal . f i t _last [0]) ;<br />
/∗ Initialise population ∗/<br />
/∗ create initial population ∗/<br />
86 IMEA_initPop(pop , Opt. basePop , ExVal . elitePop , Opt. popSize , Opt. numElite , Opt.numBase<br />
, DV. numDV,DV. l b , DV. ub ) ;<br />
/∗ Evaluate the fitness <strong>of</strong> the initial population ∗/<br />
88 IMEA_evaluateObjectives(pop , Sys , Obj. objectiveFctArray , Estim_SYS_States , Opt.<br />
90<br />
s i m H o r i z o n , Opt . simSampleT , Opt . p o p S i z e , DV. numDV, Obj . numObj ) ;<br />
IMEA_priorisedWeighting(pop , Obj , ordPrio , Opt. popSize , DV.numDV) ;<br />
/∗ Main loop ∗/<br />
92 <strong>for</strong>( i =0; i