SlideShare a Scribd company logo
1 of 12
Download to read offline
Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan.
Contents
Introduction..........................................................................................................................................2
Background...........................................................................................................................................2
Big O Notation.................................................................................................................................3
History..................................................................................................................................................5
Plain Old Data..................................................................................................................................5
Games With no Data Structures.......................................................................................................6
Data Structures.....................................................................................................................................7
Data Structures Types......................................................................................................................7
Linked List..................................................................................................................................7
Binary Tree..................................................................................................................................8
AVL Tree ....................................................................................................................................8
Quad Tree....................................................................................................................................8
Oct Tree..................................................................................................................................8
M-Way.........................................................................................................................................8
Game AI................................................................................................................................................9
Learning AI...........................................................................................................................................9
Robotic Learning................................................................................................................................10
Its all in the Trees...........................................................................................................................10
Data Storage.......................................................................................................................................10
Conclusion..........................................................................................................................................11
References..........................................................................................................................................12
Further Reading..................................................................................................................................12
1
Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan.
Introduction
This paper is to take into account other research papers based on data mining to determine if data
mining has played a key role in game development and whether then the data structures can be used
for learning algorithm data. “Data mining, the science of extracting
useful knowledge from such huge data repositories, has emerged as a young and interdisciplinary
field in computer science. Data mining techniques have been widely applied to problems in
industry, science, engineering and government, and it is widely believed that data mining will have
profound impact on our society.”[1]
Whether your a novice, or expert at programming you will come across many data structures even
though you may not seem to notice or understand them, they are there. Having a structure that can
point to its child location is a data structure, just one of these associations then multiplied many
times can be the basis of many structures. How these are linked and how they can be searched falls
into the data mining category. Which data structure would be best for which certain type of data
mine is the part that needs to be figured out.
Background
Data structures have been around for many years providing aide to programmers and designers
around the world to help develop their programs to be efficient with a good Big(O) “O(n)“
efficiency rating. These structures all have one goal in mind, to be as efficient as possible but also
trying to provide specific functionality. An algorithm library could be very efficient but if it lacks
some functionality or is difficult to use into your program or just difficult to understand then this
may not be a desired structure to use. When structures become difficult to program and time is
essence then other structures with a higher O(n) may be used.
It is not all about the complexity of programming the structure it can be down to what functionality
it has. Such as simple functions, In-Order, Post-Order & Pre-Order traversals in some data
structures. The structure a programmer may wish to use may not have the functionality but may
have a good O(n) and fairly understandable, so adding the functionality could be desirable.
This could hinder the algorithm, though it does do the job the programmer is looking for well.
2
Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan.
Big O Notation
The Big O is what will be used to explain the efficiency of various data structures within this
document, to make it clear that Algorithm A is more efficient than Algorithm B.
O(n) has many aspects to the (n) which can be described as line functions with quadratics and linear
equations. O(c) would just be a straight line for no matter how many datasets the time to computer
would be the same, this is a perfect solution that will never happen.[game pp5]
O(c), the “c” in this expression is a constant. The O(n) notation can be produced in a spreadsheet to
provide graphs to better understand the meanings behind O notation.
The baseline is O(n) the calculations double as the data doubles.
O(n^2) can be shown as:
O(n^3) is similar to O(n^2) but rises more steeply at the start.
3
1 2 3 4 5 6 7 8 9 10 11
0
50
100
150
N^2
1 2 3 4 5 6 7 8 9 10 11
0
200
400
600
800
1000
1200
1400
N^3
1 2 3 4 5 6 7 8 9 10 11
0
2
4
6
8
10
12
n
Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan.
O(2^n) is a very strange algorithm which makes it more efficient than O(n^3) with low data sets but
explodes after at larger sets.
O(log n) will get more efficient with larger datasets which is very desirable in modern computing.
O(n log n) is similar to O(n), and will slowly become less efficient than O(n)
4
1 2 3 4 5 6 7 8 9 10 11
0
0.2
0.4
0.6
0.8
1
1.2
log(n)
1 2 3 4 5 6 7 8 9 1011
0
2
4
6
8
10
12
14
n log(n)
1 2 3 4 5 6 7 8 9 101112
0
1000
2000
3000
4000
5000
N^3
2^n
Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan.
History
The history of data structures can be followed way back before the time of the modern electronic
computers, though where did they actually start being shown in the computer languages? Data types
which are the back bone of the data structure family are the start.
Early data structures we can define quite simply as data types. Data types are the familiar words we
see in most programming languages these include:
Type Data
bool For boolean; true false 0 / 1 values
char For alpha numeric values; 'a'
double For storing large float values
float For storing real number values
int For storing integer Values
string For storing linked character values; “hello”
These data types will be the housing for the core of data structures and in essence this is all that is
needed to start creating a data structure. A data structure normally uses pointers to link up with the
next data set on the physical memory, however as this is just a pointer, it could point anywhere even
on a hard drive partition. Many data structures can be made with this primitives though there are
ways to store more information and make the coding more coherent.
The primitive data structures that have been developed as part of a languages core functionality
such as C++ can be defined as structs, classes and arrays.
You may have a class or struct of values which are housed in an array.
Here we see the first data structure that can now be used, The Array. An array is just simply a linked
list that has a set size. Starts at element (0) and end at (n), in most languages (n) is a static value.
Data structures that have the similar format as this array are commonly known as a Linked List.
Plain Old Data
A common term which is known by a few programmers is the “Plain old data, (POD)”.
This is a term that can encapsulate the primitives of data structure of structs or classes, arrays and
vectors may also be included in this.[fnal]
5
Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan.
Games With no Data Structures
Before looking at the methodology of data structures, looking at games that use primitives and the
drawbacks that they may encounter shall be explained.
Games have been around for the past 60 years and have helped computing progress as well as take
new technology from other sources. As for the first game created it is not really known but first
computer to be designed to play a game was created in 1951, NIMROD.
NIMROD was a computer designed to play the numerical strategy game NIM. [nimrod]
This game does not see the data structures we are familiar with today. Modern versions of the game
can use heaps and stacks to store the games data, no complex data storages are required.
What can be said for this game can be said for other games such as Tic Tac Toe, which will just
evaluate the diagonals, columns and rows for a 3 in a row win.
These games do assume that there will be no Artificial Participant (AI).
While not having data structures is almost impossible to do games can be made without the use of
advanced data structures. A vector, an array or structs are classed as data structures and they are not
the advanced type we may see in data bases or in modern programs.
A Tic Tac Toe game can be much easier to construct with a multi dimensional array such as in C++
MyArray[3][3]. This can indicate the entire grid and can be looped through with nested loops to
check for a win on the columns or rows easily.
With no data structures the game would need to use a separate variable for each of the nine nodes
and many “IF” statements would be needed to concatenate the variables together to determine a
win.
While games such as chess with an 8*8 grid would get complex and messy with no data structures.
Basic data structures are good for holding the grid data though if we would add an AI that needs to
look ahead as would a human then some sort of other structure would be required. A nested loop on
every possible combination would take too long. At a possible 1.22e+54 combinations. [chess.com]
When games start to have an AI aspect that’s where the data structures and data mining will start to
get interesting.
6
Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan.
Data Structures
Data structures are a way of storing large amounts of data effectively and efficiently so that retrieval
of the select data set can be obtained with minimal resources. There are some people who spend
most of their lives looking at data structures, to these people we are thankful. These are pieces of
code that over many hears have been proven to work efficiently at storing large data sets.[game
pp4]
Data Structures Types
From the large amount of data structures which have been published there are a few which keep
cropping up in many programs time and time again. These are thankfully only a short subsection of
all the data structures currently available.
Linked List
Linked lists are possibly the most basic data structure, consisting of a node that points to another.
Each node may have a pointer to its parent thus it can be a two way linked list. Some linked lists
may be designed to have open ends and elements can be entered at both ends. Closed linked lists
will have the beginning and ending nodes linking to each other.
Generally when thinking of a linked list they have a start node and an end node. When inserting a
node a search through the list to find the next lowest and set its pointer to the insert node and set the
inserts node pointer to the next highest. The next highest would be the node which was lower,
pointer to next.
“The location of nodes in memory isn’t continuous. They might be all over the place in memory.” [Game pp187]
The worst case and best case scenario for this data structure is O(n).
An array can be considered a linked list though most of the time this will be unsorted.
7
Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan.
Binary Tree
Binary trees are a technique to try and make the linked list more efficient. This is done by
attempting to cut the search in half every time, similar to a binary search on ordered data.
Everything which is less than a particular node would be to the left and all that is higher would be to
the right of it. With a perfectly balanced tree to get any number up to 256 would only take 9
iterations. The way data is normally obtained would not make a tree always balanced so at some
stages of the tree the data may be linear like a linked list so another method that can be uses is an
AVL tree.
The best case scenario for a Binary Search Tree is O(log n).
The worst case however is the same as a linked list at, O(n).
AVL Tree
AVL trees are the same as binary trees but with an extra overhead of insert to allow for special
functions to automatically balance the tree when a new node is inserted. As a node is inserted the
trees functions will alter the tree based on branch weights. If a branch is 2 heavy on either side then
a rotation of the tree will take place. Programming an AVL can be tedious as you will most likely be
juggling numbers around. AVL's have the advantage of always creating a balanced binary tree.
The worst and best case scenario for an AVL is O(log n) which is the same as the Binary Trees best.
Quad Tree
Games that handle collision data between multiple object can also take advantage of trees by
splitting the scene into quadrants, so only object s in each quadrant will be searched. O(n) for these
trees can be difficult to calculate as the data entered is not known and these trees can have a set
depth and each branch may have a different number of sub trees.
The idea behind this concept is to partition the game space so that object far away from each other
would not go through a collision detection process. Quad trees are used for the two dimensional
space.
Oct Tree
An advancement of the Quad tree is the Oct tree that does the same processes as the quad tree but
with tree dimensional space instead of two.
M-Way
M-Way trees are quite similar to binary trees though they will have multiple branches instead of just
two of them. In games AI may use a M-Way tree for chess data. For every new state of the game
board the M-Way could have a branch for each possibility. An after that another branch for all the
other possibilities after the previous was made.
8
Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan.
Game AI
Games currently have allot of AI within them and the data used for the AI to work would come
from a data tree through means of data mining such as the chess method. Chess AI uses a data
mining technique called Alpha-Beta. Alpha-Beta is an algorithm that is used to evaluate states to
provide that state as a number that the AI may work with. -∞ for a loss and +∞ for a win state.
Chess AI may only want to search a M-Way tree so far and then stop, it may do this for a few
reasons:
• Resources – The computations may take too long.
• Believability – The AI if given an infinite resources could always choose the best moves and
always win providing no “fun factor” for the player.
Some human players may be able to think head many moves in a single chess game five or more
moves for an expert player. AI could do this in matter of seconds but could also go allot further.
For this to work at all the trees functionality needs to have a good O(n) score so that the AI does not
hog all the system resources. In games players do not wish to wait more than a couple of seconds
for a computer to make its move. Dynamic learning AI may also use the same tree structure in a
separate way.
Learning AI
AI that can learn a game scenario or any other scenario could use data trees to store their data. The
method of storing is just as important as the particular type of tree to use. Trees are effective as long
as they are used in the correct manner. A tree that would learn how to play chess based from not
knowing anything apart from the actual valid moves of a piece would want to know what moves
were good in the past and which were bad.
Taking a look at how a child may learn from its mother. The child would look, watch and copy;
essentially learning from copying. How this child stores the data in its mind is what the learning AI
would need to figure out.
AI may wish to use a M-Way tree for all sorts of learning data s the data may not be known at time
of learning. With chess the AI can at start resort to random valid moves, and slowly building up a
tree based on number of moves and whether or not it lost a piece during that move or took a piece.
Over time a large tree of data would be constructed, this may be the same as a pre-set mining tree
used for conventional Alpha-Beta AI for chess. Or could be an optimized winning streak tree that is
very efficient for so that it would most of the time pick the best move. The learning AI data could
also be used to demonstrate how a human would learn chess or other tasks by storing each state in a
tree.
9
Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan.
Robotic Learning
Robotics are a complex creatures to try and take on the form of the human species. They are created
by man, and they can be closely related to the AI in games. Can the techniques used in games be
applied to that of an android.
As computers are now getting smaller and faster with nano technology and new advancements such
as graphene. [boehm]
Robotics as a whole can be a daunting task for the most advanced scientists, and trying to get an
android to simple tasks as a human would is a difficult task to coordinate, to take this one stage
further with learning would be a complex move. Autonomous robotics can be created for specialist
tasks but not generic such as a human being. Now can the same data structures used for data mining
be used to combine everything into a single data tree?
Its all in the Trees
Looking at the chess example above, the AI would add new states to a tree structures possibly based
on number of moves and how many pieces it has taken or acquired. An android may use the a
similar tree for the main subject areas we know of and slowly build up a tree of information. So all
data in a single branch is related. Such as: Plant{tree, grass, apple} Then it may discover apple is a
fruit and would have a structure to organise the tree so that apple becomes a sub-tree of fruit while
fruit is still part of plant.
So in essence the android would build up a bank of information but only information it has
discovered. The Tree structure should significantly decrease the number of possible items after each
branch. An 8 layer binary tree could hold 255 elements whereas a M-Way of each layer have 8
nodes could have 16,777,215 elements (8^8).
As the tree becomes more an more complex where sets such as shoes are concerned the nodes could
start having scripts on how to move it appendages to do the actions of doing a shoelace up.
Data Storage
Modern storage has advanced from the famous quotes:
• 1949 "Computers in the future may weigh no more than 1.5 tons."
Popular Mechanics, forecasting the relentless march of science.
• 1980 "DOS addresses only 1 Megabyte of RAM because we cannot imagine any applications needing more."
Microsoft on the development of DOS.
New data storage technology has allowed computer technology to build bigger and better programs
and allowing for data storage for all of our modern lives from photos to games and databases full of
information for the largest of data sets. All would not be possible without the technology in data
storage.
New technology is currently being stored to allow 12.8 Terra-bytes of data to be stores in a mixture
of water and wires of a cubic centimetre of memory. [network]
Conclusion
Data structures as a whole are a good concept to produce ways to store large quantities of data
10
Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan.
effectively and efficiently to require as little resources as possibly. The difficult part is to try and
sort the data to how a human mind would operate as would be required for more realistic AI.
Storing multiple data sets in a singles tree may make the tree overwhelmingly large on memory
usage due to over compensating for multiple types of data. This is not to say it could not be done,
how the human mind stores data and accesses this is still a challenge sort after by many scientists.
To do what any living mind does with a computer is difficult regardless of the task at hand.
To make a program to learn how to play a game can seem intuitive compared to trying to learn to
live such as a human. With so many different possibilities of the current planet there would be so
much data to ever learn by a single android.
A data structure which could handle multiple threads on a CPU would possibly be advantageous so
searches on large data sets can be searched from multiple points on a branch, branches would need
to have a map at the start to further breakdown key points of a tree so a search may be initialized
from two distinctive points on a tree structure.
11
Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan.
References
[1] Data Mining Curriculum: A Proposal (Version 1.0), April 30 2006, “Intensive Working Group of ACM SIGKDD Curriculum Committee”,
Soumen Chakrabarti, Martin Ester, Usama Fayyad, Johannes Gehrke, Jiawei Han, Shinichi Morishita, Gregory Piatetsky-Shapiro, Wei Wang.
[online: http://www.sigkdd.org/curriculum/CURMay06.pdf accessed: 29/Nov/2011], pp1.
[2] Data Mining for Game Developers, pp5
http://www.fnal.gov/docs/working-groups/fpcltf/Pkg/ISOcxx/doc/POD.html
http://www.goodeveca.net/nimrod/
http://www.chess.com/forum/view/general/how-many-different-chess-positions-are-there
http://www.networkworld.com/news/2006/051206-water-and-wires-data-storage.html
H. P. Boehm, R. Setton, E. Stumpp (1994). "Nomenclature and terminology of graphite intercalation compounds". Pure
and Applied Chemistry 66 (9): 1893–1901. doi:10.1351/pac199466091893.
Further Reading
http://trillian.randomstuff.org.uk/~stephen/history/timeline-QUOTES.html
12

More Related Content

What's hot

Duet @ TREC 2019 Deep Learning Track
Duet @ TREC 2019 Deep Learning TrackDuet @ TREC 2019 Deep Learning Track
Duet @ TREC 2019 Deep Learning TrackBhaskar Mitra
 
First fit , Best fit, Worst fit
First fit , Best fit, Worst fitFirst fit , Best fit, Worst fit
First fit , Best fit, Worst fitShahzeb Amjad
 
Neural Models for Information Retrieval
Neural Models for Information RetrievalNeural Models for Information Retrieval
Neural Models for Information RetrievalBhaskar Mitra
 

What's hot (6)

Duet @ TREC 2019 Deep Learning Track
Duet @ TREC 2019 Deep Learning TrackDuet @ TREC 2019 Deep Learning Track
Duet @ TREC 2019 Deep Learning Track
 
First fit , Best fit, Worst fit
First fit , Best fit, Worst fitFirst fit , Best fit, Worst fit
First fit , Best fit, Worst fit
 
Final-Report
Final-ReportFinal-Report
Final-Report
 
C010231217
C010231217C010231217
C010231217
 
Neural Models for Information Retrieval
Neural Models for Information RetrievalNeural Models for Information Retrieval
Neural Models for Information Retrieval
 
Learning-based Data Cleaning
Learning-based Data CleaningLearning-based Data Cleaning
Learning-based Data Cleaning
 

Viewers also liked

Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and AlgorithmDhaval Kaneria
 
Persistent Data Structures by @aradzie
Persistent Data Structures by @aradziePersistent Data Structures by @aradzie
Persistent Data Structures by @aradzieVasil Remeniuk
 
Algorithm & data structures lec1
Algorithm & data structures lec1Algorithm & data structures lec1
Algorithm & data structures lec1Abdul Khan
 
Introduction to Data structure & Algorithms - Sethuonline.com | Sathyabama Un...
Introduction to Data structure & Algorithms - Sethuonline.com | Sathyabama Un...Introduction to Data structure & Algorithms - Sethuonline.com | Sathyabama Un...
Introduction to Data structure & Algorithms - Sethuonline.com | Sathyabama Un...sethuraman R
 
Data structure and algorithm All in One
Data structure and algorithm All in OneData structure and algorithm All in One
Data structure and algorithm All in Onejehan1987
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithmsJulie Iskander
 
Introduction of data structure
Introduction of data structureIntroduction of data structure
Introduction of data structureeShikshak
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsLecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsAakash deep Singhal
 
Data structures (introduction)
 Data structures (introduction) Data structures (introduction)
Data structures (introduction)Arvind Devaraj
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURESbca2010
 

Viewers also liked (12)

Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
 
Persistent Data Structures by @aradzie
Persistent Data Structures by @aradziePersistent Data Structures by @aradzie
Persistent Data Structures by @aradzie
 
Algorithm & data structures lec1
Algorithm & data structures lec1Algorithm & data structures lec1
Algorithm & data structures lec1
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
Introduction to Data structure & Algorithms - Sethuonline.com | Sathyabama Un...
Introduction to Data structure & Algorithms - Sethuonline.com | Sathyabama Un...Introduction to Data structure & Algorithms - Sethuonline.com | Sathyabama Un...
Introduction to Data structure & Algorithms - Sethuonline.com | Sathyabama Un...
 
Data structure and algorithm All in One
Data structure and algorithm All in OneData structure and algorithm All in One
Data structure and algorithm All in One
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
Introduction of data structure
Introduction of data structureIntroduction of data structure
Introduction of data structure
 
Data Structure
Data StructureData Structure
Data Structure
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsLecture 1 data structures and algorithms
Lecture 1 data structures and algorithms
 
Data structures (introduction)
 Data structures (introduction) Data structures (introduction)
Data structures (introduction)
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURES
 

Similar to Data Structures for Robotic Learning

employee turnover prediction document.docx
employee turnover prediction document.docxemployee turnover prediction document.docx
employee turnover prediction document.docxrohithprabhas1
 
Possible Worlds Explorer: Datalog & Answer Set Programming for the Rest of Us
Possible Worlds Explorer: Datalog & Answer Set Programming for the Rest of UsPossible Worlds Explorer: Datalog & Answer Set Programming for the Rest of Us
Possible Worlds Explorer: Datalog & Answer Set Programming for the Rest of UsBertram Ludäscher
 
BIAM 410 Final Paper - Beyond the Buzzwords: Big Data, Machine Learning, What...
BIAM 410 Final Paper - Beyond the Buzzwords: Big Data, Machine Learning, What...BIAM 410 Final Paper - Beyond the Buzzwords: Big Data, Machine Learning, What...
BIAM 410 Final Paper - Beyond the Buzzwords: Big Data, Machine Learning, What...Thomas Rones
 
Unit 2 - Data Manipulation with R.pptx
Unit 2 - Data Manipulation with R.pptxUnit 2 - Data Manipulation with R.pptx
Unit 2 - Data Manipulation with R.pptxMalla Reddy University
 
XML Considered Harmful
XML Considered HarmfulXML Considered Harmful
XML Considered HarmfulPrateek Singh
 
Adarsh_Masekar(2GP19CS003).pptx
Adarsh_Masekar(2GP19CS003).pptxAdarsh_Masekar(2GP19CS003).pptx
Adarsh_Masekar(2GP19CS003).pptxhkabir55
 
Presentation
PresentationPresentation
Presentationbutest
 
PyData 2015 Keynote: "A Systems View of Machine Learning"
PyData 2015 Keynote: "A Systems View of Machine Learning" PyData 2015 Keynote: "A Systems View of Machine Learning"
PyData 2015 Keynote: "A Systems View of Machine Learning" Joshua Bloom
 
Part2- The Atomic Information Resource
Part2- The Atomic Information ResourcePart2- The Atomic Information Resource
Part2- The Atomic Information ResourceJEAN-MICHEL LETENNIER
 
01VD062009003760042.pdf
01VD062009003760042.pdf01VD062009003760042.pdf
01VD062009003760042.pdfSunilMatsagar1
 
International Journal of Computer Science, Engineering and Information Techno...
International Journal of Computer Science, Engineering and Information Techno...International Journal of Computer Science, Engineering and Information Techno...
International Journal of Computer Science, Engineering and Information Techno...ijcseit
 
Questions On The Code And Core Module
Questions On The Code And Core ModuleQuestions On The Code And Core Module
Questions On The Code And Core ModuleKatie Gulley
 
Object Oriented Programming -- Dr Robert Harle
Object Oriented Programming -- Dr Robert HarleObject Oriented Programming -- Dr Robert Harle
Object Oriented Programming -- Dr Robert Harlesuthi
 
Semantic Interoperability - grafi della conoscenza
Semantic Interoperability - grafi della conoscenzaSemantic Interoperability - grafi della conoscenza
Semantic Interoperability - grafi della conoscenzaGiorgia Lodi
 
Fundamentals of data structures ellis horowitz & sartaj sahni
Fundamentals of data structures   ellis horowitz & sartaj sahniFundamentals of data structures   ellis horowitz & sartaj sahni
Fundamentals of data structures ellis horowitz & sartaj sahniHitesh Wagle
 
Introduction to data analysis using R
Introduction to data analysis using RIntroduction to data analysis using R
Introduction to data analysis using RVictoria López
 

Similar to Data Structures for Robotic Learning (20)

employee turnover prediction document.docx
employee turnover prediction document.docxemployee turnover prediction document.docx
employee turnover prediction document.docx
 
Possible Worlds Explorer: Datalog & Answer Set Programming for the Rest of Us
Possible Worlds Explorer: Datalog & Answer Set Programming for the Rest of UsPossible Worlds Explorer: Datalog & Answer Set Programming for the Rest of Us
Possible Worlds Explorer: Datalog & Answer Set Programming for the Rest of Us
 
AQA Computer science easter revision
AQA Computer science easter revisionAQA Computer science easter revision
AQA Computer science easter revision
 
ML.pdf
ML.pdfML.pdf
ML.pdf
 
BIAM 410 Final Paper - Beyond the Buzzwords: Big Data, Machine Learning, What...
BIAM 410 Final Paper - Beyond the Buzzwords: Big Data, Machine Learning, What...BIAM 410 Final Paper - Beyond the Buzzwords: Big Data, Machine Learning, What...
BIAM 410 Final Paper - Beyond the Buzzwords: Big Data, Machine Learning, What...
 
Unit 2 - Data Manipulation with R.pptx
Unit 2 - Data Manipulation with R.pptxUnit 2 - Data Manipulation with R.pptx
Unit 2 - Data Manipulation with R.pptx
 
XML Considered Harmful
XML Considered HarmfulXML Considered Harmful
XML Considered Harmful
 
Adarsh_Masekar(2GP19CS003).pptx
Adarsh_Masekar(2GP19CS003).pptxAdarsh_Masekar(2GP19CS003).pptx
Adarsh_Masekar(2GP19CS003).pptx
 
Presentation
PresentationPresentation
Presentation
 
PyData 2015 Keynote: "A Systems View of Machine Learning"
PyData 2015 Keynote: "A Systems View of Machine Learning" PyData 2015 Keynote: "A Systems View of Machine Learning"
PyData 2015 Keynote: "A Systems View of Machine Learning"
 
Cs8391 notes rejinpaul
Cs8391 notes rejinpaulCs8391 notes rejinpaul
Cs8391 notes rejinpaul
 
Part2- The Atomic Information Resource
Part2- The Atomic Information ResourcePart2- The Atomic Information Resource
Part2- The Atomic Information Resource
 
01VD062009003760042.pdf
01VD062009003760042.pdf01VD062009003760042.pdf
01VD062009003760042.pdf
 
International Journal of Computer Science, Engineering and Information Techno...
International Journal of Computer Science, Engineering and Information Techno...International Journal of Computer Science, Engineering and Information Techno...
International Journal of Computer Science, Engineering and Information Techno...
 
Questions On The Code And Core Module
Questions On The Code And Core ModuleQuestions On The Code And Core Module
Questions On The Code And Core Module
 
Object Oriented Programming -- Dr Robert Harle
Object Oriented Programming -- Dr Robert HarleObject Oriented Programming -- Dr Robert Harle
Object Oriented Programming -- Dr Robert Harle
 
Oop
OopOop
Oop
 
Semantic Interoperability - grafi della conoscenza
Semantic Interoperability - grafi della conoscenzaSemantic Interoperability - grafi della conoscenza
Semantic Interoperability - grafi della conoscenza
 
Fundamentals of data structures ellis horowitz & sartaj sahni
Fundamentals of data structures   ellis horowitz & sartaj sahniFundamentals of data structures   ellis horowitz & sartaj sahni
Fundamentals of data structures ellis horowitz & sartaj sahni
 
Introduction to data analysis using R
Introduction to data analysis using RIntroduction to data analysis using R
Introduction to data analysis using R
 

Data Structures for Robotic Learning

  • 1. Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan. Contents Introduction..........................................................................................................................................2 Background...........................................................................................................................................2 Big O Notation.................................................................................................................................3 History..................................................................................................................................................5 Plain Old Data..................................................................................................................................5 Games With no Data Structures.......................................................................................................6 Data Structures.....................................................................................................................................7 Data Structures Types......................................................................................................................7 Linked List..................................................................................................................................7 Binary Tree..................................................................................................................................8 AVL Tree ....................................................................................................................................8 Quad Tree....................................................................................................................................8 Oct Tree..................................................................................................................................8 M-Way.........................................................................................................................................8 Game AI................................................................................................................................................9 Learning AI...........................................................................................................................................9 Robotic Learning................................................................................................................................10 Its all in the Trees...........................................................................................................................10 Data Storage.......................................................................................................................................10 Conclusion..........................................................................................................................................11 References..........................................................................................................................................12 Further Reading..................................................................................................................................12 1
  • 2. Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan. Introduction This paper is to take into account other research papers based on data mining to determine if data mining has played a key role in game development and whether then the data structures can be used for learning algorithm data. “Data mining, the science of extracting useful knowledge from such huge data repositories, has emerged as a young and interdisciplinary field in computer science. Data mining techniques have been widely applied to problems in industry, science, engineering and government, and it is widely believed that data mining will have profound impact on our society.”[1] Whether your a novice, or expert at programming you will come across many data structures even though you may not seem to notice or understand them, they are there. Having a structure that can point to its child location is a data structure, just one of these associations then multiplied many times can be the basis of many structures. How these are linked and how they can be searched falls into the data mining category. Which data structure would be best for which certain type of data mine is the part that needs to be figured out. Background Data structures have been around for many years providing aide to programmers and designers around the world to help develop their programs to be efficient with a good Big(O) “O(n)“ efficiency rating. These structures all have one goal in mind, to be as efficient as possible but also trying to provide specific functionality. An algorithm library could be very efficient but if it lacks some functionality or is difficult to use into your program or just difficult to understand then this may not be a desired structure to use. When structures become difficult to program and time is essence then other structures with a higher O(n) may be used. It is not all about the complexity of programming the structure it can be down to what functionality it has. Such as simple functions, In-Order, Post-Order & Pre-Order traversals in some data structures. The structure a programmer may wish to use may not have the functionality but may have a good O(n) and fairly understandable, so adding the functionality could be desirable. This could hinder the algorithm, though it does do the job the programmer is looking for well. 2
  • 3. Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan. Big O Notation The Big O is what will be used to explain the efficiency of various data structures within this document, to make it clear that Algorithm A is more efficient than Algorithm B. O(n) has many aspects to the (n) which can be described as line functions with quadratics and linear equations. O(c) would just be a straight line for no matter how many datasets the time to computer would be the same, this is a perfect solution that will never happen.[game pp5] O(c), the “c” in this expression is a constant. The O(n) notation can be produced in a spreadsheet to provide graphs to better understand the meanings behind O notation. The baseline is O(n) the calculations double as the data doubles. O(n^2) can be shown as: O(n^3) is similar to O(n^2) but rises more steeply at the start. 3 1 2 3 4 5 6 7 8 9 10 11 0 50 100 150 N^2 1 2 3 4 5 6 7 8 9 10 11 0 200 400 600 800 1000 1200 1400 N^3 1 2 3 4 5 6 7 8 9 10 11 0 2 4 6 8 10 12 n
  • 4. Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan. O(2^n) is a very strange algorithm which makes it more efficient than O(n^3) with low data sets but explodes after at larger sets. O(log n) will get more efficient with larger datasets which is very desirable in modern computing. O(n log n) is similar to O(n), and will slowly become less efficient than O(n) 4 1 2 3 4 5 6 7 8 9 10 11 0 0.2 0.4 0.6 0.8 1 1.2 log(n) 1 2 3 4 5 6 7 8 9 1011 0 2 4 6 8 10 12 14 n log(n) 1 2 3 4 5 6 7 8 9 101112 0 1000 2000 3000 4000 5000 N^3 2^n
  • 5. Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan. History The history of data structures can be followed way back before the time of the modern electronic computers, though where did they actually start being shown in the computer languages? Data types which are the back bone of the data structure family are the start. Early data structures we can define quite simply as data types. Data types are the familiar words we see in most programming languages these include: Type Data bool For boolean; true false 0 / 1 values char For alpha numeric values; 'a' double For storing large float values float For storing real number values int For storing integer Values string For storing linked character values; “hello” These data types will be the housing for the core of data structures and in essence this is all that is needed to start creating a data structure. A data structure normally uses pointers to link up with the next data set on the physical memory, however as this is just a pointer, it could point anywhere even on a hard drive partition. Many data structures can be made with this primitives though there are ways to store more information and make the coding more coherent. The primitive data structures that have been developed as part of a languages core functionality such as C++ can be defined as structs, classes and arrays. You may have a class or struct of values which are housed in an array. Here we see the first data structure that can now be used, The Array. An array is just simply a linked list that has a set size. Starts at element (0) and end at (n), in most languages (n) is a static value. Data structures that have the similar format as this array are commonly known as a Linked List. Plain Old Data A common term which is known by a few programmers is the “Plain old data, (POD)”. This is a term that can encapsulate the primitives of data structure of structs or classes, arrays and vectors may also be included in this.[fnal] 5
  • 6. Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan. Games With no Data Structures Before looking at the methodology of data structures, looking at games that use primitives and the drawbacks that they may encounter shall be explained. Games have been around for the past 60 years and have helped computing progress as well as take new technology from other sources. As for the first game created it is not really known but first computer to be designed to play a game was created in 1951, NIMROD. NIMROD was a computer designed to play the numerical strategy game NIM. [nimrod] This game does not see the data structures we are familiar with today. Modern versions of the game can use heaps and stacks to store the games data, no complex data storages are required. What can be said for this game can be said for other games such as Tic Tac Toe, which will just evaluate the diagonals, columns and rows for a 3 in a row win. These games do assume that there will be no Artificial Participant (AI). While not having data structures is almost impossible to do games can be made without the use of advanced data structures. A vector, an array or structs are classed as data structures and they are not the advanced type we may see in data bases or in modern programs. A Tic Tac Toe game can be much easier to construct with a multi dimensional array such as in C++ MyArray[3][3]. This can indicate the entire grid and can be looped through with nested loops to check for a win on the columns or rows easily. With no data structures the game would need to use a separate variable for each of the nine nodes and many “IF” statements would be needed to concatenate the variables together to determine a win. While games such as chess with an 8*8 grid would get complex and messy with no data structures. Basic data structures are good for holding the grid data though if we would add an AI that needs to look ahead as would a human then some sort of other structure would be required. A nested loop on every possible combination would take too long. At a possible 1.22e+54 combinations. [chess.com] When games start to have an AI aspect that’s where the data structures and data mining will start to get interesting. 6
  • 7. Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan. Data Structures Data structures are a way of storing large amounts of data effectively and efficiently so that retrieval of the select data set can be obtained with minimal resources. There are some people who spend most of their lives looking at data structures, to these people we are thankful. These are pieces of code that over many hears have been proven to work efficiently at storing large data sets.[game pp4] Data Structures Types From the large amount of data structures which have been published there are a few which keep cropping up in many programs time and time again. These are thankfully only a short subsection of all the data structures currently available. Linked List Linked lists are possibly the most basic data structure, consisting of a node that points to another. Each node may have a pointer to its parent thus it can be a two way linked list. Some linked lists may be designed to have open ends and elements can be entered at both ends. Closed linked lists will have the beginning and ending nodes linking to each other. Generally when thinking of a linked list they have a start node and an end node. When inserting a node a search through the list to find the next lowest and set its pointer to the insert node and set the inserts node pointer to the next highest. The next highest would be the node which was lower, pointer to next. “The location of nodes in memory isn’t continuous. They might be all over the place in memory.” [Game pp187] The worst case and best case scenario for this data structure is O(n). An array can be considered a linked list though most of the time this will be unsorted. 7
  • 8. Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan. Binary Tree Binary trees are a technique to try and make the linked list more efficient. This is done by attempting to cut the search in half every time, similar to a binary search on ordered data. Everything which is less than a particular node would be to the left and all that is higher would be to the right of it. With a perfectly balanced tree to get any number up to 256 would only take 9 iterations. The way data is normally obtained would not make a tree always balanced so at some stages of the tree the data may be linear like a linked list so another method that can be uses is an AVL tree. The best case scenario for a Binary Search Tree is O(log n). The worst case however is the same as a linked list at, O(n). AVL Tree AVL trees are the same as binary trees but with an extra overhead of insert to allow for special functions to automatically balance the tree when a new node is inserted. As a node is inserted the trees functions will alter the tree based on branch weights. If a branch is 2 heavy on either side then a rotation of the tree will take place. Programming an AVL can be tedious as you will most likely be juggling numbers around. AVL's have the advantage of always creating a balanced binary tree. The worst and best case scenario for an AVL is O(log n) which is the same as the Binary Trees best. Quad Tree Games that handle collision data between multiple object can also take advantage of trees by splitting the scene into quadrants, so only object s in each quadrant will be searched. O(n) for these trees can be difficult to calculate as the data entered is not known and these trees can have a set depth and each branch may have a different number of sub trees. The idea behind this concept is to partition the game space so that object far away from each other would not go through a collision detection process. Quad trees are used for the two dimensional space. Oct Tree An advancement of the Quad tree is the Oct tree that does the same processes as the quad tree but with tree dimensional space instead of two. M-Way M-Way trees are quite similar to binary trees though they will have multiple branches instead of just two of them. In games AI may use a M-Way tree for chess data. For every new state of the game board the M-Way could have a branch for each possibility. An after that another branch for all the other possibilities after the previous was made. 8
  • 9. Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan. Game AI Games currently have allot of AI within them and the data used for the AI to work would come from a data tree through means of data mining such as the chess method. Chess AI uses a data mining technique called Alpha-Beta. Alpha-Beta is an algorithm that is used to evaluate states to provide that state as a number that the AI may work with. -∞ for a loss and +∞ for a win state. Chess AI may only want to search a M-Way tree so far and then stop, it may do this for a few reasons: • Resources – The computations may take too long. • Believability – The AI if given an infinite resources could always choose the best moves and always win providing no “fun factor” for the player. Some human players may be able to think head many moves in a single chess game five or more moves for an expert player. AI could do this in matter of seconds but could also go allot further. For this to work at all the trees functionality needs to have a good O(n) score so that the AI does not hog all the system resources. In games players do not wish to wait more than a couple of seconds for a computer to make its move. Dynamic learning AI may also use the same tree structure in a separate way. Learning AI AI that can learn a game scenario or any other scenario could use data trees to store their data. The method of storing is just as important as the particular type of tree to use. Trees are effective as long as they are used in the correct manner. A tree that would learn how to play chess based from not knowing anything apart from the actual valid moves of a piece would want to know what moves were good in the past and which were bad. Taking a look at how a child may learn from its mother. The child would look, watch and copy; essentially learning from copying. How this child stores the data in its mind is what the learning AI would need to figure out. AI may wish to use a M-Way tree for all sorts of learning data s the data may not be known at time of learning. With chess the AI can at start resort to random valid moves, and slowly building up a tree based on number of moves and whether or not it lost a piece during that move or took a piece. Over time a large tree of data would be constructed, this may be the same as a pre-set mining tree used for conventional Alpha-Beta AI for chess. Or could be an optimized winning streak tree that is very efficient for so that it would most of the time pick the best move. The learning AI data could also be used to demonstrate how a human would learn chess or other tasks by storing each state in a tree. 9
  • 10. Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan. Robotic Learning Robotics are a complex creatures to try and take on the form of the human species. They are created by man, and they can be closely related to the AI in games. Can the techniques used in games be applied to that of an android. As computers are now getting smaller and faster with nano technology and new advancements such as graphene. [boehm] Robotics as a whole can be a daunting task for the most advanced scientists, and trying to get an android to simple tasks as a human would is a difficult task to coordinate, to take this one stage further with learning would be a complex move. Autonomous robotics can be created for specialist tasks but not generic such as a human being. Now can the same data structures used for data mining be used to combine everything into a single data tree? Its all in the Trees Looking at the chess example above, the AI would add new states to a tree structures possibly based on number of moves and how many pieces it has taken or acquired. An android may use the a similar tree for the main subject areas we know of and slowly build up a tree of information. So all data in a single branch is related. Such as: Plant{tree, grass, apple} Then it may discover apple is a fruit and would have a structure to organise the tree so that apple becomes a sub-tree of fruit while fruit is still part of plant. So in essence the android would build up a bank of information but only information it has discovered. The Tree structure should significantly decrease the number of possible items after each branch. An 8 layer binary tree could hold 255 elements whereas a M-Way of each layer have 8 nodes could have 16,777,215 elements (8^8). As the tree becomes more an more complex where sets such as shoes are concerned the nodes could start having scripts on how to move it appendages to do the actions of doing a shoelace up. Data Storage Modern storage has advanced from the famous quotes: • 1949 "Computers in the future may weigh no more than 1.5 tons." Popular Mechanics, forecasting the relentless march of science. • 1980 "DOS addresses only 1 Megabyte of RAM because we cannot imagine any applications needing more." Microsoft on the development of DOS. New data storage technology has allowed computer technology to build bigger and better programs and allowing for data storage for all of our modern lives from photos to games and databases full of information for the largest of data sets. All would not be possible without the technology in data storage. New technology is currently being stored to allow 12.8 Terra-bytes of data to be stores in a mixture of water and wires of a cubic centimetre of memory. [network] Conclusion Data structures as a whole are a good concept to produce ways to store large quantities of data 10
  • 11. Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan. effectively and efficiently to require as little resources as possibly. The difficult part is to try and sort the data to how a human mind would operate as would be required for more realistic AI. Storing multiple data sets in a singles tree may make the tree overwhelmingly large on memory usage due to over compensating for multiple types of data. This is not to say it could not be done, how the human mind stores data and accesses this is still a challenge sort after by many scientists. To do what any living mind does with a computer is difficult regardless of the task at hand. To make a program to learn how to play a game can seem intuitive compared to trying to learn to live such as a human. With so many different possibilities of the current planet there would be so much data to ever learn by a single android. A data structure which could handle multiple threads on a CPU would possibly be advantageous so searches on large data sets can be searched from multiple points on a branch, branches would need to have a map at the start to further breakdown key points of a tree so a search may be initialized from two distinctive points on a tree structure. 11
  • 12. Data Structures for Robotic Learning. Lesley Cooper, University of Glamorgan. References [1] Data Mining Curriculum: A Proposal (Version 1.0), April 30 2006, “Intensive Working Group of ACM SIGKDD Curriculum Committee”, Soumen Chakrabarti, Martin Ester, Usama Fayyad, Johannes Gehrke, Jiawei Han, Shinichi Morishita, Gregory Piatetsky-Shapiro, Wei Wang. [online: http://www.sigkdd.org/curriculum/CURMay06.pdf accessed: 29/Nov/2011], pp1. [2] Data Mining for Game Developers, pp5 http://www.fnal.gov/docs/working-groups/fpcltf/Pkg/ISOcxx/doc/POD.html http://www.goodeveca.net/nimrod/ http://www.chess.com/forum/view/general/how-many-different-chess-positions-are-there http://www.networkworld.com/news/2006/051206-water-and-wires-data-storage.html H. P. Boehm, R. Setton, E. Stumpp (1994). "Nomenclature and terminology of graphite intercalation compounds". Pure and Applied Chemistry 66 (9): 1893–1901. doi:10.1351/pac199466091893. Further Reading http://trillian.randomstuff.org.uk/~stephen/history/timeline-QUOTES.html 12