Bacterial Foraging Optimization
Presented by: Adia Khalid
PhD (Scholar)
Home Energy Optimization in Smart Grid
Supervised by: Dr. Nadeem Javaid
1
Introduction
Foraging strategies
Optimal foraging
Bacterial foraging algorithm
Home energy management
Price signals
Mapping
Agenda
2
Natural selection method
• eliminate animals with poor “foraging strategies”
Foraging strategies
• methods for locating, handling, and ingesting food
• favor those animals that have
• successful foraging strategies
• obtain enough food to enable them to reproduce
• after many generations poor foraging strategies are:
• either eliminated or
• shaped into good ones i.e.. Redesigned
such evolutionary principles have led scientists in the field of “foraging
theory” to hypothesize
• it is appropriate to model the activity of foraging as an optimization
process
Introduction (1\4)
Food Source
Food Quality
Food Capturing
Digesting Food
3
Passino, K. M. (2002). Biomimicry of bacterial foraging for distributed
optimization and control. IEEE control systems, 22(3), 52-67.
Introduction (2\4)
A foraging animal main focus:
• maximize the energy obtained per unit time spent foraging
• In the face of constraints presented by its own
• physiology
• e.g., sensing and cognitive capabilities
• environment
• e.g., density of prey, risks from predators, physical characteristics ofthe search area
Evolution has balanced these constraints
• sometimes referred to as
• optimal foraging policy
• such terminology is especially justified in case
• where the models and policies have been ecologicallyvalidated
4
Foraging focusEnergy
Maximization
Con
strain
ts
o Physiology
o Environment
Passino, K. M. (2002). Biomimicry of bacterial foraging for distributed
optimization and control. IEEE control systems, 22(3), 52-67.
Introduction (3\4)
Optimal Foraging:
• Optimal foraging theory formulates the foragingproblemas an optimization problem.
• Optimization models valid for social foraging
• where groups of animals cooperatively forage
• Here, we explain the biology and physics underlying thechemotactic (foraging) behavior of
• E.coli bacteria for optimization named as Bacterial ForagingOptimization
• Individual bacterium also communicates with others bysending signals
• During foraging of a real bacteria two basic operations
• Swim
• Tumble
• performed by a bacterium at the time of foraging by
• a set of tensile flagella
5
http://wikis.swarthmore.edu/mathbio/index.php?title=File:Optim
al_Foraging_Theory.jpg&limit=50
Passino, K. M. (2002). Biomimicry of bacterial foraging for distributed
optimization and control. IEEE control systems, 22(3), 52-67.
Introduction (4\4)
E.coli bacteria:
• the ones that are living in our intestines
Structure
• Diameter: 1μm
• Length: 2μm
• Flagellum:
• Chemotaxes
• movement in the presence of
• chemical attractants and
repellants
• Counterclockwise:
• Swim
• Clockwise:
• TumbleBactria chemotactic
Movement
6
Passino, K. M. (2002). Biomimicry of bacterial foraging for distributed
optimization and control. IEEE control systems, 22(3), 52-67.
Bacterial Foraging Algorithm (1\2)
7
Chemotaxis:
When a bacterium meets a favorable environment (rich in
nutrients and noxious free),
• it will continuous swimming in the same direction,if nutrient increase in the direction of swim
when it meets an unfavorable environment,• it will tumble, i.e., change the direction of swim
Reproduction:
After calculating fitness value for each bacteria,
• reproduction allows the bacteria to survive and
reproduce
Swarming:
E. Coli bacterium has a specific sensing actuation and
decision making mechanism
• On each move• It releases attracts to signal other bacteria to swarm towards its
Elimination and dispersal:
The chemotaxis provides a basis for local search and
reproduction speeds the convergence
• To avoid trap bacteria in local minimum
• Elimination-Dispersal is done
tumble run run
tumble run tumble
Nature Inspired meta-heurist algorithmA function that ranks
alternatives in search algorithmsat each branching
step based on available
information to decide which branch to follow
Heuristic means local
search, metaheuristic means generalized local search. ...
The main difference is that heuristicsare
problem-specific methods (created to solve a particular problem and probably nothing
else) while meta-heuristics are problem-independent methods that can be applied
to a wide range of problems.
The algorithm models bacterial
• Population: {i ϵ pop, where pop have 1:Np elements}
• Chemotaxis: {for j=1:Nc elements}
• Swarming: {for s=1:Ns elements}
• Reproduction: {for k=1:Nr elements}
• Elimination and Dispersal Steps: {for l=1:Ne step}
• Another parameter
• C: Step Size for the dimension
8
lkjPlkjJlkjiJlkjiJ i
cc ,,,,,),,,(),,,(
idltidlt
idltiClkjlkj
T
ii ,,,,1
1
1
,,,cN
j
i
health lkjiJJ
1
1
222 )1,()),(1,(100d
d
iii
cc dididiJ
Bacterial Foraging Algorithm (2\2)
BFA Mapping on Home Energy Management (HEM)
Target: We have to optimize the energy usage
• By scheduling the home appliances• Pass the on-peak hour load on off-peak hour
Home Energy Management (1/10)
9
BFA Mapping on Home Energy Management (HEM)Optimal Solution get form optimal search space
Search space
Population of group of bacteria's
Home Energy Management (2/10)
10
BFA Parameters HEM Parameters Values
Population Possible solution 30
Bactrians with in a swarm Appliances 9
Bacterium status i.e. dead or alive Appliance’s ON or OFF status 1 or 0
Elimination steps Schedule 24 hour
Fitness Level i.e. min( ) Min (Cost) varyihealth
J
Cost depend on the power rate of an appliance and
price signals
Peak Load Reduction
• Demand Response
• encourage the user to make changes in their demand according to the price signals
Implementation is possibly implemented using some energy measuring consumption measuring meters:
• Bulk meter just save information with a single bulk
• Smart meter record electricity usage information frequently
[*]. Waterloo North Hydro, https://www.wnhydro.com/en/your-home/time-
of-use-rates.asp. Last visited: 20 May 2016.
Home Energy Management (3/10)
11
Meter
Bulk meter
Flat rate Tiered rate
Smart meter
Time based rate
Dynamic
RTP CPP VPP CPR C/I rate
TOUPricing schemes:•Flat Rates - same rate during a given period of time
•E.g., 30-day bill cycle
•Tiered Rates - charge a different price based on blocks of usage
•e.g., first 500 kWh vs. next 500 kWh for 30-day billing cycle
•Time-based rate includes- Dynamic Rate and Time of Use
(TOU)
Dynamic Rate [*]
Real Time Price (RTP)
Critical Peak Pricing (CPP)
Curtailable/Interruptible (C/I)
Variable Peak Pricing (VPP)
Critical Peak Rebate (CPR)
Pricing Scheme[*]
• TOU: Prices set for the on-peak and off-peak hours,
• where hours divided into blocks and price for a particular block remain fixed
• RTP: Rates tariff based on the hourly bases usage of electricity
• Utilities regulates RTP in two parts
1) Base bill
calculated on the bases of define tariff for particular customer depend on
• customer baseline load (CBL)
2) Hourly prices apply according to the customer usage
• that is a difference between actual and CBL
𝑅𝑇𝑃 = ൝𝑃𝑟𝑖𝑐𝑒𝑈𝑛𝑖𝑡 , 𝑖𝑓 𝐿𝑜𝑎𝑑 ≤ 𝑙𝑖𝑚𝑖𝑡
𝑃𝑟𝑖𝑐𝑒𝑈𝑛𝑖𝑡 + 𝐸𝑥𝑡𝑟𝑎𝑐ℎ𝑎𝑟𝑔𝑒 , 𝑖𝑓 𝐿𝑜𝑎𝑑 > 𝑙𝑖𝑚𝑖𝑡……………….. (1)
• The C/I Option: Specifies conditions under which disturbance in service may occur
• A customer gives right to the Local Distribution Company (LDC) during the contract
• not the obligation to disturb the services
• In such situation LDC pays incentive to the customers through bill reduction
[*]. Waterloo North Hydro, https://www.wnhydro.com/en/your-home/time-
of-use-rates.asp. Last visited: 20 May 2016.
Home Energy Management (4/10)
12
0
2
4
6
8
10
12
14
16
18
20
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
TOU
0
5
10
15
20
25
30
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
RTP
Pricing Scheme[*]
• VPP: hybrid TOU and RTP
𝑉𝑃𝑃𝑡𝑜𝑡𝑎𝑙 = 𝑉𝑃𝑃ℎ𝑜𝑢𝑟𝑜𝑛_𝑃𝑒𝑎𝑘
+ 𝑉𝑃𝑃ℎ𝑜𝑢𝑟𝑜𝑓𝑓_𝑃𝑒𝑎𝑘
……………. (2)
𝑉𝑃𝑃ℎ𝑜𝑢𝑟𝑜𝑓𝑓_𝑃𝑒𝑎𝑘 = 𝑇𝑂𝑈 ……………...(2a)
𝑉𝑃𝑃ℎ𝑜𝑢𝑟𝑜𝑛_𝑃𝑒𝑎𝑘 = 𝑅𝑇𝑃 ……………...(2b)
• CPP: Critical events may call during the specific period
• utilities observe high market price rate or during the power system emergency conditions
• Usually occur in hot summer weekdays
• Allow only 15 time per year
• CPR: During the critical event utilities increases the price for the specific time duration
• refunded it to customer
• when utilities observe any reduction in consumption
[*]. Waterloo North Hydro, https://www.wnhydro.com/en/your-home/time-
of-use-rates.asp. Last visited: 20 May 2016.
Home Energy Management (5/10)
13
0
20
40
60
80
100
120
140
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
CPP
BFA Matlab Code
Home Energy Management (6/10)
14
Bacterium\ Appliances Fitness Evolution
Vacuum
Cleaner
Water
Heater
Water
Pump
Dish
Washer
Refrigerator AC Ove
n
Washing
Machine
Cloth
Dryer
Jlast
1 0 0 1 0 1 1 1 1 101
0 1 1 1 1 0 0 0 0 100
1 1 1 1 1 0 0 1 1 99
1 0 1 1 0 0 1 1 0 100
for i=1:NP %
for j=1:D-1
if rand(1)>0.6
X=1;
else
X=0;
end
J(i)=sum(100*(x(k,j+1)-x(i,j)^2)^2+(x(i,j)-1)^2); % initial
fitness calculation
end
end
BFA Matlab Code
Home Energy Management (7/10)
15
Bacterium\ Appliances Fitness Evolution
Vacuum
Cleaner
Water
Heater
Water
Pump
Dish
Washer
Refrigerator AC Ove
n
Washing
Machine
Cloth
Dryer
J
0 1 0 0 0 1 1 0 0 100
1 1 1 0 0 1 1 1 0 110
1 1 0 1 1 1 0 1 0 106
0 0 1 0 1 0 1 0 0 105
for l=1:Ne % 24 l=elimination of dispersal step
for k=1:Nr % 4 k=reproduction
for j=1:Nc % 3 Chemotaxis Loop %
for i=1:Np % for each bacteria
del=(rand(1,D)-0.5)*2;
x(i,:)=x(i,:)+(C/sqrt(del*del'))*del; % C=
0.4 %Direction of Tumble i.e. new position of bacterium
for d=1:D-1J(i)=sum(100*(x(i,d+1)-x(i,d)^2)^2+(x(i,d)-1)^2); %Fitness Evalutin
end
BFA Matlab Code
Home Energy Management (8/10)
16
Bacterium\ Appliances Fitness Evolution
Vacuum
Cleaner
Water
Heater
Water
Pump
Dish
Washer
Refrigerator AC Ove
n
Washing
Machine
Cloth
Dryer
Jlast
0 0 0 1 0 0 1 1 1 100
1 1 0 0 0 1 1 0 1 110
1 1 0 1 1 1 0 1 0 106
0 0 1 0 1 0 1 0 0 105
for m=1:Ns % 2 swimming Step
if J(i)<Jlast(i)%Elimination and Dispersal Check
Jlast(i)=J(i);
x(i,:)=x(i,:)+C*(del/sqrt(del*del')); %Direction of Tumble i.e. new position of bacterium
for d=1:D-1
J(i)=sum(100*(x(i,d+1)-x(i,d)^2)^2+(x(i,d)-1)^2); %Fitness Function
end
else
Updated the
bacterium\ appliances
status
del=(rand(1,D)-0.5)*2;%Vector with random Direction
x(i,:)=x(i,:)+C*(del/sqrt(del*del'));
for d=1:D-1
J(i)=sum(100*(x(i,d+1)-x(i,d)^2)^2+(x(i,d)-1)^2);
end
end
end % end swimming Stepend % end of bacterial population
BFA Matlab Code
Home Energy Management (9/10)
17
Bacterium\ Appliances Cost
Vacuum
Cleaner
Water
Heater
Water
Pump
Dish
Washer
Refrigerator AC Oven Washing
Machine
Cloth
Dryer
Cost
(cent)
0 0 0 1 0 0 1 1 1 48
1 1 0 0 0 1 1 0 1 30
1 1 0 1 1 1 0 1 0 45
0 0 1 0 1 0 1 0 0 50
for i=1:Np %% Check the Health
Cost_B(i)= power_Rate * Electricity_Price
end
end % end of reproduction step
Cost=min(Cost_B) % select best one
Minimum cost will be
selected
BFA Matlab Code
Home Energy Management (10/10)
18
Bacterium\ Appliances Fitness Evolution
Vacuum
Cleaner
Water
Heater
Water
Pump
Dish
Washer
Refrigerator AC Oven Washing
Machine
Cloth
Dryer
J
1 1 0 1 0 1 1 1 0 103
1 0 0 1 0 0 1 0 1 106
0 1 0 1 0 1 0 1 1 100
0 1 1 1 1 0 0 0 0 109
%% random elimination dispersion
for j=1:Np
for i=1:D
if rand(1)>=Ped
x(j,i)=1;
else
x(j,i)=0;
end
for d=1:D-1
J(i)=sum(100*(x(i,d+1)-x(i,d)^2)^2+(x(i,d)-1)^2);
end
end
end
Schedule(l,:)=Cost;
end
19