utility.hpp
来自「这是遗传算法的源代码」· HPP 代码 · 共 39 行
HPP
39 行
// -*- c++ -*-//// File: utility.hpp//// Description: utility functions and procedures.//// Author: Fernando Lobo//// Date: June/1999//// Extended to deal with chi-ary problems by Luis de la Ossa// GCC 3.4 and 4 series compliance by Kumara Sastry //// Date: March/2006 #ifndef _utility_hpp#define _utility_hpp#include <stdio.h>#include <fstream>void error( char *msg );void errorcheck( char *str, bool condition );double sqr( double x );double min( double x );int min( int x, int y );int max( int x, int y );long decode( int *vec, int* positions, int length);void encode( int x, int length, int *vec, int* positions);void encodeBinary( int x, int nsymbols, int *vec );double log( double x, double b );void mergeSort( int *A, int sizeA, int *B, int sizeB, int *C );void makeshuffle( int *shufflearray, const int n );#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?