sa.cpp

来自「一个模拟退火算法的改进程序」· C++ 代码 · 共 44 行

CPP
44
字号
// SA.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "ISA.h"

//
//码本大小和阶数
//
#define CB_SIZE 256
#define CB_ORDER 6


int main(int argc, char* argv[])
{

	float coebook_CB[CB_SIZE*CB_ORDER]={0};
	FILE *fp;
	int i;
	int j;


	//SA算法
	SA(coebook_CB);


    //存储码本训练到文件coebook_SA.txt
	fp=fopen("codebook_SA.txt","w");
	for(j = 0; j < CB_SIZE; j++)
	{
		fprintf(fp, "\n");
	    for(i = 0; i < CB_ORDER; i++)
		{
	    	fprintf(fp, "%f, ", *(coebook_CB+j*CB_ORDER+i)); 
		}		
	}
	
	fclose(fp);


	return 0;
}

⌨️ 快捷键说明

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