59
RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan & Nima Kavian

RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Embed Size (px)

Citation preview

Page 1: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

RoboSina from Scratch

Submitted as partial Fulfillment for the Requirements of the degree of

Bachelor of Science In

Software Engineering

By

Mostafa Rafaie-Jokandan & Nima Kaviani

Page 2: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

1. Introduction

2. Simulation System and Soccer Server

3. Learning Algorithms used in RoboSina

4. Prominent Aspects of RoboSina

5. RoboSina Agent and Learning

6. Suggestions and Conclusion

Page 3: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Introduction

Why RoboCup?An approach to Distributed Artificial IntelligenceDAI vs CAI

Where are we moving toward?

Who were we in RoboSina?

Page 4: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Simulation System & Soccer Server

What is a Simulation System? Why Simulation? Soccer Server

Page 5: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Soccer Server

Match RulesControlled by Soccer ServerControlled by Human

Properties of the Simulated PitchA 105.0 * 68.0 field covered by flagsGoal widths are twice a real one

Page 6: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Some of predefined parameters for Soccer Server

Page 7: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

A Simulated Field

Page 8: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Models used in Soccer Server

Movement Model Visual Model Aural Model

Page 9: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Visual Model

(see ObjName Distance Direction DistChng DirChng BodyDir HeadDir) ObjName ::= (p ”Teamname” UniformNumber goalie)

| (g [l|r]) | (b) | (f c) | (f [l|c|r] [t|b]) | (f p [l|r] [t|c|b]) | (f g [l|r] [t|b]) | (f [l|r|t|b] 0) | (f [t|b] [l|r] [10|20|30|40|50]) | (f [l|r] [t|b] [10|20|30]) | (l [l|r|t|b])

Page 10: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Visual Formulas prx = pxt − pxo pry = pyt − pyo vrx = vxt − vxo vry = vyt − vyo Direction = arctan(pry/prx) − ao erx = prx/Distance ery = pry/Distance DistChng = (vrx erx∗ ) + (vry ery∗ ) DirChng = [(−(vrx ery∗ ) + (vry erx∗ ))/Distance] ∗ (180/π) BodyDir = PlayerBodyDir − gentBodyDir − AgentHeadDir HeadDir = PlayerHeadDir − AgentBodyDir − AgentHeadDir

Noise Formulas d’ = Quntize ( exp(quantize(log(d) . quantize – step )), 0.1) Quantize (V , Q) = ceiling(V/Q) * Q

Visual Model

ry2

rx2 pp Distance

Page 11: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Visual Model

9045

Page 12: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Aural Model

(hear Time Sender ”Message”)

Page 13: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Movement Model

Page 14: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Movement Noise Model

Page 15: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Catch Dash & Stamina Model Kick Tackle Turn Move Turn-Neck Point to Focus Say Change View Score

Actions for an Agent

Page 16: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Heterogeneous PlayersDo you know how a body builder differs a normal

human? Acting in an environment with heterogeneous

creatures covers all possible properties Coach

Mapping of DAI to CAI with restricted bandwidth in communication

What was the role of Jose Morinio in a team if we didn’t have a coach?!!!

Page 17: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Learning Algorithms

Definition Decision Trees Artificial Neural Networks

Page 18: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Learning Algorithms-Keywords

Environment Property State Goal Learning Algorithm

Page 19: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Learning Algorithms-Keywords

Propertyi

State1

State2

State3Goal State

Page 20: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Decision Trees

Definition ID3 Basis ID3 Formulas ID3 Algorithm What is C4.5

Page 21: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Decision Trees - Definition

A powerful tool for Inductive Inference Proposing a model for discrete environments Resistance against Noisy Data

Page 22: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

?

?

Outlook = Sunny, Wind = Weak, Humidity = HighD=( )

Playing a Soccer Gamein case of having a weather

with conditions D

Page 23: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Decision Trees – ID3 Basis

Occam’s Razor, mid of 14th century

“It is vain to do with more what can

be done with less… entities should

not be multiplied beyond necessity”

Page 24: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Decision Trees – ID3 Formulas

Page 25: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Decision Trees – ID3 Algorithm

Page 26: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Decision Trees – C4.5

A developed software on the basis of ID3 It’s abilities

Avoiding over fitting the data Reduced error pruning Rule post-pruning Handling continuous attributes Handling attribute with different costs Choosing an appropriate selection measure Handling training data with missing attribute values Improving computational efficiency

Page 27: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Neural Networks

Definition A Mathematical Representation BackPropagate Basis BackPropagate Algorithm

Page 28: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Neural Networks-Definition

A mathematical model of human’s neurons It’s abilities

Association, Clustering, Classification Pattern Recognition Generalization, Reference Improvement

Classification on the basis of Learning Algorithm Supervised Unsupervised => Competitive

Page 29: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Neural Networks- Math Representation

Page 30: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Neural Networks- BackPropagate Basis

A supervised learning algorithm Works on the basis of revising Weight

Values Training Example (x, t) where x represents

the entry, and t is the expected output value

ai(l) representes the output gerenrated by the network in the layer named l

x = ai(0)

m is the frequency for the execution of learning algorithm

Page 31: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Neural Networks- BackPropagate Algorithm

Page 32: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Prominent Aspects

System Architecture Localizing an Agent Intercept Dribble Formation Defense System Play With Ball System

Page 33: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

System Architecture

Describe the structure of the system's componentsFunctional ArchitectureOperational ArchitectureImplementation Architecture

Brief view to Functional Architecture

Page 34: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

System Architecture-Functional Architecture

Page 35: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Localizing an Agent

What is localization?

f

Page 36: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Localizing an Agent

• A new approach used• It deals with points rather than edges• Uses a swipe line to find active edges• A point will be added if :

1. It is a result of an intersection2. It is surrounded by both active

edges of the other polygon• Stops after reaching the end point of a

polygon• It is executed in O(m+n) for 2 polygons• T(n) = 2T(n/2) + O (n)• It is executed in O(nlogn) using divide

and conquer for n polygons

Page 37: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Intercept

As a skills Intercept the ball in at any distance.

As a strategy utility Determine ball ownerPredict ball ownerDetermine who must be intercept ball.Need to communication to enhance its efficiency

Page 38: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Dribble

Running with the ball from one point to another as quickly as possible

Misleading obtrusive defender

Holding ball if it is need .

Page 39: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

One , Two

Dribble

Page 40: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Dribble

Mislead

Page 41: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Formation

UsageDetermine Agent position relative to the ball

position New Works

New Floating Formation Adding A Free midfielderImplementing the main formation as 4-2-3-1 Implementing forwards press.

Page 42: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

New Floating Formation

The 4-2-3-1 formation is the main formation.

4 2 3

1

Page 43: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

New Floating Formation

4

The 4-2-4 formation is a fully offensive formation.

24

Page 44: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Defense System

Skills BlockMark

StrategyOffside linePress

Page 45: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Defense System- Block

Page 46: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Defense System- Mark

Page 47: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Defense System- Offside Line

NO, offside!!!

Page 48: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

NO, I lost the ball !!

Page 49: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

RoboSina Agent & Learning

Agent learns to ShootNeural Network and training a shoot skillUsing BP and Matlab

Agent learns to PassDecision Trees and training a pass skillUsing ID3 and C4.5

Page 50: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Learning how to Shoot

Problem Definition Mapping the environment to a discrete model

6 input entries 6 output entries

Grabbing relevant properties Using trainer to collect training samples Choosing the proper target to shoot

Making the appropriate Neural Network Modeling the network with matlab

A 2 layer network tgsig as activation function in the first layer logsig as activation function in the second layer

Applying training samples to the network Results

Page 51: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Failed

1st Successful State

Last Successful State

State 19 = 100111

State 28 = 111001

State 24 = 110001

(bx, by)

(gx, gy)

distcb

dircb

100011

bx

by

gx

gy

distcb

dircb

Page 52: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Shoot-Results

Harms Very time consuming method!!

AlgorithmOccurrence in 8

matchesSuccess Num Success Percentage

Computational 141 93 65.9%

Learning 173 126 72.8%

Page 53: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Learning how to Pass

Problem Definition Grabbing relevant properties Using trainer to collect training samples

Making the appropriate Decision Tree using C4.5 to create the tree

Creating pass.names file applying training samples to the tree

Creating pass.data file

Results

Page 54: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan
Page 55: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Pass-Results

Pass Probability Occurrence in 8 matches

Success Num Success Percentage

85-100% 912 753 78.3%

70-85% 328 187 57.01%

55-70% 168 92 54.7%

Harms Partial Observation causes problems Body direction of the receiver is ignored during the train

Page 56: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

RoboSina Project

Honors Championship of the 3rd US-Open RoboCup Competitions,

May 2005, Atlanta, USA 2nd place of the 3rd Iranian Open RoboCup Competitions,

April 2005, Tehran, Iran 5th place of RoboCup World Cup 2004, Lisbon, Portugal Championship of the 2nd US-Open RoboCup

Competitions, May 2004, New-Orleans, USA Championship of the 2nd Iranian Open RoboCup

Competitions, March 2004, Tehran, Iran 10th place RoboCup World Cup 2003, Padova, Italy

Page 57: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Conclusions &

Suggestions

Page 58: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Acknowledgements

Page 59: RoboSina from Scratch Submitted as partial Fulfillment for the Requirements of the degree of Bachelor of Science In Software Engineering By Mostafa Rafaie-Jokandan

Thank you very much for being here

Any Question?

We are ready to Answer