gabincvt.h

来自「这是一个面向对象的GA遗传算法库GAlib: A C++ Library of 」· C头文件 代码 · 共 39 行

H
39
字号
// $Header$/* ----------------------------------------------------------------------------  bincvt.h  mbwall 29jun95  Copyright (c) 1995 Massachusetts Institute of Technology                     all rights reserved DESCRIPTION:  Header for the binary to decimal conversion routines.  The binary-to-decimalroutines include encoders and decoders.  We define a standard binary encoder/decoder set as well as one Gray encoder/decoder.  You can define your own ifyou want a different Gray coding.---------------------------------------------------------------------------- */#ifndef _ga_bincvt_h_#define _ga_bincvt_h_#include <ga/gatypes.h>// The encoder converts a decimal value into a binary string.  The decoder// converts a string of bits into a decimal value.  Both types of functions// return an error code to indicate whether or not the conversion was // successful.  The caller must make sure that sufficient space is available// for the arguments.  The encoder will set the value to whatever it was able// to encode, so be sure to check the return status and make your value such// that you can check it if you get a non-zero return code.typedef int (*GABinaryEncoder)(float& value, GABit* bits,			       unsigned int nbits, float min, float max);typedef int (*GABinaryDecoder)(float& value, const GABit* bits,			       unsigned int nbits, float min, float max);int GABinaryEncode(float&, GABit* bits, unsigned int, float, float);int GABinaryDecode(float&, const GABit* bits, unsigned int, float, float);int GAGrayEncode(float&, GABit* bits, unsigned int, float, float);int GAGrayDecode(float&, const GABit* bits, unsigned int, float, float);#endif

⌨️ 快捷键说明

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