亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? gajava.txt

?? 這是一個(gè)應(yīng)用遺傳算法解決的函數(shù)優(yōu)化問題
?? TXT
?? 第 1 頁 / 共 5 頁
字號(hào):
                                population[j].upper[i]);

}
}
}
            infile.close();
}

catch (IOException e1) {
            System.out.println("Can not open input file!");
            System.exit(0);
}
}

/***********************************************************/
/* Random value generator: Generates a value within bounds */
/***********************************************************/

double randval(double low, double high) {
double val;
        val = (double) java.lang.Math.random() * (high - low) + low;
return (val);
}

/*************************************************************/
/* Evaluation function: This takes a user defined function.  */
/* Each time this is changed, the code has to be recompiled. */
/* The current function is:  x[1]^2-x[1]*x[2]+x[3]           */
/*************************************************************/
void display() {
int i, j;
for (j = 0; j <= POPSIZE; j++) {
for (i = 0; i < NVARS; i++) {
                System.out.print(population[j].gene[i] + "\t");
}
            System.out.print("             " + population[j].fitness);
            System.out.print("\n");
}
        System.out.print("\n");
}

void evaluate() {
int mem;
int i, j, k;
double t[] = new double[NVARS + 1];

double sum = 0;
double min = 0;

for (mem = 0; mem < POPSIZE; mem++) {
            sum = 0;
            min = 0;
for (i = 0; i < NVARS; i++) {
                t[i] = population[mem].gene[i];
                sum += t[i];
}
            t[3] = T - sum;
if (t[3] < E || t[3] > (T - 3 * E)) {
                population[mem].fitness = 0;
continue;
}
for (i = 1; i < 5; i++) {
for (j = 0; j < 4; j++) {
for (k = 0; k < 3; k++) {
if (s[i - 1][j][k] + a[i - 1][j][k] * t[i - 1] >=
                            p[i - 1][j][k] * u[i - 1][j][k] * t[i - 1]) {
                            s[i][j][k] = s[i - 1][j][k] + a[i - 1][j][k] * t[i -
                                         1] - p[i - 1][j][k] * u[i -
                                         1][j][k] * t[i - 1];
} else {
                            s[i][j][k] = 0;
}
}
}
}
for (j = 0; j < 4; j++) {
for (k = 0; k < 3; k++) {
//s[0][j][k]=s[4][j][k];

                    min += s[4][j][k];
}
}
            population[mem].fitness = 10000 - min;
}
}

/***************************************************************/
/* Keep_the_best function: This function keeps track of the    */
/* best member of the population. Note that the last entry in  */
/* the array Population holds a copy of the best individual    */
/***************************************************************/

void keep_the_best() {
int mem;
int i;
        cur_best = 0; /* stores the index of the best individual */

for (mem = 0; mem < POPSIZE; mem++) {
if (population[mem].fitness > population[POPSIZE].fitness) {
                cur_best = mem;
                population[POPSIZE].fitness = population[mem].fitness;
}
}
/* once the best member in the population is found, copy the genes */
for (i = 0; i < NVARS; i++) {
            population[POPSIZE].gene[i] = population[cur_best].gene[i];
}

}

/****************************************************************/
/* Elitist function: The best member of the previous generation */
/* is stored as the last in the array. If the best member of    */
/* the current generation is worse then the best member of the  */
/* previous generation, the latter one would replace the worst  */
/* member of the current population                             */
/****************************************************************/

void elitist() {
int i;
double best, worst; /* best and worst fitness values */
int best_mem = 0;
int worst_mem = 0;
/* indexes of the best and worst member */

        best = population[0].fitness;
        worst = population[0].fitness;
for (i = 0; i < POPSIZE - 1; ++i) {
if (population[i].fitness > population[i + 1].fitness) {
if (population[i].fitness >= best) {
                    best = population[i].fitness;
                    best_mem = i;
}
if (population[i + 1].fitness <= worst) {
                    worst = population[i + 1].fitness;
                    worst_mem = i + 1;
}
} else {
if (population[i].fitness <= worst) {
                    worst = population[i].fitness;
                    worst_mem = i;
}
if (population[i + 1].fitness >= best) {
                    best = population[i + 1].fitness;
                    best_mem = i + 1;
}
}
}
/* if best individual from the new population is better than */
/* the best individual from the previous population, then    */
/* copy the best from the new population; else replace the   */
/* worst individual from the current population with the     */
/* best one from the previous generation                     */
        System.out.println("剛完成精英主義前");
        display();
System.out.print("\n\n"best_mem"\t"worst_mem"\t"best"\t"worst"\n\n");
if (best >= population[POPSIZE].fitness) {
for (i = 0; i < NVARS; i++) {
                population[POPSIZE].gene[i] = population[best_mem].gene[i];
}
            population[POPSIZE].fitness = population[best_mem].fitness;
}
else {
for (i = 0; i < NVARS; i++) {
                population[worst_mem].gene[i] = population[POPSIZE].gene[i];
}
{System.out.print("\n\n"best_mem"\t"worst_mem"\t"best"\t"worst"\n\n");
            population[worst_mem].fitness = population[POPSIZE].fitness;}
}
        System.out.println("剛完成精英主義后");
        display();
}

/**************************************************************/
/* Selection function: Standard proportional selection for    */
/* maximization problems incorporating elitist model - makes  */
/* sure that the best member survives                         */
/**************************************************************/

void select() {
int mem, i, j;
double sum = 0;
double p;

/* find total fitness of the population */
for (mem = 0; mem < POPSIZE; mem++) {
            sum += population[mem].fitness;
}

/* calculate relative fitness */
for (mem = 0; mem < POPSIZE; mem++) {
            population[mem].rfitness = population[mem].fitness / sum;
}
        population[0].cfitness = population[0].rfitness;
/* calculate cumulative fitness */
for (mem = 1; mem < POPSIZE; mem++) {
            population[mem].cfitness = population[mem - 1].cfitness +
                                       population[mem].rfitness;
}
/* finally select survivors using cumulative fitness. */
for (i = 0; i < POPSIZE; i++) {
            p = java.lang.Math.random();
if (p < population[0].cfitness) {
                newpopulation[i] = population[0];
} else {
for (j = 0; j < POPSIZE - 1; j++) {
if (p >= population[j].cfitness &&
                        p < population[j + 1].cfitness) {
                        newpopulation[i] = population[j + 1];
break;
}
}
}
}
/* once a new population is created, copy it back */

for (i = 0; i < POPSIZE; i++) {
            population[i] = newpopulation[i];
}
}

/***************************************************************/
/* Crossover selection: selects two parents that take part in  */
/* the crossover. Implements a single point crossover          */
/***************************************************************/

void crossover() {
int mem, one = 0;
int first = 0; /* count of the number of members chosen */
double x;

for (mem = 0; mem < POPSIZE; mem++) {
            x = java.lang.Math.random();
if (x < PXOVER) {
                ++first;
if (first % 2 == 0) {
                    Xover(one, mem);
} else {
                    one = mem;
}
}
for (int j = 0; j < POPSIZE; j++) {
}
}
}

/**************************************************************/
/* Crossover: performs crossover of the two selected parents. */
/**************************************************************/

void Xover(int one, int two) {
int i;
int point; /* crossover point */
double temp;

/* select crossover point */
if (NVARS > 1) {
if (NVARS == 2) {
                point = 1;
} else {
                point = ((int) (java.lang.Math.random() * 100) % (NVARS - 1)) +
                        1;
}
for (i = 0; i < point; i++) {
                temp = 0;
                temp = population[one].gene[i];
                population[one].gene[i] = population[two].gene[i];
                population[two].gene[i] = temp;
}
}
}

/*************************************************************/
/* Swap: A swap procedure that helps in swapping 2 variables */
/*************************************************************/

/*void swap(double x, double y) {
        double temp;

        temp = x;
        x = y;
        y = temp;

         }*/

/**************************************************************/
/* Mutation: Random uniform mutation. A variable selected for */
/* mutation is replaced by a random value between lower and   */
/* upper bounds of this variable                              */
/**************************************************************/

void mutate() {
int i, j;
double lbound, hbound;
double x;

for (i = 0; i < POPSIZE; i++) {
for (j = 0; j < NVARS; j++) {
                x = java.lang.Math.random();
if (x < PMUTATION) {
/* find the bounds on the variable to be mutated */
                    lbound = population[i].lower[j];
                    hbound = population[i].upper[j];
                    population[i].gene[j] = randval(lbound, hbound);
}
}

}
}

/***************************************************************/
/* Report function: Reports progress of the simulation. Data   */
/* dumped into the  output file are separated by commas        */
/***************************************************************/

void report() {
int i;
double best_val; /* best population fitness */
double avg; /* avg population fitness */
double stddev; /* std. deviation of population fitness */
double sum_square; /* sum of square for std. calc */
double square_sum; /* square of sum for std. calc */
double sum; /* total population fitness */

        sum = 0.0;
        sum_square = 0.0;

for (i = 0; i < POPSIZE; i++) {
            sum += population[i].fitness;
            sum_square += population[i].fitness * population[i].fitness;
}

        avg = sum / (double) POPSIZE;
        square_sum = avg * avg * POPSIZE;
        stddev = java.lang.Math.sqrt((sum_square - square_sum) / (POPSIZE - 1));

        best_val = population[POPSIZE].fitness;
try {
            outfile.write("\r\n" + generation + "       ");
            outfile.write(best_val + "      "); 
            outfile.write(avg + "      "); 
            outfile.write(stddev + "      ");
} catch (IOException e1) {
}
}

/**************************************************************/
/* Main function: Each generation involves selecting the best */
/* members, performing crossover & mutation and then          */
/* evaluating the resulting population, until the terminating */
/* condition is satisfied                                     */
/**************************************************************/

public void Entrance() {
int i;
double sum = 0;
try {
            out = new FileWriter("galog.txt");
            outfile = new BufferedWriter(out);
            outfile.write("\r\ngeneration  best  average  standard\r\n");
            outfile.write("number      value fitness  deviation \r\n");
}

catch (IOException e1) {
return;
}
        generation = 0;
        initialize();
        System.out.println("初始化后");
        display();
        evaluate();
        System.out.println("計(jì)算適應(yīng)值后");
        display();
        keep_the_best();
        System.out.println("保持最好值后");
        display();
while (generation < MAXGENS) {
            generation++;
            select();
            System.out.println("選擇后");
            display();
            crossover();
            System.out.println("交叉后");
            display();
            mutate();
            System.out.println("變異后");
            display();
            evaluate();
            System.out.println("計(jì)算適應(yīng)值后");
            display();
            elitist();
            System.out.println("精英主義后");
            display();
            report();
}
try {
            outfile.write("\r\n\r\n Simulation completed\r\n");
            outfile.write("\r\n Best member: \r\n");

for (i = 0; i < NVARS; i++) {
                outfile.write("\r\n var(" + i + ") = " +
                              (int) population[POPSIZE].gene[i]);
                sum += (int) population[POPSIZE].gene[i];
}
            outfile.write("\r\n var(" + i + ") = " + (T - (int) sum));

            outfile.write("\r\n\r\n Best fitness =" +
                          population[POPSIZE].fitness);
            outfile.close();

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精选免费视频| 欧美色成人综合| 亚洲成av人片观看| 亚洲丝袜另类动漫二区| 国产精品三级电影| 久久在线观看免费| 精品av久久707| 精品国产91九色蝌蚪| 欧美一级免费大片| 日韩三级电影网址| 精品国产乱码久久久久久影片| 91精品在线免费| 欧美一区二区视频免费观看| 欧美一区二区女人| 日韩美女在线视频| 久久久久久久久久久黄色| 久久久久99精品一区| 国产性色一区二区| 国产精品理论在线观看| 一色桃子久久精品亚洲| 亚洲精选免费视频| 性久久久久久久| 狠狠色丁香九九婷婷综合五月| 国产福利91精品| 成人av综合在线| 欧美性色黄大片| 日韩情涩欧美日韩视频| 欧美国产日产图区| 亚洲激情在线激情| 久久精品国产秦先生| 国产电影精品久久禁18| 色婷婷综合久久久中文字幕| 欧美一区二区在线播放| 久久午夜电影网| 九九久久精品视频| 丁香婷婷综合激情五月色| 日本精品一区二区三区高清| 欧美高清视频一二三区| 亚洲国产成人在线| 亚洲一区在线观看视频| 国产精品综合网| 色哟哟欧美精品| 欧美videossexotv100| 亚洲欧美日韩中文字幕一区二区三区| 亚洲国产wwwccc36天堂| 成人黄色网址在线观看| 91精品国产91久久久久久最新毛片| 亚洲国产成人午夜在线一区 | 亚洲精品欧美综合四区| 日韩高清一区在线| 国产91高潮流白浆在线麻豆| 欧美精品在线视频| 中文字幕一区二区在线播放| 蜜桃视频第一区免费观看| 91丨porny丨最新| 久久综合给合久久狠狠狠97色69| 一区二区在线观看视频在线观看| 韩国精品久久久| 欧美日韩在线播| 国产精品高潮久久久久无| 精品影视av免费| 欧美精品aⅴ在线视频| 亚洲欧美二区三区| 丰满放荡岳乱妇91ww| 欧美三级乱人伦电影| 中文字幕一区二区三区在线播放 | 国产综合久久久久久鬼色| 精品视频一区 二区 三区| 亚洲欧美日韩国产中文在线| 国产剧情在线观看一区二区| 欧美一级电影网站| 亚洲一区二区在线观看视频| 91在线你懂得| 亚洲国产精品二十页| 国产福利一区二区三区视频| 久久久久国产精品厨房| 国产一区二区主播在线| 久久人人爽爽爽人久久久| 精品一区二区三区香蕉蜜桃| 日韩欧美视频一区| 蜜桃视频第一区免费观看| 日韩免费视频一区二区| 蜜臀av一区二区三区| 日韩一区二区不卡| 久久激五月天综合精品| 精品国产一区二区精华| 激情都市一区二区| 久久久精品综合| 国产精品1024| 国产精品系列在线| 99久久99久久久精品齐齐| 亚洲手机成人高清视频| 日本道免费精品一区二区三区| 亚洲欧美经典视频| 欧美日韩一区不卡| 久久国产尿小便嘘嘘尿| 久久天天做天天爱综合色| 粉嫩嫩av羞羞动漫久久久| 中文字幕一区二区三区不卡在线| 99re在线视频这里只有精品| 伊人色综合久久天天人手人婷| 欧美日韩一区二区电影| 久久激情五月婷婷| 国产精品三级在线观看| 91国内精品野花午夜精品| www.久久精品| 一区二区三区国产豹纹内裤在线| 欧美探花视频资源| 久草在线在线精品观看| 亚洲视频小说图片| 在线观看91av| 成人一区二区在线观看| 午夜婷婷国产麻豆精品| 日韩免费观看高清完整版在线观看| 韩国欧美国产1区| 亚洲人xxxx| 欧美一级高清大全免费观看| 波多野洁衣一区| 爽爽淫人综合网网站| 国产日韩精品一区二区三区| 色婷婷一区二区| 精品一区二区三区的国产在线播放| 国产精品久久久久永久免费观看| 欧美裸体一区二区三区| 岛国精品在线观看| 人人狠狠综合久久亚洲| 亚洲乱码日产精品bd| 亚洲精品一区二区三区福利| 欧美性高清videossexo| 国产精品亚洲一区二区三区在线| 亚洲午夜羞羞片| 国产欧美日韩在线观看| 欧美一区二区三区在线观看| 国产69精品久久久久777| 免费精品视频在线| 亚洲乱码一区二区三区在线观看| 久久久国产一区二区三区四区小说 | 精品一区二区三区的国产在线播放| 综合电影一区二区三区 | 2021久久国产精品不只是精品| 成人精品鲁一区一区二区| 蜜桃视频在线一区| 亚洲一区二区三区精品在线| 国产精品国产成人国产三级| 久久伊人蜜桃av一区二区| 日韩欧美中文字幕制服| 欧美群妇大交群中文字幕| 欧洲精品中文字幕| 91在线高清观看| 成人午夜av影视| 国产成人欧美日韩在线电影| 麻豆国产一区二区| 麻豆一区二区三| 毛片av一区二区三区| 老司机精品视频在线| 欧美aaaaaa午夜精品| 日韩中文字幕不卡| 午夜在线成人av| 亚洲国产日韩精品| 亚洲福利视频三区| 午夜国产精品影院在线观看| 亚洲不卡一区二区三区| 日韩福利视频网| 日韩成人免费看| 免费成人av在线| 极品少妇xxxx精品少妇| 国产专区欧美精品| 国产高清精品网站| 粉嫩高潮美女一区二区三区 | 中文字幕精品三区| 国产精品久久久久久亚洲伦 | 亚洲伊人色欲综合网| 亚洲精品高清在线| 亚洲影院理伦片| 偷拍与自拍一区| 激情小说欧美图片| 床上的激情91.| 91在线视频播放| 欧美日韩1区2区| 精品国产乱码久久久久久老虎| 久久人人97超碰com| 国产精品不卡视频| 三级在线观看一区二区| 韩国在线一区二区| 国产宾馆实践打屁股91| 日本高清不卡一区| 亚洲色图欧洲色图| 婷婷国产v国产偷v亚洲高清| 国产一区不卡视频| 91玉足脚交白嫩脚丫在线播放| 欧美精品精品一区| 久久精品日韩一区二区三区| 亚洲精品视频在线观看免费| 午夜免费久久看| 国产精品亚洲第一区在线暖暖韩国| 成人av电影免费在线播放| 3d动漫精品啪啪| 亚洲视频你懂的| 韩国成人福利片在线播放| 在线观看视频一区|