- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
**************************************************************
/* This is a simple genetic algorithm implementation where the */ /* evaluation function takes positive values only and the */
/* fitness of an individual is the same as the value of the */ /* objective function */
/***************************************************************/
#include stdio.h
#include stdlib.h
#include math.h
/* Change any of these parameters to match your needs */
#define POPSIZE 50#define MAXGENS 1000#define NVARS 3#define PXOVER 0.8#define PMUTATION
#define POPSIZE 50
#define MAXGENS 1000
#define NVARS 3
#define PXOVER 0.8
#define PMUTATION 0.15
#define TRUE 1
#define FALSE 0
int generation;
int cur_best;
FILE *galog;
/* population size */
/* max. number of generations */
/* no. of problem variables */
/* probability of crossover */
/* probability of mutation */
/* current generation no. */
/* best individual */
/* an output file */
struct genotype /* genotype (GT), a member of the population */
double gene[NV ARS];/* a string of variables */double fitness;/* GTs fitness */double upper[NV ARS];/* GTs variables upper bound */
double gene[NV ARS];
/* a string of variables */
double fitness;
/* GTs fitness */
double upper[NV ARS];
/* GTs variables upper bound */
double lower[NV ARS];
/* GTs variables lower bound */
double rfitness;
/* relative fitness */
double cfitness;
/* cumulative fitness */
};
struct genotype population[POPSIZE+1]; /* population */
struct genotype newpopulation[POPSIZE+1]; /* new population; */
/* replaces the */ /* old generation */
/* Declaration of procedures used by this genetic algorithm */ void initialize(void);
double randval(double, double);
void evaluate(void);
void keep_the_best(void);
void elitist(void);
void select(void);
void crossover(void);
void Xover(int,int);
void swap(double *,double *);
void mutate(void);
void report(void);
*************************************************************
/* Initialization function: Initializes the values of gene
您可能关注的文档
- 运用qc方法确定高填方路基试验段施工.docx
- 运用qc方法提高班组人员业务水平.docx
- 运用qc方法控制.docx
- 运水车使用说明书.docx
- 运用qc方法提高成品风管加工制作的质量.docx
- 迷宫游戏c语言程序课程设计.docx
- 迷宫问题源代码.docx
- 迷幻色彩封面模板.docx
- 迷雾灯塔之光.docx
- 追寻红色足迹,肩负青春使命的大学生暑期实践报告.docx
- 基础化工行业深度:3D打印:解锁高端制造的“万能钥匙”.pdf
- 宏观经济专题:黄金价格再度逼近历史最高点.pdf
- 2025全球商务区吸引力报告-经济引擎再思考:全球商务区的演进之路.pdf
- 中央经济工作会议学习体会【2025】.pdf
- 民事答辩状(侵害商业秘密纠纷)(最高院2025版).docx
- 广西岑溪市2024-2025学年八年级上学期期末道德与法试题.docx
- 贵州省六盘水盘州市大象2024-2025学年六年级上册期末考试科学试卷.docx
- 湖南省邵阳市邵东市2025-2026学年九年级上学期10月月考道德与法治试题.docx
- 精品解析: 北京市三帆中学2025-2026学年九年级上学期期中数学试题 (原卷版).docx
- 民事答辩状(侵害发明专利权纠纷)(最高院2025版).docx
最近下载
- 最新国家开放大学电大《公共关系学》机考第二套真题题库及答案.docx VIP
- 2025年广西公需科目第二套答案.docx VIP
- 基于在线评论的用户需求识别及共现分析——以新能源汽车为例.pdf VIP
- PDC钻头工作原理及相关特点.pptx VIP
- 2022-2023学年重庆八中七年级(下)期末数学试卷 (1).doc VIP
- GB50707-2011 河道整治设计规范.docx VIP
- 部编版小学四年级语文上册期末素质试题(含答案).doc VIP
- 2025年清廉学校建设开展情况汇报.docx VIP
- 公共卫生执业医师药理学试题(附答案).docx VIP
- 历久弥新的领导力洞察:BCG《每周简报》五周年特辑.pdf
原创力文档


文档评论(0)