6 Creating the Animation



Similar documents
A Non-Linear Schema Theorem for Genetic Algorithms

Full and Complete Binary Trees

College of information technology Department of software

Binary Trees and Huffman Encoding Binary Search Trees

A Study of Crossover Operators for Genetic Algorithm and Proposal of a New Crossover Operator to Solve Open Shop Scheduling Problem

Genetic Algorithms commonly used selection, replacement, and variation operators Fernando Lobo University of Algarve

ISSN: ISO 9001:2008 Certified International Journal of Engineering Science and Innovative Technology (IJESIT) Volume 2, Issue 3, May 2013

Binary Heap Algorithms

A binary search tree or BST is a binary tree that is either empty or in which the data element of each node has a key, and:

Lab 4: 26 th March Exercise 1: Evolutionary algorithms

Outline BST Operations Worst case Average case Balancing AVL Red-black B-trees. Binary Search Trees. Lecturer: Georgy Gimel farb

root node level: internal node edge leaf node Data Structures & Algorithms McQuain

Ordered Lists and Binary Trees

GA as a Data Optimization Tool for Predictive Analytics

Big Ideas in Mathematics

A Note on General Adaptation in Populations of Painting Robots

Sample Questions Csci 1112 A. Bellaachia

Binary Search Trees (BST)

CS 2112 Spring Instructions. Assignment 3 Data Structures and Web Filtering. 0.1 Grading. 0.2 Partners. 0.3 Restrictions

Data Structure with C

Improving the Performance of a Computer-Controlled Player in a Maze Chase Game using Evolutionary Programming on a Finite-State Machine

Data Structures and Algorithms

Project 2: Character Animation Due Date: Friday, March 10th, 11:59 PM

Algorithms and Data Structures Written Exam Proposed SOLUTION

CHAPTER 6 GENETIC ALGORITHM OPTIMIZED FUZZY CONTROLLED MOBILE ROBOT

International Journal of Advanced Research in Computer Science and Software Engineering

SOFTWARE TESTING STRATEGY APPROACH ON SOURCE CODE APPLYING CONDITIONAL COVERAGE METHOD

Lecture 10: Regression Trees

Prentice Hall Algebra Correlated to: Colorado P-12 Academic Standards for High School Mathematics, Adopted 12/2009

Genetic programming with regular expressions

Vector storage and access; algorithms in GIS. This is lecture 6

SOME EXCEL FORMULAS AND FUNCTIONS

An innovative application of a constrained-syntax genetic programming system to the problem of predicting survival of patients

A Genetic Algorithm-Evolved 3D Point Cloud Descriptor

Current Standard: Mathematical Concepts and Applications Shape, Space, and Measurement- Primary

A binary search tree is a binary tree with a special property called the BST-property, which is given as follows:

Heuristics for the Sorting by Length-Weighted Inversions Problem on Signed Permutations

Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay

Algorithms and Data Structures

Engineering Problem Solving and Excel. EGN 1006 Introduction to Engineering

Class Notes CS Creating and Using a Huffman Code. Ref: Weiss, page 433

Grammatical Differential Evolution

Automatic Generation of a Neural Network Architecture Using Evolutionary Computation

I PUC - Computer Science. Practical s Syllabus. Contents

Original Article Efficient Genetic Algorithm on Linear Programming Problem for Fittest Chromosomes

Converting a Number from Decimal to Binary

River Dell Regional School District. Computer Programming with Python Curriculum

D A T A M I N I N G C L A S S I F I C A T I O N

Big Data and Scripting. Part 4: Memory Hierarchies

Expression. Variable Equation Polynomial Monomial Add. Area. Volume Surface Space Length Width. Probability. Chance Random Likely Possibility Odds

Genetic Algorithms and Sudoku

The Use of Evolutionary Algorithms in Data Mining. Khulood AlYahya Sultanah AlOtaibi

A Genetic Algorithm Processor Based on Redundant Binary Numbers (GAPBRBN)

Content. Chapter 4 Functions Basic concepts on real functions 62. Credits 11

Why? A central concept in Computer Science. Algorithms are ubiquitous.

Classification/Decision Trees (II)

ESQUIVEL S.C., GATICA C. R., GALLARD R.H.

Binary Search Trees CMPSC 122

Thnkwell s Homeschool Precalculus Course Lesson Plan: 36 weeks

CSE 326: Data Structures B-Trees and B+ Trees

MATH 0110 Developmental Math Skills Review, 1 Credit, 3 hours lab

Symbol Tables. Introduction

Previous Lectures. B-Trees. External storage. Two types of memory. B-trees. Main principles

Lecture 6: Binary Search Trees CSCI Algorithms I. Andrew Rosenberg

AS part of the development process, software needs to

Genetic modification for cell pedigree labels to aid disease treatment

Analysis of Algorithms I: Optimal Binary Search Trees

YOU CAN COUNT ON NUMBER LINES

Measuring the Performance of an Agent

Lecture 1: Course overview, circuits, and formulas

Optimal Binary Search Trees Meet Object Oriented Programming

Binary Search Trees. Data in each node. Larger than the data in its left child Smaller than the data in its right child

A Robust Method for Solving Transcendental Equations

Evolutionary SAT Solver (ESS)

A Parallel Processor for Distributed Genetic Algorithm with Redundant Binary Number

X On record with the USOE.

The following themes form the major topics of this chapter: The terms and concepts related to trees (Section 5.2).

BASIC STATISTICAL METHODS FOR GENOMIC DATA ANALYSIS

Fast Sequential Summation Algorithms Using Augmented Data Structures

Biological Sciences Initiative. Human Genome

Comparison of Major Domination Schemes for Diploid Binary Genetic Algorithms in Dynamic Environments

Rotation Operation for Binary Search Trees Idea:

ALLIED PAPER : DISCRETE MATHEMATICS (for B.Sc. Computer Technology & B.Sc. Multimedia and Web Technology)

Using Adaptive Random Trees (ART) for optimal scorecard segmentation

Heaps & Priority Queues in the C++ STL 2-3 Trees

Comparison of algorithms for automated university scheduling

North Carolina Math 2

Binary Heaps * * * * * * * / / \ / \ / \ / \ / \ * * * * * * * * * * * / / \ / \ / / \ / \ * * * * * * * * * *

Common Core Unit Summary Grades 6 to 8

Estimated Pre Calculus Pacing Timeline

Accentuate the Negative: Homework Examples from ACE

Lecture Notes on Binary Search Trees

Introduction To Genetic Algorithms

New Modifications of Selection Operator in Genetic Algorithms for the Traveling Salesman Problem

South Carolina College- and Career-Ready (SCCCR) Pre-Calculus

Arithmetic Coding: Introduction

Logic in Computer Science: Logic Gates

FUNDAMENTALS OF MACHINE LEARNING FOR PREDICTIVE DATA ANALYTICS Algorithms, Worked Examples, and Case Studies

Physical Data Organization

Transcription:

6 Creating the Animation Now that the animation can be represented, stored, and played back, all that is left to do is understand how it is created. This is where we will use genetic algorithms, and this chapter will describe how the various stages of G.A. evolution were implemented. 6.1 Genotype The solution we are trying to optimize is the animation program. In our G.A., then, the chromosome needs to encode data that corresponds to the two animation representations discussed in Chapter 4. 6.1.1 Sequence of Commands An op-code can be represented by something as simple as a single integer number. Let us imagine a character whose body is composed of 2 springs and 3 claws. As displayed in Figure 6.1, there are twelve valid op-codes for that character. Generalizing for a character with N S springs and N C claws, there will be 3N S + 2N C valid op-codes. (Naturally, this quantity will be different if the character includes other active components, such as angular springs.) Any integer number greater than the number of valid op-codes can be interpreted as a nothing op-code that is, a command that simply maintains the current physical properties of springs, angular springs, motors, etc. numbers. The DNA of the animation, then, is a variable-length list of integer

Motion Synthesis for Non-Humanoid Virtual Characters 35 1. Set spring #1 state: CONTRACTED 2. Set spring #1 state: RELAXED 3. Set spring #1 state: STRETCHED 4. Set spring #2 state: CONTRACTED 5. Set spring #2 state: RELAXED 6. Set spring #2 state: STRETCHED 7. Set claw #1 state: GRIPPING 8. Set claw #1 state: RELEASED 9. Set claw #2 state: GRIPPING 10. Set claw #2 state: RELEASED 11. Set claw #3 state: GRIPPING 12. Set claw #3 state: RELEASED Figure 6.1: Valid op-codes for a character with two springs and three claws. 6.1.2 Expression Tree As the name suggests, this representation is best suited to a tree-like data structure. Our implementation was influenced by [Koza 1992] and the guidelines established therein. Specifically: Programs are represented by expression trees; Non-leaf nodes in the tree are unary, binary, or ternary operators (see Figure 6.2); Leaf nodes in the tree are either constants or variables (see Figure 6.3); A strict structure is enforced, that is, the arity (number of children) and type (Boolean or number) of all nodes is maintained consistent. The tree will never have, for instance, a Boolean constant inserted as a child of an arithmetic operator, or a subtraction with three arguments. The DNA of the animation, then, is a fixed-size list of expression trees one for each active component (spring, motor, etc.) in the character s body.

Motion Synthesis for Non-Humanoid Virtual Characters 36 Unary operators: These nodes have only one child. Logical not (receives Boolean, returns Boolean): Inverts the value returned by the evaluated subtree. Math function (receives number, returns number): These nodes are associated with a specific mathematical function (cosine, sine, square root, natural logarithm, or exponential). When evaluated, they take the value returned by the subtree, apply that function to it, and then return the modified value. Negation (receives number, returns number): Inverts the sign (positive or negative) of the value returned by the evaluated subtree. Binary operators: These nodes must have two children. Comparator (receives two numbers, returns Boolean): These nodes are associated with a specific arithmetic comparison operator ( greater, greater or equal, less, or less or equal ). When evaluated, they take the values returned by their two subtrees, compare them with the operator, and then return true or false. Logical operator (receives two Booleans, returns Boolean): These nodes are associated with a specific Boolean operator ( and, or, or exclusive or ). When evaluated, they take the values returned by their two subtrees, combine them with the operator, and then return the resulting value. Math operator (receives two numbers, returns number): As above, but with mathematical functions (sum, subtraction, multiplication, division, exponentiation). Ternary operators: These nodes represent if-then-else branches, and take three children. Boolean if (receives three Booleans): When evaluated, this node takes the value returned by the first subtree. If it is true, it evaluates the second subtree, otherwise, it evaluates the third subtree. This node, then, always returns a Boolean value. Arithmetic if (receives a Boolean and two numbers): Similar to the above, but always returns a number value. Figure 6.2: Non-leaf nodes, or operators, used in the expression trees.

Motion Synthesis for Non-Humanoid Virtual Characters 37 Constants: Nodes that always return a fixed value. Boolean constants: The values true and false. Number constants: Any real number. Variables: Nodes whose evaluation depends on the character s current state. Bone-floor contact (Boolean): These nodes are associated with a specific bone on the character. When evaluated, they return true if the bone is touching the floor. Joint angle (number): These nodes are associated with a specific joint on the character. When evaluated, they return the angle, in degrees, between the two bones connected to the joint. Bone elevation angle (number): These nodes are associated with a specific bone on the character. When evaluated, they return the angle, in degrees, between the ground plane and the bone s current orientation. Bone-bone azimuth angle (number): These nodes are associated with a pair of bones on the character. When evaluated, they return the angle, in degrees, between the two bones current orientations along the ground plane. (Note that this variable does not exist in the 2D case.) Figure 6.3: Leaf nodes, or terminals, used in the expression trees. 6.2 Evaluation The evaluation stage is where a genotype is analyzed and scored based on how good a solution it is. This usually involves decoding the information in the genotype to get a phenotype, and then measuring some property of it. We chose to measure the distance traversed by the character during a ten-second interval while the animation plays. We hoped this would direct the evolution towards walking or running animations. 6.3 Crossover and Mutation The crossover operator is responsible for exchanging data between two solutions (parents) to create two new solutions (children). The mutation operator is responsible for slightly modifying the solution in a random manner to avoid stagnation in the evolution process. These operators are heavily

Motion Synthesis for Non-Humanoid Virtual Characters 38 dependant on the genotype representation, so we had to devise two very different strategies for our two representations. 6.3.1 Sequence of Commands The crossover operator of choice is the one-point crossover (see Figure 6.4). This method is useful because it recombines the two animations without completely destroying the parents sequencing of op-codes. Figure 6.4: One-point crossover. Each of the parent chromosomes is cut at a random point to create two sub-sequences; by swapping the sub-sequences, two new chromosomes are created. random: When applying the mutation operator, one of four methods is chosen at Swap: Two op-codes in the sequence are selected and their positions are swapped. Destroy: An op-code in the sequence is removed. Create: A position in the sequence is chosen to insert a new random op-code, which may be valid or invalid ( nothing op-code). Flip: An op-code in the sequence is selected and replaced with a new random op-code. As above, the new op-code may or may not be valid.

Motion Synthesis for Non-Humanoid Virtual Characters 39 6.3.2 Expression Trees In this case, one chromosome actually consists of several trees (one tree for each active body component). We reckoned that each tree should follow its own evolutionary process, and it did not make sense to cross trees belonging to different components. Thus, when breeding two chromosomes, we apply the crossover operator to pairs of trees belonging to the same component (see Algorithm 4). Algorithm 4 The function CrossControllers breeds and returns two child animations, nicknamed bro and sis. CrossTrees, whose implementation is not shown here, is a function that receives two trees (parents) and returns two new trees (children). function CrossControllers(mom, dad) bro empty tree list sis empty tree list for each component i in the character do bro[i], sis[i] CrossTrees(mom[i], dad[i]) end for return bro, sis end function When performing the crossover of expression trees, we chose the one-point crossover operator again (see Figure 6.5). However, care needs to be taken when selecting the crossover point: Because we enforce a type-safe structure in the tree, the crossover must avoid grafting a branch in an incompatible point (e.g., exchanging a Boolean-type node with a number-type node). To fulfill this requirement, we first select a random edge from the mom tree, then perform a search in the dad tree and collect all edges that are compatible with mom s selected edge. From that subset, we select a random edge that will be the crossover point in dad. Mutation is is performed on a node-by-node basis, that is, if the algorithm is run with a mutation probability of p mut then every node in the tree has p mut

Motion Synthesis for Non-Humanoid Virtual Characters 40 Figure 6.5: One-point crossover for tree structures. Each of the parent trees is cut at a random point, and their branches are swapped to create two new chromosomes. chance of mutation according to the following behaviors: Variable terminals mutate by pointing to a different component (e.g., a bone-floor contact node associated with the contact status of bone #2 will change to be associated with the contact status of bone #4). Constant terminals mutate by changing their value to some other random value. If-then-else nodes mutate by swapping the edges then and else (and, by extension, their subtrees). Since these two edges are always of the same type, this operation is type-safe. Unary operators mutate by changing their function (e.g., a sine node may change to perform a negation instead). Binary operators mutate by changing their function (e.g., an and node may change to perform an exclusive or instead) and/or swapping their two edges (e.g., a b may become b a).