?? main.cpp
字號:
#include "matlib.h"
#pragma hdrstop
#include "main.h"
#include "ga.h"
#include "initializega.h"
#include "calcbits.h"
#include "parse.h"
#include "b2f.h"
Mm main() {
begin_scope
dMm(bounds); dMm(p); dMm(endPop); dMm(bestSols); dMm(trace_);
call_stack_begin;
// nargin, nargout entry code
double old_nargin=nargin_val; if (!nargin_set) nargin_val=0.0;
nargin_set=0;
double old_nargout=nargout_val; if (!nargout_set) nargout_val=0.0;
nargout_set=0;
// translated code
//n=2
//設置邊界條件
bounds = ones(2.0,1.0)*(BR(-1.0),1.0);
//遺傳算法優化
/*[p,endPop,bestSols,trace_] = */
ga(bounds,TM("f552"),i_o,p,endPop,bestSols,trace_);
//性能跟蹤
display( plot((CL(trace_(c_p,1.0)),trace_(c_p,3.0),TM("b-"))) );
hold(TM("on"));
display( plot((CL(trace_(c_p,1.0)),trace_(c_p,2.0),TM("r-"))) );
xlabel((CL(TM("Generation"))));
ylabel((CL(TM("Fittness"))));
legend((CL(TM("解的變化")),TM("種群的變化")));
call_stack_end;
// nargin, nargout exit code
nargin_val=old_nargin; nargout_val=old_nargout;
// function exit code
return x_M;
end_scope
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -