EE459 I ntroduction to Artificial I ntelligence Genetic Algorithms Practical Issues: Representations.

Slides:



Advertisements
Similar presentations
Chapter 2: Data Representation
Advertisements

©Brooks/Cole, 2003 Chapter 4 Operations on Bits. ©Brooks/Cole, 2003 Apply arithmetic operations on bits when the integer is represented in two’s complement.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Chapter 1.7 Storing Fractions. Excess Notation, continued… In this notation, "m" indicates the total number of bits. For us (working with 8 bits), it.
Evolutionary Computational Intelligence
Assembly Language and Computer Architecture Using C++ and Java
Signed Numbers.
M68K Assembly Language Programming Bob Britton Chapter 12 IEEE Floating Point Notice: Chapter slides in this series originally provided by B.Britton. This.
Assembly Language and Computer Architecture Using C++ and Java
2-1 Computer Organization Part Fixed Point Numbers Using only two digits of precision for signed base 10 numbers, the range (interval between lowest.
1 CSE1301 Computer Programming Lecture 28 Number Representation (Integer)
Signed Numbers CS208. Signed Numbers Until now we've been concentrating on unsigned numbers. In real life we also need to be able represent signed numbers.
Number Representation Rizwan Rehman, CCS, DU. Convert a number from decimal to binary notation and vice versa. Understand the different representations.
Number Systems Lecture 02.
Operations on data CHAPTER 4.
Binary Representation - Shortcuts n Negation x + x = 1111…1111 two = -1 (in 2’s complement) Therefore, -x = x + 1 n Sign Extension o Positive numbers :
Computer Organization & Programming Chapter2 Number Representation and Logic Operations.
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Lecture for Week Spring.  Numbers can be represented in many ways. We are familiar with the decimal system since it is most widely used in everyday.
Data Representation – Binary Numbers
1 Lecture 5 Floating Point Numbers ITEC 1000 “Introduction to Information Technology”
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
Number Systems So far we have studied the following integer number systems in computer Unsigned numbers Sign/magnitude numbers Two’s complement numbers.
Computing Systems Basic arithmetic for computers.
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles of Computer.
Digital Logic Design Lecture 3 Complements, Number Codes and Registers.
1 Problem Solving using computers Data.. Representation & storage Representation of Numeric data The Binary System.
Data Representation in Computer Systems
9.4 FLOATING-POINT REPRESENTATION
Computer Arithmetic and the Arithmetic Unit Lesson 2 - Ioan Despi.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Genetic algorithms Charles Darwin "A man who dares to waste an hour of life has not discovered the value of life"
Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.
Fixed and Floating Point Numbers Lesson 3 Ioan Despi.
Round-off Errors and Computer Arithmetic. The arithmetic performed by a calculator or computer is different from the arithmetic in algebra and calculus.
©Brooks/Cole, 2003 Chapter 4 Operations on Bits. ©Brooks/Cole, 2003 Apply arithmetic operations on bits when the integer is represented in two’s complement.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
COMP201 Computer Systems Floating Point Numbers. Floating Point Numbers  Representations considered so far have a limited range dependent on the number.
Floating Point Arithmetic
How a Computer Processes Information. Java – Numbering Systems OBJECTIVE - Introduction to Numbering Systems and their relation to Computer Problems Review.
Programming Logic Controllers Number Systems and Codes - Chapter 3.
AEEE2031 Data Representation and Numbering Systems.
Computer Organization and Design Information Encoding II Montek Singh Wed, Aug 29, 2012 Lecture 3.
Sep 29, 2004Subtraction (lvk)1 Negative Numbers and Subtraction The adders we designed can add only non-negative numbers – If we can represent negative.
Data Representation in Computer Systems. 2 Signed Integer Representation The conversions we have so far presented have involved only positive numbers.
EE749 I ntroduction to Artificial I ntelligence Genetic Algorithms The Simple GA.
CS1Q Computer Systems Lecture 2 Simon Gay. Lecture 2CS1Q Computer Systems - Simon Gay2 Binary Numbers We’ll look at some details of the representation.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
Binary Arithmetic.
Arithmetic Operations
EE459 I ntroduction to Artificial I ntelligence Genetic Algorithms Practical Issues: Selection.
© Prepared By: Razif Razali 1 CHAPTER TWO TCS1023 NUMBERING SYSTEM.
Chapter 4 Operations on Bits. Apply arithmetic operations on bits when the integer is represented in two’s complement. Apply logical operations on bits.
Computer Organization 1 Data Representation Negative Integers.
Lecture No. 4 Computer Logic Design. Negative Number Representation 3 Options –Sign-magnitude –One’s Complement –Two’s Complement  used in computers.
Counters In digital logic and computing, a counter is a device which stores (and sometimes displays) the number of times a particular event or process.
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
COSC2410: LAB 2 BINARY ARITHMETIC SIGNED NUMBERS FLOATING POINT REPRESENTATION BOOLEAN ALGEBRA 1.
Department of Computer Science Georgia State University
Negative Numbers and Subtraction
Chapter 4 Operations on Bits.
Subtraction The arithmetic we did so far was limited to unsigned (positive) integers. Today we’ll consider negative numbers and subtraction. The main problem.
CS 101 – Sept. 4 Number representation Integer Unsigned √ Signed √
Number Representation
Chapter 3 DataStorage Foundations of Computer Science ã Cengage Learning.
Genetic algorithms: case study
COMS 161 Introduction to Computing
靜夜思 床前明月光, 疑是地上霜。 舉頭望明月, 低頭思故鄉。 ~ 李白 李商隱.
1.6) Storing Integer: 1.7) storing fraction:
Presentation transcript:

EE459 I ntroduction to Artificial I ntelligence Genetic Algorithms Practical Issues: Representations

Simple Binary In the standard GA, a binary encoding is used to represent each variable being optimised  (x,y) requires two binary variables If we are working over a range that requires an exact number of binary bits, this is easy for example, maximising the function  (x) = x 2, with x being an integer over the range 0 to 31 0 to 31 requires 5 binary bits (because 2 5 = 32) = = 1 … = 31

More Complex Cases If required, we can add an offset as well e.g. x  [1 32] or x  [ ] still require only 5 bits x  [1 32]  x  [0 31] + 1 x  [ ]  x  [0 31] = = 146 … = 176 But what if the range is not an exact power of 2? e.g. in the biscuit example: x, y  [1,9] nine numbers to represent, so four bits are required

Clipping If the number to be represented varies from M to N, for example from 1 to 9 the first N-M (8) bit patterns represent M to N-1 (1 to 8) the rest represent N (9) 0000 = = = = 9 … … 0111 = = 9 Clipping has one bit pattern for each number apart from the last, which can cause problems the last number is more likely to occur than others

Scaling Scaling (partially) solves this problem for x in the range M to N, using L bits use x = INT(b * ((N-M) / (2 L - 1))) + M where b is the normal binary equivalent of the encoding e.g. for x  [1 9]; x = INT(b * (8/15)) = = = = = = = = = = = = = = = = 9

Fitness Penalty The last alternative is to just let the variable vary over the full range of the binary representation, but to set the fitness function to zero for all values outside the allowable range, e.g. Note: this does not work in all cases assumes ‘roulette’ selection with fitness > 0

Approximate Floating-Point If the exact precision of the figures is not too important, then just divide a binary range of the appropriate size into intervals for example, to maximise  (x) = x 2 to 3 decimal places, with x over the range to decimal places requires 1000 numbers nearest power of 2 is 1024 ( = 2 10 ) 10 bits required for decimal point + 5 bits required for range 15 bits gives a number between 0 and x = x b / 1024 gives x to approx. 3 d.p.s

Exact Floating-Point If an ‘exact’ floating-point precision is required, then probably a method similar to binary scaling is the best option For example to represent (exactly) the numbers 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9 use the same coding scheme as shown for the scaling example previously, including using an ‘INT’ function to remove fractions, and then divide by ten Think carefully about the representation used remember that floating-points are not exact!

Gray Code With a standard binary representation, it is difficult for a GA to add (subtract) 1 from certain numbers e.g (63) to (64) requires seven changes to the bit pattern this can cause the binary GA to get ‘stuck’ One solution is to use a new coding scheme in which each successive number is represented by a bit pattern which is only one bit different from the previous number such coding schemes are call gray codes

Gray Code Example Binary 0000 = = = = = = = = = = = = = = = = 15 Gray 0000 = = = = = = = = = = = = = = = = 15 Gray code: flip the rightmost bit that generates a pattern that is different from all the previous ones

Generating Gray Code To generate a gray code from a binary code assume the binary code is N bits long bits are numbered 1 to N, where 1 is the leftmost bit gray(1)= binary(1); for i = 2:N gray(i)= binary(i-1) XOR binary(i); end binary(1)= gray(1); for i = 2:N binary(i)= binary(i-1) XOR gray(i); end A = [ ]; gray= (A * binary) MOD 2; binary= (INV(A) * gray) MOD 2; looping methodmatrix method (e.g. 8 bits)