導航:首頁 > 源碼編譯 > 遺傳演算法變異

遺傳演算法變異

發布時間:2022-02-15 08:57:19

Ⅰ 遺傳演算法中的變異操作問題

我覺得應該是對整個種群作變異處理

變異:
對群體P(t)中的每一個個體,以某一概率(稱為變異概率)改變某一個或某一些基因座上的基因值為其他基因值

Ⅱ 遺傳演算法中的變異是對交叉後的個體進行還是當前種群的所有個體(除了直接進入下一

說的不是很清楚 是指遺傳病概率的計算嗎 如果是的話 其對象應該是後代個體

Ⅲ 請問遺傳演算法的變異操作的問題

可以使用白雜訊之類的演算法加入噪點

補充:白雜訊是指功率譜密度在整個頻域內均勻分布的雜訊,比較適合在遺傳演算法中處理變異現象。

#include "msp.h"
float randnu(long *iseed)
{
float z;
*iseed=2045*(*iseed)+1;
*iseed=*iseed-(*iseed/1048576)*1048576;
z=(float)((*iseed+1)/1048577.0);
return(z);
}
/*--------------------------------------------------------------------*/
void meavar(float u[],int *n,float *pum,float *puv)
{
int i,k;
*pum=0.0;
for(k=0;k<*n;k++)
*pum=*pum+u[k];
*pum=*pum/(*n);
*puv=0.0;
for(i=0;i<*n;i++)
*puv=*puv+pow((u[i]-*pum),2);
*puv=*puv+pow((u[i]-*pum),2);
*puv=*puv/(*n-1.);
return;
}
/*---------------------------------------------------------------------
Routine mrandom : To generate the random number(pseudo-white noise).
input Parameters:
n : the random data number requested; integer .
iseed: the seed for pseudo-random data generation.it must be
initialized by main program(suggested value is ISEED=12357),
and the random number is cycled,the cycle length=1,048,576
itype: random data distribution type, see below:
itype=1: Uniform distributed,from 0.0 to 1.0
itype=2: Uniform distributed,Mean=0.0, Variance(Power) p=1.0
itype=3: Uniform distributed,Mean=0.0, Variance(Power) p=p.
itype=4: Gaussian distributed,Mean=0.0, Variance(Power) p=1.0
itype=5: Gaussian distributed,Mean=0.0, Variance(Power) p=p.
p :variance(Power) of random, only used when itype=3 or itype=5.
out parameters:
u :n dimensioned real array, data is stored in u(0) to u(n-1).
in Chapter 1
---------------------------------------------------------------------*/
void mrandom(float u[],int *n,long *piseed,int itype,float p)
{
int k,ns,ksection,ks,j;
float a,v,umean,uvari;
float *pum,*puv;
pum=&umean;
puv=&uvari;
if(itype >6 |r |r itype <1)
return;
for(k=0;k<*n;k++)
u[k]=randnu(piseed);
if(itype==2 |r |r itype==3)
{
meavar(u,n,pum,puv);
/* to obtain a zero mean and P-power random sequence u[k]).*/
a=12.;
if(itype==2)
p=sqrt(a);
if(itype==3)
p=sqrt(p*a);
for(k=0;k<*n;k++)
u[k]=(u[k]-umean)*p;

}
if(itype==4 |r |ritype==5)
{
/* to generate the Gaussian randow sequence u[k],k=0,1,2,...,ns-1*/
ksection=12;
ns=*n/ksection;
ks=0;
if (itype==4) p=1;
p=sqrt(p);
for(k=0;k<ns;k++)
{
v=0.0;
for(j=0;j<k;j++)
{ v+=p*(u[j+ks]-.5);
u[k]=v;
ks=ks+ksection;
}
*n=ns;
}
meavar(u,n,pum,puv);
printf(" The mean of u[n]=%f\n",umean);
printf(" The variance of u[n]=%f\n",uvari);
return;
}

其中msp.h頭文件:
#define abs_error 1.e-10

#ifndef _MSP_H_
#define _MSP_H_

typedef struct {float real,imag;} complex;
/*-------------------------------------------------------------------*/
float mabs(complex a)
{
float m;
m=a.real*a.real+a.imag*a.imag;
m=sqrt(m);
return(m);
}
/*-------------------------------------------------------------------*/
float msign(float a,float b)
{
float z;
if(b>=0) z=sqrt(pow(a,2));
else z=-sqrt(pow(a,2));
return(z);
}
/*-------------------------------------------------------------------*/
complex cexp(complex a)
{
complex z;
z.real=exp(a.real)*cos(a.imag);
z.imag=exp(a.real)*sin(a.imag);
return(z);
}
/*-------------------------------------------------------------------*/
void maftodf(float d[],float c[],int ln,int iband,float fln,float fhn,
float b[],float a[],int *ierror);
void mampres(complex h[],float amp[],int n,float fs,int iamp,char filename[]);
void mar1psd(complex a[],int ip,int mfre,float *ep,float ts);
void marburg(complex x[],complex a[],complex ef[],complex eb[],
int n,int ip,float *ep,int *ierror);
void marmach(complex x[],complex ef[],int n,complex a[],
complex b[],int ip,int iq,int m,float *ep,float ts);
void maryuwa(complex x[],complex a[],complex r[],int n,int ip,
float *ep, int *ierror);
void mbiline(float d[],float c[],int ln,float b[],float a[],int *ierror);
void mbutwcf(int l,int k,int ln,float d[],float c[],int *ierror);
void mchebsh(int l,int k,int ln,float d[],float c[],float phi2,
int *ierror);
void mcholsk(complex a[],complex b[],int n,float eps,int *iflag);
void mcmpdft(complex x[],complex y[],int n,int isign);
void mcmpfft(complex x[],int n,int isign);
void mconvo1(float x[],float h[],float y[],int n,int m,int L);
void mconvo2(complex x[],complex h[],complex y[],int n1,int n2,int n);
void mcorpsd(complex x[],complex r[],int n,int lag,int iwindow,float t);
void mcorre1(complex x[],complex y[],complex r[],int n,int lag);
void mcorre2(complex x[],complex y[],int m,int n,int icorre);
void mcztfft(complex x[],int n,int m,int maxnm,float dltomg,
float omg0,float fs,int *ierror);
void mdecint(float x[],float h[],float y[],int nh,int ny,int m,
int l,int *k);
void mdefir1(int l,int iband,float fl,float fh,float fs,int iwindow,
float b[],float w[],int *ierror);
void mdefir2(int l,int iband,float fl,float fh,complex b[],
float trans,float fs,int *ierror);
void mdefir3(int nfilt,int nbands,float edge[],float fx[],
float wtx[],float h[]);
void mdesiir(float *f1,float *f2,float *f3,float *f4,float fs,
float alpha1,float alpha2,int iband,int itype);
void mfirres(float b[],int lb,int n,complex h[]);
void mfitout(float b[],float a[],int lb,int la,float x[],
int n,float y[]);
void miirres(float a[],float b[],int lb,int la,complex h[],int n);
void mlattic(float b[],float a[],int l,float k[],
float c[],int itype ,int *ierror);
void mmayuwa(complex x[],int n,complex a[],int ip,complex b[],int iq,
complex r[],float *ep, float ts,int *ierror);
void mmvseps(complex x[],complex ef[],complex eb[],int n,complex a[],
int ip,int *ierror,float ts);
void morderb(float *f1,float *f2,float *f3,float *f4,float fs,float alpha1,
float alpha2,int *l,int iband,int itype,int *ierror);
void mperpsd(complex x[],int n,int nshift,int nsamp,int iwidow,float ts);
void mphares(complex h[],float phase[],int n,float fs,char filename[]);
void mprgfft(complex x[],int n,int l,int lf,int k1,int isign);
void mpsplot(float psdr[],float psdi[],int mfre,float ts);
float randnu(long *iseed);
void meavar(float u[],int *n,float *pum,float *puv);
void mrandom(float u[],int *n,long *piseed,int ITYPE,float p);
void mrelfft(float xr[],float xi[],int n,int isign);
float d(int k,int n,int m);
float gee(int k,int n);
void mremez1();
void msplfft(complex x[],int n,int isign);
void munwrap(float phase[],int n);
void mwindow(float w[],int n,int iwindow,int *ierror);
int mspbfct(int i1,int i2);

/*-------------------------------------------------------------------*/
#endif

Ⅳ 論述遺傳演算法中雜交和變異運算元的區別

因為一般來說變異運算元只是按概率對染色體的某一基因位(自變數的某一維)進行一個微擾動或是取反,而交叉運算元是對整個染色體操作的,交叉運算元的類型有很多,即使是最簡單的單點交叉也是要選擇一個點之後交叉兩邊的部分。所以具有全局搜索能力。

Ⅳ 遺傳演算法的邊界變異是什麼意思

標準的交叉運算元和變異運算元應該指的是最基本最簡單的交叉和變異,比如交叉有單點交叉和兩點交叉,變異一般也是單點變異.

Ⅵ 十進制的遺傳演算法怎麼變異

十進制的交叉方式有兩種,一種是轉換為二進制交叉,交叉好後再轉為十進制;另一種是十進制直接交叉。 直接交叉就是利用交叉公式(運算公式)進行計算,以下為可選公式,分為十進制整型(變數不連接可調)和實型(變數連續可調)兩種。

Ⅶ 遺傳演算法的變異率問題

應該是後者.
因為這是從120*101的染色體中任取一個染色體,那麼就有0.01*120*101個.

Ⅷ 遺傳演算法,交叉概率,和變異概率,選擇,通常在多少值,合適

這幾個操作的概率是相互獨立的,並不要求和為1。
選擇操作中的概率,以輪賭法為例,概率只反映了個體被選擇到的可能性,與個體的適應度大小有關,一般是適應度越大,對應輪賭法中的概率值越大。
交叉操作中的概率是用於判定兩個個體是否進行交叉操作,一般都會大於0.9。
變異操作的概率是允許少數個體存在變異情況,以避免限入局部最優解,其值一般都在0.1以下。

閱讀全文

與遺傳演算法變異相關的資料

熱點內容
板石樓梯計演算法 瀏覽:432
swift開發pdf 瀏覽:290
ideajava編譯版本 瀏覽:960
邁普交換機常用命令 瀏覽:177
刪除創建的文件夾命令 瀏覽:181
linuxmysql連接拒絕連接 瀏覽:818
php關鍵詞源碼 瀏覽:828
小米公司需要那麼多程序員嗎 瀏覽:880
超准macd副圖源碼 瀏覽:9
好脾氣的程序員 瀏覽:663
macppt壓縮軟體 瀏覽:135
公眾號推廣系統源碼 瀏覽:66
程序員作息安排 瀏覽:625
如何在本地登錄伺服器 瀏覽:338
喵吧app怎麼使用 瀏覽:752
家庭伺服器如何連wifi 瀏覽:209
新聞推薦系統源碼 瀏覽:227
php中文星號 瀏覽:515
伺服器4盤是什麼意思 瀏覽:598
如何重啟或關閉伺服器 瀏覽:356