-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.tex
More file actions
260 lines (194 loc) · 8.16 KB
/
README.tex
File metadata and controls
260 lines (194 loc) · 8.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
\documentclass[12pt]{article}
\usepackage{ragged2e} % load the package for justification
\usepackage{hyperref}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{fadings}
\usepackage{filecontents}
\usepackage{multirow}
\usepackage{amsmath}
\pgfplotsset{width=10cm,compat=1.17}
\setlength{\parskip}{0.75em} % Set the space between paragraphs
\usepackage{setspace}
\setstretch{1.2} % Adjust the value as per your preference
\usepackage[margin=2cm]{geometry} % Adjust the margin
\setlength{\parindent}{0pt} % Adjust the value for starting paragraph
\usetikzlibrary{arrows.meta}
\usepackage{mdframed}
\usepackage{float}
\usepackage{hyperref}
% to remove the hyperline rectangle
\hypersetup{
colorlinks=true,
linkcolor=black,
urlcolor=blue
}
\usepackage{xcolor}
\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{listings}
\usepackage{tcolorbox}
\usepackage{lipsum} % Example text package
\usepackage{fancyhdr} % Package for customizing headers and footers
% Define the orange color
\definecolor{myorange}{RGB}{255,65,0}
% Define a new color for "cherry" (dark red)
\definecolor{cherry}{RGB}{148,0,25}
\definecolor{codegreen}{rgb}{0,0.6,0}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Apply the custom footer to all pages
\pagestyle{fancy}
% Redefine the header format
\fancyhead{}
\fancyhead[R]{\textcolor{orange!80!black}{\itshape\leftmark}}
\fancyhead[L]{\textcolor{black}{\thepage}}
% Redefine the footer format with a line before each footnote
% Redefine the footnote rule
\renewcommand{\footnoterule}{\vspace*{-3pt}\noindent\rule{0.0\columnwidth}{0.4pt}\vspace*{2.6pt}}
% Set the header rule color to orange
\renewcommand{\headrule}{\color{orange!80!black}\hrule width\headwidth height\headrulewidth \vskip-\headrulewidth}
% Set the footer rule color to orange (optional)
\renewcommand{\footrule}{\color{black}\hrule width\headwidth height\headrulewidth \vskip-\headrulewidth}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set the color for the section headings
\titleformat{\section}
{\normalfont\Large\bfseries\color{orange!80!black}}{\thesection}{1em}{}
% Set the color for the subsection headings
\titleformat{\subsection}
{\normalfont\large\bfseries\color{orange!80!black}}{\thesubsection}{1em}{}
% Set the color for the subsubsection headings
\titleformat{\subsubsection}
{\normalfont\normalsize\bfseries\color{orange!80!black}}{\thesubsubsection}{1em}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set the color for the table of contents
\titlecontents{section}
[1.5em]{\color{orange!80!black}}
{\contentslabel{1.5em}}
{}{\titlerule*[0.5pc]{.}\contentspage}
% Set the color for the subsections in the table of contents
\titlecontents{subsection}
[3.8em]{\color{orange!80!black}}
{\contentslabel{2.3em}}
{}{\titlerule*[0.5pc]{.}\contentspage}
% Set the color for the subsubsections in the table of contents
\titlecontents{subsubsection}
[6em]{\color{orange!80!black}}
{\contentslabel{3em}}
{}{\titlerule*[0.5pc]{.}\contentspage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% set a format for the codes inside a box with C format
\lstset{
language=C,
basicstyle=\ttfamily,
backgroundcolor=\color{blue!5},
keywordstyle=\color{blue},
commentstyle=\color{codegreen},
stringstyle=\color{red},
showstringspaces=false,
breaklines=true,
frame=single,
rulecolor=\color{lightgray!35}, % Set the color of the frame
numbers=none,
numberstyle=\tiny,
numbersep=5pt,
tabsize=1,
morekeywords={include},
alsoletter={\#},
otherkeywords={\#}
}
%\input listings.tex
% Define a command for inline code snippets with a colored and rounded box
\newtcbox{\codebox}[1][gray]{on line, boxrule=0.2pt, colback=blue!5, colframe=#1, fontupper=\color{cherry}\ttfamily, arc=2pt, boxsep=0pt, left=2pt, right=2pt, top=3pt, bottom=2pt}
\tikzset{%
every neuron/.style={
circle,
draw,
minimum size=1cm
},
neuron missing/.style={
draw=none,
scale=4,
text height=0.333cm,
execute at begin node=\color{black}$\vdots$
},
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define a new tcolorbox style with default options
\tcbset{
myboxstyle/.style={
colback=orange!10,
colframe=orange!80!black,
}
}
% Define a new tcolorbox style with default options to print the output with terminal style
\tcbset{
myboxstyleTerminal/.style={
colback=blue!5,
frame empty, % Set frame to empty to remove the fram
}
}
\mdfdefinestyle{myboxstyleTerminal1}{
backgroundcolor=blue!5,
hidealllines=true, % Remove all lines (frame)
leftline=false, % Add a left line
}
\begin{document}
\justifying
\begin{center}
\textbf{{\large Assignment 2}}
\textbf{Developing a Basic Genetic Optimization Algorithm in C}
Vineet Aggarwal
\end{center}
\section{Introduction}
\begin{table}[h!]
\caption{Results with Crossover Rate = 0.5 and Mutation Rate = 0.05}
\label{table:1}
\centering
\begin{tabular}{c c c c c c}
\hline
Pop Size & Max Gen & \multicolumn{3}{c}{Best Solution} & CPU time (Sec) \\
& & $x_1$ & $x_2$ & Fitness & \\
\hline
10 & 100 & 0.051087 &0.000000 &0.212513 &0.000981\\
100 & 100 &0.027090 &0.000000 &0.096044 &0.003569\\
1000& 100 &0.001361 &0.000000 &0.003899 &0.024140\\
10000& 100 &0.000273 &0.000000 &0.000775 &0.204705\\
\hline
1000 & 1000 &0.004293 &0.000000 &0.012634 &0.316843\\
1000 & 10000 &0.001085 &0.000000 &0.003100 &2.616101\\
1000& 100000 &0.000980 &0.000822 &0.003661 &25.767036\\
1000& 1000000 &0.000025 &0.000096 &0.000096 &267.165445\\
\hline
\end{tabular}
\end{table}
\begin{table}[h!]
\caption{Results with Crossover Rate = 0.5 and Mutation Rate = 0.2}
\label{table:1}
\centering
\begin{tabular}{c c c c c c}
\hline
Pop Size & Max Gen & \multicolumn{3}{c}{Best Solution} & CPU time (Sec) \\
& & $x_1$ & $x_2$ & Fitness & \\
\hline
10 & 100 & 0.060030 & 0.063430 & 0.448721 &0.000400 \\
100 & 100 & 0.024239 & 0.023201 & 0.121000 &0.002543\\
1000& 100 &0.022354 &0.082469 &0.46394 &0.034303\\
10000& 100 &0.007965 &0.013263 &0.043277 &0.236576\\
\hline
1000 & 1000 &0.005743 &0.005942 &0.023440 &0.251751\\
1000 & 10000 &0.000643 &0.000497 &0.002473 &2.563443\\
1000& 100000 &0.000796 &0.000198 &0.002643 &24.984203\\
1000& 1000000 &0.000256 &0.000190 &0.000810 &256.206210\\
\hline
\end{tabular}
\end{table}
\subsection{Report and \codebox{Makefile} (3 points)}
To run the makefile, you have to first make sure that it is installed in the terminal, and if not follow the prompts to install it. After that, you can type "make" into the terminal to run it. You can use "make clean" to reset everything and use "make" again to run it. This Makefile is a set of instructions for the make build automation tool to compile a C program. Here's a concise explanation:
The variables are defined at the beginning, where CC is the compiler (gcc), CFLAGS are the compilation flags (including -Wall, -Wextra, and -std=c99), SOURCES lists the source code files, OBJECTS specifies the corresponding object files, EXECUTABLE is the name of the final executable, and LIBS includes the math library (-lm).
The default target is all, which depends on the (EXECUTABLE) target. The "(EXECUTABLE)" target, in turn, depends on the (OBJECTS) target. The rule for creating the executable specifies that it should be built using the specified compiler ((CC)) and linked with the object files and libraries.
The next rule, .o: .c, is a pattern rule for building object files from C source files. It compiles each source file using the compiler and flags defined earlier.
The clean target is defined to remove the compiled object files and the executable when executed.
In summary, this Makefile automates the compilation process of a C program by specifying rules for compiling source files, linking object files, and cleaning up generated files. The make tool uses these rules to determine what needs to be rebuilt based on dependencies and timestamps.\\
...
\end{document}