⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 display.c

📁 nsga2具体算法代码,用来多目标遗传算法的学习和研究
💻 C
字号:
/* Routines to display the population information using gnuplot */# include <stdio.h># include <stdlib.h># include <math.h># include <string.h># include <unistd.h># include "global.h"# include "rand.h"/* Function to display the current population for the subsequent generation */void onthefly_display (population *pop, FILE *gp, int ii){    int i;    int flag;    FILE *fpt;    fpt = fopen("plot.out","w");    flag = 0;    for (i=0; i<popsize; i++)    {        if (pop->ind[i].constr_violation==0)        {            if (choice!=3)                fprintf(fpt,"%e\t%e\n",pop->ind[i].obj[obj1-1],pop->ind[i].obj[obj2-1]);            else                fprintf(fpt,"%e\t%e\t%e\n",pop->ind[i].obj[obj1-1],pop->ind[i].obj[obj2-1],pop->ind[i].obj[obj3-1]);            fflush(fpt);            flag = 1;        }    }    if (flag==0)    {        printf("\n No feasible soln in this pop, hence no display");    }    else    {        if (choice!=3)            fprintf(gp,"set title 'Generation #%d'\n unset key\n plot 'plot.out' w points pointtype 6 pointsize 1\n",ii);        else            fprintf(gp,"set title 'Generation #%d'\n set view %d,%d\n unset key\n splot 'plot.out' w points pointtype 6 pointsize 1\n",ii,angle1,angle2);        fflush(gp);    }    fclose(fpt);    return;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -