关键词不能为空

当前您在: 主页 > 英语 >

(完整版)initializega函数代码

作者:高考题库网
来源:https://www.bjmy2z.cn/gaokao
2021-02-19 02:55
tags:

-

2021年2月19日发(作者:fleshy)


function [pop] = initializega(num, bounds, evalFN,evalOps,options)


%



function [pop]=initializega(populationSize, variableBounds,evalFN,evalOps,options)


%



initializega creates a matrix of random numbers with



%





a number of rows equal to the populationSize and a number


%



columns equal to the number of rows in bounds plus 1 for


%



the f(x) value which is found by applying the evalFN.


%



This is used by the ga to create the population if it


%



is not supplied.


%


% pop





- the initial, evaluated, random population


% populatoinSize - the size of the population, i.e. the number to create


% variableBounds - a matrix which contains the bounds of each variable, i.e.


%







[var1_high var1_low; var2_high var2_low; ....]


%


% evalFN




- the evaluation fn, usually the name of the .m file for


%







evaluation


%


% evalOps



- any options to be passed to the eval function defaults []


%


% options



- options to the initialize function, ie.


%







[type prec] where eps is the epsilon value


%







and the second option is 1 for float and 0 for binary,


%







prec is the precision of the variables defaults [1e-6 1]



if nargin<5


options=[1e-6 1];


end


if nargin<4


evalOps=[];


end



if any(evalFN<48) %Not a .m file


if options(2)==1 %Float GA




estr=['x=pop(i,1); pop(i,xZomeLength)=', evalFN ';'];


else %Binary GA




estr=['x=b2f(pop(i,:),bounds,bits); pop(i,xZomeLength)=', evalFN ';'];


end


else %A .m file


if options(2)==1 %Float GA




estr=['[ pop(i,:) pop(i,xZomeLength)]=' evalFN '(pop(i,:),[0 evalOps]);'];


else %Binary GA




estr=['x=b2f(pop(i,:),bounds,bits);[x v]=' evalFN ...






'(x,[0 evalOps]); pop(i,:)=[f2b(x,bounds,bits) v];'];




end

-


-


-


-


-


-


-


-



本文更新与2021-02-19 02:55,由作者提供,不代表本网站立场,转载请注明出处:https://www.bjmy2z.cn/gaokao/666550.html

(完整版)initializega函数代码的相关文章

  • 爱心与尊严的高中作文题库

    1.关于爱心和尊严的作文八百字 我们不必怀疑富翁的捐助,毕竟普施爱心,善莫大焉,它是一 种美;我们也不必指责苛求受捐者的冷漠的拒绝,因为人总是有尊 严的,这也是一种美。

    小学作文
  • 爱心与尊严高中作文题库

    1.关于爱心和尊严的作文八百字 我们不必怀疑富翁的捐助,毕竟普施爱心,善莫大焉,它是一 种美;我们也不必指责苛求受捐者的冷漠的拒绝,因为人总是有尊 严的,这也是一种美。

    小学作文
  • 爱心与尊重的作文题库

    1.作文关爱与尊重议论文 如果说没有爱就没有教育的话,那么离开了尊重同样也谈不上教育。 因为每一位孩子都渴望得到他人的尊重,尤其是教师的尊重。可是在现实生活中,不时会有

    小学作文
  • 爱心责任100字作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文
  • 爱心责任心的作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文
  • 爱心责任作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文