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

📄 params.c

📁 一遗传算法的例子源程序
💻 C
字号:
#include "lithos.h"

int population = 100;
int maxSize = 1000;
int maxMemory = 1000;
int maxTime = 10000;
int maxMoves = 1000;
int overselectionRate = 2;
int tournamentSize = 4;
int crossoverRate = 50;
int mutationRate = 50;
int autosaveFrequency = 100;
int logFrequency = 1;

void readParameters(FILE *f)
{
	population = readInt(f);
	maxSize = readInt(f);
	maxMemory = readInt(f);
	maxTime = readInt(f);
	maxMoves = readInt(f);
	overselectionRate = readInt(f);
	tournamentSize = readInt(f);
	crossoverRate = readInt(f);
	mutationRate = readInt(f);
	autosaveFrequency = readInt(f);
	logFrequency = readInt(f);
}

void writeParameters(FILE *f)
{
	writeCommentedInt(f, "Population", population);
	writeCommentedInt(f, "Max Size", maxSize);
	writeCommentedInt(f, "Max Memory", maxMemory);
	writeCommentedInt(f, "Max Time", maxTime);
	writeCommentedInt(f, "Max Moves", maxMoves);
	writeCommentedInt(f, "Overselection Rate", overselectionRate);
	writeCommentedInt(f, "Tournament Size", tournamentSize);
	writeCommentedInt(f, "Crossover Rate", crossoverRate);
	writeCommentedInt(f, "Mutation Rate", mutationRate);
	writeCommentedInt(f, "Autosave Frequency", autosaveFrequency);
	writeCommentedInt(f, "Log Frequency", logFrequency);
}

⌨️ 快捷键说明

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