亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? sga-c.tex

?? 二進(jìn)制的基本遺傳算法
?? TEX
字號(hào):
\documentstyle[apaua]{article}
\pagestyle{empty}

\oddsidemargin=0in
\evensidemargin=0in
\topmargin=0.5in
\textheight=9in
\textwidth=6.5in 
\footheight=0in
\columnsep=0.25in
\headsep=0in
\headheight=0in

\def\btt#1{\bf{\tt #1}}

\begin{document}
\bibliographystyle{apaua}

\begin{titlepage}
\begin{center}
\vspace*{2.35in}
SGA-C: A C-language Implementation \\ 
of a Simple Genetic Algorithm
\ \\
by\\
\ \\
Robert E. Smith\\
The University of Alabama\\
\ \\ 
David E. Goldberg\\
The University of Illinois\\
and\\
Jeff A. Earickson\\
Alabama Supercomputer Network\\
\vspace{0.7in}
TCGA Report No. 91002\\
\today \\
\vspace{2.2in}
The Clearinghouse for Genetic Algorithms\\
The University of Alabama\\
Department of Engineering Mechanics\\
Tuscaloosa, AL 35487
\end{center}
\end{titlepage}


\title{SGA-C: A C-language Implementation of a\\ 
Simple Genetic Algorithm}
\author{{\bf Robert E. Smith}\\
The University of Alabama\\
Department of Engineering Mechanics\\
Tuscaloosa, Alabama 35405 
\and {\bf David E. Goldberg}\\
The University of Illinois\\
Department of General Engineering\\
Urbana, Illinois 61801
\and {\bf Jeff A. Earickson}\\
Alabama Supercomputer Network\\
The Boeing Company\\
Huntsville, Alabama 35806}
\maketitle

\section{Introduction}
SGA-C\footnote{{\bf Disclaimer:} SGA-C is distributed under the terms described
in the file {\btt{NOWARRANTY}}. These terms are taken from the GNU General Public
License.
This means that SGA-C has no warranty implied or given, and that the
authors assume no liability for damage resulting from its use or misuse.} 
is a C-language translation and extension of the original
Pascal SGA code presented by Goldberg \citeyear{Goldberg:89e}. 
It has some additional features, but its
operation is 
essentially the same as that of the original, Pascal version. 
This report is included as a concise introduction to the SGA-C distribution.
It is presented with the assumptions that the reader has a general understanding
of Goldberg's original Pascal SGA code, and a good working knowledge of the
C programming language.
The report begins with an outline of the files included in the SGA-C
distribution, and the routines they contain. 
The outline is followed by a discussion of significant features of SGA-C
that differ from those of the Pascal version.
The report concludes with a
discussion of routines that must be altered to
implement one's own application in SGA-C.


\section{Files Distributed with SGA-C}
\label{files}
The following is an outline of the files distributed 
with SGA-C, the routines contained in those files, and the
{\btt{include}} structure of the SGA-C distribution.
\begin{description}
\item[{\btt{sga.h}}] contains declarations of global variables and structures 
for SGA-C.  This file is included by {\btt{main()}}.
Both {\btt{sga.h}} and {\btt{external.h}} have two
{\btt{defines}} set at the top of the files; {\btt{LINELENGTH}}, which determines the
column width of printed output, and {\btt{BITS\_PER\_BYTE}}, which specifies the number
of bits per byte on the machine hardware.  {\btt{LINELENGTH}} can be set to any
desired positive value, but {\btt{BITS\_PER\_BYTE}} must be set to the correct value for your
hardware.
\item[{\btt{external.h}}] contains external declarations for inclusion
in all source code files except {\btt{main()}}.  The {\bf extern} declarations in {\btt{external.h}}
should match the declarations 
in {\btt{sga.h}}.
\item[{\tt main.c}] contains the main SGA program loop, 
{\btt{main()}}.
\item[{\btt{generate.c}}] contains {\btt{generation()}}, a routine which generates and 
evaluates a new GA population.  
\item[{\btt{initial.c}}] contains routines that are called at the beginning 
of a GA run.
\begin{description}
\item[{\btt{initialize()}}] is the central initialization routine called by 
{\btt{main()}}.
\item[{\btt{initdata()}}] is a routine to prompt the user for SGA parameters.
\item[{\btt{initpop()}}] is a routine that generates a random population. Currently, 
SGA-C includes no facility for using seeded populations.
\item[{\btt{initreport()}}] is a routine that prints a report after initialization 
and before the first GA cycle.
\end{description}
\item[{\btt{memory.c}}] contains routines for dynamic memory management.  
\begin{description}
\item[{\btt{initmalloc()}}] is a routine that dynamically allocates space for the GA 
population and other necessary data structures.
\item[{\btt{freeall()}}] frees all memory allocated by {\btt{initmalloc()}}.
\item[{\btt{nomemory()}}] prints out a warning statement
when a call to {\btt{malloc()}} fails.
\end{description}
\item[{\btt{operators.c}}]  contains the routines for genetic operators.
\begin{description}
\item[{\btt{crossover()}}] performs single-point crossover on two mates, producing
two children.
\item[{\btt{mutation()}}] performs a point mutation.
\end{description}
\item[{\btt{random.c}}] contains random number utility programs, including:
\begin{description}
\item[{\btt{randomperc()}}] returns a single, uniformly-distributed, real, 
pseudo-random number between 0 and 1. 
This routine uses the subtractive method specified by Knuth \citeyear{Knuth:81}.
\item[{\btt{rnd(low,high)}}] returns an uniformly-distributed integer between 
{\btt{low}} and {\btt{high}}.
\item[{\btt{rndreal(low,high)}}] returns an uniformly-distributed floating point number 
between  {\btt{low}} and {\btt{high}}.
\item[{\btt{flip(p)}}] flips a biased coin, returning 1 with probability {\btt{p}}, 
and 0 with probability {\btt{1-p}}.
\item[{\btt{advance\_random()}}] generates a new batch of 55 random numbers.
\item[{\btt{randomize()}}] asks the user for a random number seed.
\item[{\btt{warmup\_random()}}] primes the random number generator.
\item[{\btt{noise(mu, sigma)}}] generates a normal random variable 
with mean mu and standard
deviation sigma.  This routine is not currently used in SGA-C, and is only included as a general utility.
\item[{\btt{randomnormaldeviate()}}] is a utility routine used by noise.
It computes a standard normal random variable.
\item[{\btt{initrandomnormaldeviate()}}] initialization routine for
{\btt{randomnormaldeviate()}}.
\end{description}
\item[{\btt{report.c}}] contains routines used to print a report from each cycle of SGA-C's operation.
\begin{description}
\item[{\btt{report()}}] controls overall reporting.
\item[{\btt{writepop()}}] writes out the population at every generation.
\item[{\btt{writechrom()}}] writes out the chromosome as a string of ones and zeroes.
In the current implementation, the most significant bit is the {\it rightmost} bit.
\end{description}
\item Three selection routines are included with the SGA-C distribution:
\begin{description}
\item[{\btt{rselect.c}}] contains routines for roulette-wheel selection.  
\item[{\btt{srselect.c}}] contains the routines for stochastic-remainder selection 
\cite{Booker:82}.
\item[{\btt{tselect.c}}] contains the routines for tournament selection 
\cite{Brindle:81a}.  Tournaments of any size up to the population size can be held
with this implementation\footnote{The tournament selection routine
included with the distribution was written by Hillol Kargupta, of the University
of Alabama.}.
\end{description}
For modularity, each selection method 
is made available as a compile time option.
Edit {\btt{Makefile}} to choose a selection method. Each of the three
selection files 
contains the routines
{\btt{select\_memory}} and {\btt{select\_free}} (called by {\btt{initmalloc}} and {\btt{freeall}}, respectively), which perform
any necessary auxiliary memory handling,
and the routines {\btt{preselect()}} and {\btt{select()}}, 
which implement the particular selection method.
\item[{\btt{stats.c}}] contains the routine {\btt{statistics()}}, which calculates 
populations statistics for each generation.
\item[{\btt{utility.c}}] contains various utility routines. Of particular interest 
is the routine {\btt{ithruj2int()}}, which returns bits $i$ through $j$ of a 
chromosome interpreted as an {\btt{int}}. 
\item[{\btt{app.c}}] contains application dependent routines. 
Unless you need to change the basic operation of the GA itself, 
you should only have to alter this file
Further instructions for altering the SGA application are 
included in section~\ref{app}.
\begin{description}
\item[{\btt{application()}}] should contain any application-specific computations
needed before each GA cycle.  It is called by {\btt{main()}}.
\item[{\btt{app\_data()}}] should ask for and read in any application-specific 
information.  This routine is 
called by {\btt{init\_data()}}.
\item[{\btt{app\_malloc()}}] should perform any application-specific calls to 
{\btt{malloc()}} to dynamically allocate memory.  This routine is 
called by {\btt{initmalloc()}}.
\item[{\btt{app\_free()}}]  should perform any application-specific calls to 
{\btt{free()}}, for release of dynamically allocated memory.  
This routine is called by {\btt{freeall()}}.
\item[{\btt{app\_init()}}] should perform any application-specific initialization
needed.  It is called by {\btt{initialize()}}.
\item[{\btt{app\_initreport()}}] should print out an application-specific initial
report before the start of generation cycles.  This routine is 
called by {\btt{initialize()}}.
\item[{\btt{app\_report()}}]  should print out any application-specific  
output 
after each GA cycle.  It is called by {\btt{report()}}.
\item[{\btt{app\_stats()}}]  should perform any application-specific statistical
calculations.  It is called by {\btt{statistics()}}.
\item[{\btt{objfunc(critter)}}]  The objective function for the specific application.
The variable {\btt{critter}} is a pointer to an {\btt{individual}} 
(a GA population member), to which this routine must assign a fitness.
This routine is called by {\btt{generation()}}.
\end{description}
\item[{\btt{Makefile}}] is a UNIX makefile for SGA-C.  
\end{description}

\section{New Features of SGA-C}
SGA-C has several features that differ from those of the Pascal version.
One is the ability to name the input and output files on the command line, i.e.
{\btt{sga my.input my.output}}.  If either of these files is not named on the command line, 
SGA-C assumes 
{\btt{stdin}} and {\btt{stdout}}, respectively.  
Another new feature of SGA-C is its method of representing
chromosomes in memory.
SGA-C stores its chromosomes in bit strings at the machine level. 
Input-output and chromosome storage in SGA-C are discussed in the following sections.

\subsection{Input-Output}
SGA-C allows for multiple GA runs.
When the program is executed, the user is first prompted
for the number of GA runs to be
performed.  After this, the quantity of input needed depends on 
the selection routine chosen at compile-time, and any
application-specific information required.  
When compiled
with roulette wheel selection, 
the input requested from the user is as follows:
\begin{itemize}
\item The number of GA runs to be performed ({\btt{int}}).
\item The population size ({\btt{int}}).
\item The chromosome length ({\btt{int}}).
\item Print the chromosome strings each generation ({\btt{y/n}})?
\item The maximum number of generations for the run ({\btt{int}}).
\item The probability of crossover ({\btt{float}}).
\item The probability of mutation ({\btt{float}}).
\item Application-specific input, if any.
\item The seed for the random number generator ({\btt{float}}).
\end{itemize}

\subsection{Chromosome Representation and Memory Utilization}
\label{memstuff}
SGA-C uses a machine level representation of bit strings
to increase efficiency.
This allows crossover and mutation to be implemented 
as binary masking operations (see {\btt{operators.c}}).
Every chromosome (as well as the population arrays and some
auxiliary memory space) are allocated dynamically at run
time. The dynamic memory allocation scheme allocates
a sufficient number of unsigned integers for each population member
to store bits for the user-specified chromosome length. Because
of this feature, it is extremely important that {\btt{BITS\_PER\_BYTE}}
be properly set (in
{\btt{sga.h}} and {\btt{external.h}})
for your machine's hardware and C compiler.

\section{Implementing Application Specific Routines}
\label{app}
To implement a specific application, you should only have to change the file
{\btt{app.c}}.
Section~\ref{files} describes the routines in {\btt{app.c}} in detail.
If you use additional variables for your specific problem, the easiest method
of making them available to other program units is to declare them in 
{\btt{sga.h}} and {\btt{external.h}}.  However, take care that you do not
redeclare existing variables.

Two example applications files are included in the SGA-C distribution.  The
file {\btt{app1.c}} performs the simple example problem 
included with the Pascal version; 
finding the maximum of $x^{10}$, where $x$
is an integer interpretation of a chromosome.  
A slightly more complex 
application 
is include in {\btt{app2.c}}.
This application illustrates two features that have been added
to SGA-C. The first of these is the {\bf ithruj2int} function,
which converts bits $i$ through $j$ in a chromosome to an integer.
The second new feature is the {\bf utility} pointer that is associated with each population member.
The example application interprets each chromosome as a set 
of concatenated integers in binary form. The lengths of these integer fields is 
determined by the user-specified value of {\bf field\_size}, which is 
read in by the function
{\btt{app\_data()}}.  The field size must be less than the smallest of
the chromosome
length and the length of an unsigned integer.  
An integer array for storing the interpreted form of each chromosome
is dynamically allocated and assigned to the chromosome's {\bf utility} pointer
in {\btt{app\_malloc()}}.
The {\btt{ithruj2int}} routine (see {\btt{utility.c}}) is used to translate 
each chromosome into its associated vector.
The fitness for each chromosome is simply the sum of the squares of these 
integers. This example application will function for any chromosome length. 

\section{Final Comments}
SGA-C is intended to be a simple
program for first-time GA experimentation. It is 
not intended to be 
definitive in terms of its efficiency 
or the grace of its implementation. The
authors are interested in the comments, criticisms, and bug reports
from SGA-C users, so that the code can be refined for
easier use in subsequent versions.
Please email your comments to {\bf rob@comec4.mh.ua.edu},
or write to TCGA:
\begin{center}
The Clearinghouse for Genetic Algorithms\\
The University of Alabama\\
Department of Engineering Mechanics\\
P.O. Box 870278\\
Tuscaloosa, Alabama 35487
\end{center}

\subsection*{Acknowledgments}
The authors gratefully acknowledge support provided by NASA under
Grant NGT--50224 and support provided by the 
National Science Foundation under Grant CTS--8451610.
We also thank Hillol Kargupta for donating his tournament selection
implementation.


\bibliography{sga-c}
\end{document}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品久久久蜜桃| 大尺度一区二区| 天天影视涩香欲综合网| 亚洲综合另类小说| 亚洲一区二区三区在线播放| 亚洲人成网站色在线观看| 亚洲欧洲成人精品av97| 国产精品欧美一区喷水| 亚洲欧洲性图库| 亚洲日本护士毛茸茸| 又紧又大又爽精品一区二区| 亚洲乱码国产乱码精品精可以看| 1区2区3区国产精品| 有坂深雪av一区二区精品| 亚洲国产一区二区在线播放| 亚洲一区二区三区中文字幕 | 九色|91porny| 国内精品视频666| 国产一区二区美女诱惑| 国产成人精品免费看| 波多野洁衣一区| 欧美体内she精高潮| 欧美日韩国产小视频在线观看| 欧美系列一区二区| 日韩视频永久免费| wwwwxxxxx欧美| 国产精品国产三级国产普通话三级 | 日本精品免费观看高清观看| 91高清视频在线| 7777精品久久久大香线蕉| 日韩欧美成人一区二区| 国产色产综合色产在线视频| 亚洲私人黄色宅男| 五月天国产精品| 国产一区视频导航| 99国产精品国产精品毛片| 欧美美女一区二区| 精品国内片67194| 国产精品九色蝌蚪自拍| 亚洲成人免费视| 经典三级视频一区| 99国产精品久久久久久久久久 | 精品国产免费视频| 中文字幕一区二区三中文字幕| 亚洲一区av在线| 国产一区二区美女| 在线看日本不卡| 精品久久五月天| 亚洲素人一区二区| 蜜桃传媒麻豆第一区在线观看| 国产精品自在在线| 在线免费观看成人短视频| 日韩欧美国产综合一区 | 亚洲一区二区五区| 国产一区二区福利视频| 在线日韩一区二区| 国产三区在线成人av| 亚洲香肠在线观看| 国产一区二区在线看| 在线观看www91| 国产亚洲女人久久久久毛片| 一区二区久久久久久| 国产精品中文字幕日韩精品| 欧美色国产精品| 欧美韩国一区二区| 免费成人在线播放| 欧洲一区二区三区在线| 国产视频911| 日韩成人午夜精品| 色综合久久综合网| 久久久久成人黄色影片| 视频一区在线视频| 色婷婷国产精品| 久久久不卡影院| 久久精品国产精品亚洲精品| 色94色欧美sute亚洲13| 国产女主播视频一区二区| 男人的j进女人的j一区| 欧洲另类一二三四区| 国产精品色噜噜| 国产精品一区二区在线播放| 日韩视频在线永久播放| 亚洲午夜在线视频| 不卡高清视频专区| 国产午夜精品福利| 久久99国产乱子伦精品免费| 欧美日韩在线不卡| 亚洲一区二区三区四区中文字幕| 成人av资源在线观看| 国产欧美日韩麻豆91| 国产精品综合二区| 精品久久久久一区二区国产| 毛片不卡一区二区| 欧美一区二区三区影视| 日韩电影在线观看网站| 欧美肥大bbwbbw高潮| 亚洲成人激情自拍| 欧美日韩三级在线| 亚洲福利视频一区二区| 色婷婷久久久综合中文字幕| 亚洲欧美电影院| 色av成人天堂桃色av| 亚洲乱码一区二区三区在线观看| 成人综合婷婷国产精品久久蜜臀| 久久免费视频一区| 岛国av在线一区| 中文字幕精品一区二区精品绿巨人| 国产乱子轮精品视频| 国产女人18毛片水真多成人如厕| 国产一区二区三区在线观看免费| 日韩精品一区二区三区视频播放| 免费三级欧美电影| 2020国产精品自拍| 国产精品一区二区免费不卡 | 图片区日韩欧美亚洲| 亚洲欧美在线观看| 色天使久久综合网天天| 亚洲国产综合在线| 正在播放亚洲一区| 蜜臀国产一区二区三区在线播放| 欧美成人aa大片| 国产91对白在线观看九色| 欧美经典一区二区| 色综合中文综合网| 欧洲日韩一区二区三区| 亚洲18女电影在线观看| 日韩一区二区三区免费观看| 国产精品自拍av| 最新久久zyz资源站| 欧美怡红院视频| 久久丁香综合五月国产三级网站| 久久久久久久久久久久久女国产乱| 国产超碰在线一区| 一区二区免费在线| 日韩午夜中文字幕| 国产成人免费视频精品含羞草妖精 | 99久久婷婷国产综合精品| 亚洲免费色视频| 欧美一级片免费看| 国产一区二区在线观看免费| 综合电影一区二区三区 | 国产91露脸合集magnet| 一区精品在线播放| 欧美三级韩国三级日本三斤| 蜜臀久久99精品久久久久久9| 久久嫩草精品久久久久| 91亚洲国产成人精品一区二区三| 午夜不卡av在线| 国产片一区二区| 色综合色综合色综合| 老司机午夜精品| 亚洲男同1069视频| 欧美大片在线观看| 色噜噜久久综合| 久久99精品一区二区三区| 最新国产成人在线观看| 日韩美女一区二区三区四区| 色综合久久综合| 国产综合色产在线精品| 亚洲午夜久久久久中文字幕久| 2020国产精品自拍| 欧美日韩一区二区在线观看| 国产成人在线看| 午夜欧美电影在线观看| 国产精品美女久久久久久久网站| 91精品国产欧美一区二区18| 一本色道亚洲精品aⅴ| 国产精品一二二区| 日产国产高清一区二区三区 | hitomi一区二区三区精品| 日本亚洲一区二区| 一区二区三区在线视频免费观看| 久久久久久影视| 欧美一区日韩一区| 色婷婷综合久久久中文字幕| 国产成人啪午夜精品网站男同| 无码av中文一区二区三区桃花岛| 日韩理论片一区二区| 久久色成人在线| 91精品一区二区三区在线观看| 91麻豆国产福利精品| 高清不卡在线观看| 精品在线免费视频| 日本成人在线电影网| 亚洲一区二区三区视频在线播放| 久久久精品国产免费观看同学| 91精品国产综合久久久久久久久久 | 亚洲大尺度视频在线观看| 亚洲欧洲精品成人久久奇米网| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 激情五月播播久久久精品| 五月综合激情婷婷六月色窝| 亚洲激情第一区| 国产精品久久久久aaaa樱花| 久久综合九色综合97_久久久| 7777精品伊人久久久大香线蕉最新版| 一本久久精品一区二区| 91网站最新地址| 成人av资源在线观看| 粉嫩av一区二区三区|