Upload
dwayne-ray
View
227
Download
5
Tags:
Embed Size (px)
Citation preview
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
1
Hardware/Software Codesign of
Embedded Systems
OPTIMIZATION Voicu Groza SITE Hall, Room 5017
562 5800 ext. [email protected]
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
2
Dominance, Pareto Points
• A (design) point Jk is dominated by Ji, if Ji is– better or equal than Jk in all criteria and– better in at least one criterion.
• A point is Pareto-optimal or a Pareto-point, if it is not dominated.
• The domination relation imposes a partial order on all design points– We are faced with a set of optimal solutions.– Divergence of solutions vs. convergence.
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
3
Multiobjective Optimization • Maximize (y1, y2, …, yk) = ƒ(x1, x2, …, xn)
•Pareto set = set of all Pareto-optimal solutions
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
4
Multi-objective Optimization
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
5
Design Space, Pareto Points• The task graph shows a system specification with four tasks, T1 ...T4.
The tasks can be executed on different components.
• The following table displays the execution times for the tasks on the different components as well as the component cost.
For example, the MIPS processor costs 200 units and can run tasks T1 in 5 ms and task T4 in 2 ms.
The table shows also the number of components available for each component type (MIPS, DSP, FPGA and ASIC).
• All components execute tasks sequentially – at any given time a component executes at most one task. Task execution is non-preemptive – once a task is started, it runs to completion.
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
6
A design point consists of an allocation (selection of components), a binding (assignment of tasks to selected components) and a schedule (execution order for the tasks). Determine the total cost and execution time for each design point.
Pareto Points(a) Construct the design space by
listing all possible design points.
(b) Draw the design points in a cost-time diagram. Which design points are Pareto points?
T1
T2
T3
T4
Costtexec
cost
texec (ms)
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
7
Pareto Points(c) Consider an allocation without resource constraints. That means
we are given an arbitrarily high number of components of each type (MIPS, DSP, FPGA and ASIC). Are there new design points?
Does the set of Pareto points change?
T1
T2
T3
T4
Costtexec
cost
texec
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
8
Genetic Algorithms• Directed search algorithms based on the mechanics
of biological evolution• Developed by John Holland, University of Michigan
(1970’s)– To understand the adaptive processes of natural systems– To design artificial systems software that retains the
robustness of natural systems• Provide efficient, effective techniques for
optimization and machine learning applications• Widely-used today in business, scientific and
engineering circles
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
9
Classes of Search Techniques
F inonacc i N ew ton
D irect m ethods Indirec t m ethods
C alcu lus-based techn iques
E volu tionary s trategies
C entra l ized D is tr ibuted
Para l le l
S teady-s ta te G enera tiona l
S equentia l
G enetic a lgori thm s
E volutionary a lgori thm s S im u lated annealing
G uided random search techniques
D ynam ic program m ing
E num erative techn iques
S earch techniques
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
10
Components of a GA
A problem to solve, and ...• Encoding technique (gene, chromosome)
• Initialization procedure (creation)
• Evaluation function (environment)
• Selection of parents (reproduction)
• Genetic operators (mutation, recombination)
• Parameter settings (practice and art)
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
11
GA Algorithmic Phases
Initialize the populationInitialize the population
Select individuals for the mating poolSelect individuals for the mating pool
Perform crossoverPerform crossover
Insert offspring into the populationInsert offspring into the population
The EndThe End
Perform mutationPerform mutation
yesyes
nonoStop?Stop?
ChromosomeChromosome
GeneGene
LocusLocus
PopulationPopulation
PhenotypePhenotype
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
12
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
13
Simple Genetic Algorithm{
initialize population;
evaluate population;
while TerminationCriteriaNotSatisfied{
select parents for reproduction;
perform recombination and mutation;
evaluate population;}
}
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
14
The GA Cycle of Reproduction
reproduction
population evaluation
modification
discard
deleted members
parents
children
modifiedchildren
evaluated children
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
15
Population
Chromosomes could be:– Bit strings (0101 ... 1100)– Real numbers (43.2 -33.1 ... 0.0 89.2) – Permutations of element (E11 E3 E7 ... E1 E15)– Lists of rules (R1 R2 R3 ... R22 R23)– Program elements (genetic programming)– ... any data structure ...
population
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
16
Reproductionreproduction
population
parents
children
Parents are selected at random with selection chances biased in relation to chromosome evaluations.
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
17
Chromosome Modification
modificationchildren
• Modifications are stochastically triggered• Operator types are:
– Mutation– Crossover (recombination)
modified children
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
18
Mutation: Local Modification
Before: (1 0 1 1 0 1 1 0)
After: (0 1 1 0 0 1 1 0)
Before: (1.38 -69.4 326.44 0.1)
After: (1.38 -67.5 326.44 0.1)
• Causes movement in the search space (local or global)• Restores lost information to the population• The Mutation Rate is the chance that a bit within a chromosome will be
flipped. This is usually a very low value for binary encoded genes, say 0.001
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
19
One point crossover is performed by selecting a random gene along the length of the chromosomes and swapping all the genes after that point
10001001110010010 01010001001000011
Crossover is a critical feature of genetic algorithms:– It greatly accelerates search early in evolution of a population– It leads to effective combination of schemata (subsolutions on
different chromosomes)
The Crossover Rate is the chance that two chromosomes will swap their bits. A good value for this is around 0.7.
Crossover: Recombination
* 10001001101000011
01010001010010010
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
20
Two point crossoverTwo point crossover calls for two points to be selected on the parent chromosome strings. Everything between the two points is swapped between the parent organisms, rendering two child organisms:
"Cut and splice"Another crossover variant, the "cut and splice" approach, results in a change in length of the children strings. The reason for this difference is that each parent string has a separate choice of crossover point.
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
21
Evaluation
• The evaluator decodes a chromosome and assigns it a fitness measure
• The evaluator is the only link between a classical GA and the problem it is solving
evaluation
evaluatedchildren
modifiedchildren
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
22
Fitness Function• Quantifies the optimality of a solution (a chromosome) such that
particular chromosome may be ranked against all the other chromosomes. Optimal chromosomes, are allowed to breed and mix their datasets producing a new generation that will (hopefully) be even better.
• An ideal fitness function correlates closely with the algorithm's goal, and may be computed quickly. Speed of execution is very important, as a typical genetic algorithm must be iterated many, many times in order to produce a usable result for a non-trivial problem.
• Definition of the fitness function is not straightforward in many cases and often is performed iteratively if the fittest solutions produced by GA are not what is desired.
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
23
Deletion
• Generational GA:entire populations replaced with each iteration
• Steady-state GA:a few members replaced each generation
population
discard
discarded members
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
24
Stopping Criteria
• Final problem is to decide when to stop execution of algorithm.
• There are two possible solutions to this problem: – First approach:
• Stop after production of definite number of generations
– Second approach: • Stop when the improvement in average fitness
over two generations is below a threshold
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
25
An Abstract Example
Distribution of Individuals in Generation 0
Distribution of Individuals in Generation N
Rennard Genetic Algorithm Viewer 1.0 • http://www.rennard.org/alife/english/gavgb.html
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
26
A Simple Example
The Traveling Salesman Problem:
Find a tour of a given set of cities so that – each city is visited only once– the total distance traveled is minimized
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
27
Representation
Representation is an ordered list of city
numbers known as an order-based GA.
1) London 3) Dunedin 5) Beijing 7) Tokyo
2) Venice 4) Singapore 6) Phoenix 8) Victoria
CityList1 (3 5 7 2 1 6 4 8)
CityList2 (2 5 7 6 8 1 3 4)
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
28
Crossover
• Crossover might combine inversion & recombination; • e.g. given two chromosomes
* *
Parent1 (3 5 7 2 1 6 4 8)
Parent2 (2 5 7 6 8 1 3 4)
Child (8 5 7 2 1 6 3 4)
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
29
Mutation involves reordering of the list: * *
Before: (5 8 7 2 1 6 3 4)
After: (5 8 6 2 1 7 3 4)
• the Crossover Rate is the chance that two chromosomes will swap their bits. A good value for this is around 0.7
Mutation
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
30
TSP Example: 30 Cities
0
20
40
60
80
100
120
0 10 20 30 40 50 60 70 80 90 100
x
y
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
31
Solution i (Distance = 941)TSP30 (Performance = 941)
0
20
40
60
80
100
120
0 10 20 30 40 50 60 70 80 90 100
x
y
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
32
Solution j(Distance = 800)44626967786462544250404038213567606040425099
TSP30 (Performance = 800)
0
20
40
60
80
100
120
0 10 20 30 40 50 60 70 80 90 100
x
y
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
33
Solution k(Distance = 652)TSP30 (Performance = 652)
0
20
40
60
80
100
120
0 10 20 30 40 50 60 70 80 90 100
x
y
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
34
Best Solution (Distance = 420)423835262135327
3846445860697678716967628494
TSP30 Solution (Performance = 420)
0
20
40
60
80
100
120
0 10 20 30 40 50 60 70 80 90 100
x
y
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
35
Overview of PerformanceTSP30 - Overview of Performance
0
200
400
600
800
1000
1200
1400
1600
1800
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
Generations (1000)
Dis
tan
ce
Best
Worst
Average
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
36
GA For Optimal Implementation of Logic Functions in FPGAs
1. Attempting to evolve the minimized logic solution of a logic function
2. The evolution is done through a hardware implementation of a genetic algorithm (GA), while the minimization is one of FPGA look-up tables (LUTs) and logic levels
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
37
System Architecture• Optimizer = ECP Controller
(ECPC)• Host = ECP• Both optimizer and host are PLDs• Optimizer is where function is
evolved• Host is where circuit is tested• Optimizer/Host = Server/Client• Multiple hosts can connect to one
optimizer• Multiple functions can be evolved
on one optimizer
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
38
Optimizer Module1. HIGA (HW implemented GA)
• Much faster because done mostly in H/W
• Adds caveats on the std. GA
2. ECLBs
Evolvable Configuration Logic Blocks
• Where the chromosomes are evaluated for fitness assignment
1. hcache
• Common DB for future use
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
39
Optimizer Architecture
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
40
System Operation
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
41
Figure 5
System Operation
(2)
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
42
FPGA
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
43
Figure 7
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
44
Figure 8
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
45
Issues for GA Practitioners• Choosing basic implementation issues:
– representation– population size, mutation rate, ...– selection, deletion policies– crossover, mutation operators
• Termination Criteria• Performance, scalability• Solution is only as good as the evaluation
function (often hardest part)
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
46
Benefits of Genetic Algorithms
• Concept is easy to understand
• Modular, separate from application
• Supports multi-objective optimization
• Good for “noisy” environments
• Always an answer; answer gets better with time
• Inherently parallel; easily distributed
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
47
Benefits of Genetic Algorithms (cont.)
• Many ways to speed up and improve a GA-based application as knowledge about problem domain is gained
• Easy to exploit previous or alternate solutions
• Flexible building blocks for hybrid applications
• Substantial history and range of use
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
48
When to Use a GA• Alternate solutions are too slow or overly
complicated
• Need an exploratory tool to examine new approaches
• Problem is similar to one that has already been successfully solved by using a GA
• Want to hybridize with an existing solution
• Benefits of the GA technology meet key problem requirements
Voicu Groza, 2008
SITE, 2008 - HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS
49
Some GA Application TypesDomain Application Types
Control gas pipeline, pole balancing, missile evasion, pursuit
Design semiconductor layout, aircraft design, keyboardconfiguration, communication networks
Scheduling manufacturing, facility scheduling, resource allocation
Robotics trajectory planning
Machine Learning designing neural networks, improving classificationalgorithms, classifier systems
Signal Processing filter design
Game Playing poker, checkers, prisoner’s dilemma
CombinatorialOptimization
set covering, travelling salesman, routing, bin packing,graph colouring and partitioning