European Robotic LABoratory EURLAB European Robotic LABoratory Basic knowledge x.x: Algorithm EURLAB Basic knowledge x.x - Algorithm
Think about the actions we take in our lives! Almost always we can represent them as a succession of individual steps: EURLAB Basic knowledge x.x - Algorithm
Example 1: watch a movie on TV Sit on the sofa Turn on the TV Watch the movie Turn off the TV Get up from the sofa EURLAB Basic knowledge x.x - Algorithm
Example 2: programming a robot to walk a square Move straight for 3 sec Turn right 90° EURLAB Basic knowledge x.x - Algorithm
So, we can give a proper and simple definition of 'ALGORITHM' An ALGORITHM is a procedure that solves a specific problem through a finite number of elementary steps (Wikipedia) The term comes from the name of the Persian mathematician Al-Khwarizmi, which is considered one of the first authors to have made reference to this concept EURLAB Basic knowledge x.x - Algorithm
In the example n°1: the guy must knows how ‘TO POWER ON THE TV’ Three are the necessary properties of an algorithm, without which it can not be defined as such: NOT AMBIGUOUS: steps constituents must be interpreted in a direct and clear way by the performer ; In the example n°1: the guy must knows how ‘TO POWER ON THE TV’ In the example n°2: the robot must knows how ‘Turn right 90°’ EURLAB Basic knowledge x.x - Algorithm
Obvious in the three examples…: Three are the necessary properties of an algorithm, without which it can not be defined as such: FINITENESS: the algorithm must be composed of a finite number of steps and require a finite amount of input data; Obvious in the three examples…: 1- the movie must end before the guy dies…!!! 2- the robot must travel the square in reasonable time…!!! EURLAB Basic knowledge x.x - Algorithm
Three are the necessary properties of an algorithm, without which it can not be defined as such: DETERMINISTIC: the algorithm must always lead to the same result each time it is run with the same data input Every time robot runs algoritm he must succeed in walking the square !! EURLAB Basic knowledge x.x - Algorithm
How to represent an algorithm Of course you can represent an algorithm as a numbered sequence of statements, as in previous examples. Instead, the most common way of representing an algorithm is by the ‘flow chart’. A flow chart is a graphic representation, where: each steps is represented by conventional shapes (rectangles, rounded ...), each with a specific meaning and logic within which an indication text typically describes the activities to be performed shapes are linked by arrows, so establishing the execution order of actions. INPUT/OUTPUT OF DATA ACTION STOP START EURLAB Basic knowledge x.x - Algorithm
Example 1: watch a movie on TV START SIT ON THE SOFA OPEN TV WATCH THE MOVIE CLOSE TV GET UP FROM THE SOFA STOP EURLAB Basic knowledge x.x - Algorithm
Example 2: walk a square START STOP Turn right 90° Turn right 90° Go straight Turn right 90° Go straight Turn right 90° Go straight Turn right 90° Go straight Turn right 90° STOP EURLAB Basic knowledge x.x - Algorithm
Previous algorithm seem to you enough ‘INTELLIGENT’ ? read more…… EURLAB Basic knowledge x.x - Algorithm