📄 manual.tex
字号:
\documentclass [a4paper] {report} \author{Johan Carlsson (johanc@ida.his.se) \\ Department of computer science \\ University of Sk鰒de}\begin{document} \chapter{OptANN}The name says it all.\section {Description}The OptANN simulator, which name maybe is the first thing we shall start with to explain, is a Khepera robots simulator meant to be very fast. So fast that it is suitable for using when running experiments with genetic algorithms in combination with artifical neural nets. The Khepera robot is a small round robot (about 55 mm in diameter) driven by two motors. It is equipped with eight infrared approximate sensors used for sensing it's environment. \section {Implementation}The most exact way of implementing the simulation of one or several Khepera robots is of course to use a pure mathematical model. However it might be the most exact model but not the fastest. And speed is a very important factor when dealing with GA. For example, a typical GA run goes on for 1000 generations, every generation might have 100 individuals (a common population size), every individual is tested for 200 timesteps under a typical of 3 epochs (with different start positions for every epoch). This give us a simulation run of $s(t) = Generations * Individuals * Timesteps * Epochs$ that is $s(t) = 1,000*100*200*3 = 60,000,000$ timesteps. As we rather quickly understand simulating 60 million timesteps takes a lot of time if we are going to use a mathematical model. So instead of spending valuable processor time for each time step to calculate the sensor activation for each robot sensor we have to approximate the sensor value in a faster way. This can be done by making prerecordings of the sensor values of all objects in a simulated world from a real world and robot. Which we later can use to recreate sensor values for the robot in a situation of the simulation. Stefano Nolfi showed that if you record an object with different relative angles and distances of a object - you can use these recordings to recreate a state in a simulated environment. He showed this with a khepera simulator written by him and some coworkers - after they had evolved the weights for an ANN in the simulated world they transfered it back to the real robot and demonstrated that the same network worked in the real world.We uses the same techique in OptANN to create sensor values for the robot and thus speeds up the simulation drastically as generating sensor values now only include some table lookups.\section{The name}What does the name mean? Opt gives us some hints that it might mean optimal, but optimal ANN isn't that a little to much to claim? Well Opt does stand for optimal but not in the meaning mentioned - under the development of the simulator there were several parallell branches the one singled out was moved to the catalog name optann. And that's was how the simulator got a name.\chapter{Building} sem\_init not found\section{Requirements} The simulator requires the following libraries to be installed on the system that will be used to run the simulator.\begin{description} \item [GTK] Is used for the graphical interface (GUI) all buttons and menues are implemented using GTK. Documention of GTK and the libraries themself can be found at http://www.gtk.org. \item [Xlib] GTK depends on it, and all our simulation windows with graphical output uses raw X11 (Xlib). \item [optional libGGI] You can if you want use GGI (General Graphics Interface) for the simulator output instead of raw X11 (can be faster if the Xserver and Xclient is on the same machine).\end{description}These requirements also have dependencies which must be met, but it is outside the scope of this document.\section{Makefile}You have the options build a set of different simulator variants, which differs in how the main loop is constructed and if there should be a graphical X11 interface.The different variants are:\begin{description}\item [sim] Builds the simulator without any graphical X11 interface, uses sim.c as main loop.\item [gsim] Build the simulator with X11 interface, also uses sim.c as main loop. Defines GUI, the g in gsim stands for graphical.\item [tsim] This is a variant of gsim where we demonstrates the creation of a SCN (Second Order Network), the creation of the network occurs in simt.c . The t stands for dr. Tom Ziemke who works at our department (my boss).\item [csim] Clean sim, says it all. A clean simc.c file where we dont uses the GA and ANN classes at all. If you have plan to use your own ANN implementation or controller - I recommend that you use this file as a template.\end{description}\chapter{Main loop}This chapter will try to explain where the main loop occures within the simulator. We will also explain how the simulation works and where you should look if you want to modify different aspects of the simulation.\section{File description}We begin with describing what the different files implements.\begin{description} \item[ann.cc] ANN class uses the Neuron class.\item[buildn.c] Builds the network that will be used in the simulator.\item[csim.c] Includes main loop without GA and ANN.\item[environ.cc] Implements the world, uses all object classes and the robot class.\item[ga.cc] GA class uses the ANN class.\item[geom.c] Geometry functions used in the simulator.\item[gripperrobot.cc] Subclass to robot, implements the gripper.\item[gui.c] The control buttons and menus in the GUI.\item[light.cc] Implements the light object.\item[monitor.cc] Monitor class for graphical monitoring of values, uses the value class.\item[motor.cc] Gives the robot the prerecorded values for different motor activations.\item[neuron.cc] Neuron class the base component of an ANN.\item[obst.cc] Implements static round objects.\item[param.c] Used by the main routine to parse optionfile.\item[real.cc] Used by the main routine to run a real robot over a serial line.\item[robot.cc] The super class of the robot, uses motor.\item[sim.c] The standard main routine for both with and without GUI.\item[simt.c] A standard main routine which implements second order networks.\item[sobst.cc] Implements dynamic round objects.\item[test.opt] A sample option file for the simulator.\item[value.cc] Value class for monitoring.\item[wall.cc] Implements wall objects.\item[zone.cc] Implements zones for the world.\end{description}\section{The main file - sim.c}This file is the most commented of all the code files. The reason being is that it's here were the main loop of the simulation occurs. The best way to understand how to add features or change mechanisms in the simulation is by starting to read the source in main.c. The sim.c file maps the GA (Genetic Algorithm) and the ANN to the world with the robot(s). \end{document}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -