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

📄 eval.c

📁 多目标遗传算法的程序
💻 C
字号:
/* Routine for evaluating population members  */# include <stdio.h># include <stdlib.h># include <math.h># include "global.h"# include "rand.h"/* Routine to evaluate objective function values and constraints for a population */void evaluate_pop (population *pop){    int i;    for (i=0; i<popsize; i++)    {        evaluate_ind (&(pop->ind[i]));    }    return;}/* Routine to evaluate objective function values and constraints for an individual */void evaluate_ind (individual *ind){    int j;    test_problem (ind->xreal, ind->obj, ind->constr);    if (ncon==0)    {        ind->constr_violation = 0.0;    }    else    {        ind->constr_violation = 0.0;        for (j=0; j<ncon; j++)        {            if (ind->constr[j]<0.0)            {                ind->constr_violation += ind->constr[j];            }        }    }    return;}

⌨️ 快捷键说明

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