On-Line AdaptiveNeuro-Fuzzy Control
On-Line AdaptiveNeuro-Fuzzy Control
Jyh-Shing Roger Jang
>> 1995>> matlab conference
>> 1995>> matlab conference
2
OutlineOutline
Fuzzy sets, membership functions
Fuzzy if-then rules, fuzzy inference systems
ANFIS - Adaptive Neuro-Fuzzy Inference Systems
ANFIS in FLT
Demos• Inverse learning• Feedback linearization
>> 1995>> matlab conference
3
Fuzzy SetsFuzzy Sets
Sets with fuzzy boundaries
Membershipfunction
Heights5’6’’??6’0’’??
.5
.9
Heights5’6’’??
1.0
Crisp set A Fuzzy set A1.0
A = Set of tall people
>> 1995>> matlab conference
4
Fuzzy Sets: Math FormulationFuzzy Sets: Math Formulation
A = Set of tall people in this room
= {(5'8'', 0.5), (5'9'', 0.6), (5'10'', 0.7), ...}
= {(x, mA(x))}
>> 1995>> matlab conference
5
Membership Functions (MFs)Membership Functions (MFs)
About MFs• Subjective measures• Not probability functions
MFs
Heights5’10”
.5
.8
.1
“tall” in Taiwan
“tall” in the US
“tall” in NBA
>> 1995>> matlab conference
6
Fuzzy If-Then RulesFuzzy If-Then Rules• Mamdani style
If pressure is high then volume is small
• Sugeno styleIf speed is medium then resistance = 5*speed
high small
mediumresistance = 5*speed
>> 1995>> matlab conference
7
Fuzzy Inference System (FIS)Fuzzy Inference System (FIS)
If speed is low then resistance = 2If speed is medium then resistance = 4*speedIf speed is high then resistance = 8*speed
Rule 1: w1 = .3; r1 = 2Rule 2: w2 = .8; r2 = 4*2Rule 3: w3 = .1; r3 = 8*2
Speed2
.3
.8
.1
low medium high
resistance = S(wi*ri) / Swi = 7.12
MFs
>> 1995>> matlab conference
9
First-Order Sugeno FISFirst-Order Sugeno FIS• Rule base
If X is A1 and Y is B1 then Z = p1*x + q1*y + r1If X is A2 and Y is B2 then Z = p2*x + q2*y + r2
• Fuzzy reasoning
A1 B1
A2 B2
x=3
X
X
Y
Yy=2
w1
w2
z1 =p1*x+q1*y+r1
z =
z2 =p2*x+q2*y+r2
w1+w2w1*z1+w2*z2
P
>> 1995>> matlab conference
10
Fuzzy ModelingFuzzy Modeling
• Given desired i/o pairs (training data set) of the form (x1, ..., xn; y), construct a FIS to match the i/o pairs
• Two steps in fuzzy modeling structure identification --- subclust.m parameter identification --- anfis.m
Unknown target system
Fuzzy Inference system
y
y*
x1
xn
. . .
>> 1995>> matlab conference
11
Neuro-Fuzzy ModelingNeuro-Fuzzy Modeling
Basic approach of ANFIS
Adaptive networks
Neural networks Fuzzy inferencesystems
Generalization Specialization
ANFIS
>> 1995>> matlab conference
12
ANFISANFIS• Fuzzy reasoning
• ANFIS (Adaptive Neuro-Fuzzy Inference System)
A1 B1
A2 B2
w1
w2
z1 =p1*x+q1*y+r1
z2 =p2*x+q2*y+r2
z = w1+w2w1*z1+w2*z2
A1
A2
B1
B2
P
P
S
S
/
x
y
w1
w2
w1*z1
w2*z2
Swi*zi
Swi
z
x y
>> 1995>> matlab conference
13
Hybrid Learning Rule in ANFISHybrid Learning Rule in ANFIS
Hybrid learning rule combines• Backpropagation gradient descent• Least-squares estimator (LSE)
Two modes of hybrid learning rule:• Off-line learning
- System identification• On-line learning
- On-line adaptive control
>> 1995>> matlab conference
14
FIS data structure in FLTFIS data structure in FLT
FIS file and FIS matrix
FIS file(on disk)
FIS D ata S tructure
M F 1L ab e l: S m all
Typ e : G au ss ianP aram s : [5 -1 0 ]
M F 2L ab e l: L a rg e
Typ e: Trian g leP aram s : [-5 1 0 2 0 ]
[In p u t 1 ]N am e: P os it ionR an g e : [-1 0 1 0 ]
M F # : 2
M F 1L ab e l: S m allTyp e : G b e ll
P aram s : [5 2 -4 0 ]
M F 2L ab e l: L a rg e
Typ e: SP aram s : [-5 0 0 5 0 ]
[In p u t 2 ]N am e: V e loc ityR an g e : [-5 0 5 0 ]
M F # : 2
M F 1L ab e l: N eg . B ig
Typ e : ZP aram s : [-1 0 -5 0 ]
M F 2L ab e l: N eg . S m all
Typ e : G b e llP aram s : [5 2 -3 ]
M F 3L ab e l: P os , S m all
Typ e : G b e llP aram s : [5 2 3 ]
M F 4L ab e l: P os . B ig
Typ e : SP aram s : [0 5 1 0 ]
[O u tp u t 1 ]N am e: F orce
R an g e : [-1 0 1 0 ]M F # : 4
[R u les ]R u le lis t
R u le w e ig h tsR u le typ es
[S ys tem ]N am e: m am 2 1Typ e: m am d an i
. . .
FIS matrix(in workspace)
readfiswritefis
>> 1995>> matlab conference
15
From Data Sets to FISFrom Data Sets to FIS
Flow chart: From data sets to FIS
FLTGUI tools
genfis1.m
genfis2.m
anfis.mTrainingdata
Initial FIS
Trainingdata
Checkingdata
Final FIS
>> 1995>> matlab conference
16
ANFIS in FLT - NowANFIS in FLT - Now
Restrictions of ANFIS in FLT v1• Single learning rule• Single learning mode• Single rule output type: Linear outputs
>> 1995>> matlab conference
17
ANFIS in FLT - NextANFIS in FLT - Next
ANFIS in FLT v2• Multiple learning rules: Levenberg-Marquardt,
Gauss-Newton, etc. • Two learning modes: Both off-line and on-line• Output types: Both linear and constant outputs• New SIMULINK blocks: On-line ANFIS block
>> 1995>> matlab conference
18
On-Line ANFIS Block in SIMULINKOn-Line ANFIS Block in SIMULINK
Function• Take an input/output data pair and do incremental
parameter updates.
Used when• The plant under control is time-varying.• We want to have an interpretable controller.
Theoretical background• Similar to other nonlinear adaptive controllers
>> 1995>> matlab conference
19
Demo 1: Inverse LearningDemo 1: Inverse Learning
Plant
ANFIS
Training
Application
ukxk+1 = f(xk, uk)
xk
xk+1
+-
Plant
ANFIS
xk+1xk
ukxk, d
-1z
-1z
unit-delay system
xk+1 = xk,d
>> 1995>> matlab conference
20
Demo 1: Inverse LearningDemo 1: Inverse Learning
Properties of inverse learning• Exact plant model is not needed, but it has to have
an inverse model• Inversibility is controllability for linear plants
Demo• xk+1 = xkuk/(1+xk ) - tan(uk)• Four-rule ANFIS is used to implement the inverse
mapping from (xk, xk+1) to uk.
2
>> 1995>> matlab conference
21
Demo 2: Feedback LinearizationDemo 2: Feedback Linearization
xk+1 = f(xk, xk-1) + uk
unknown and time-varying
Feedback linearizable plant:
Feedback law: uk = - F(xk, xk-1) + axk + bxk-1 + rk
Close-loop system: xk+1 = f(xk, xk-1) - F(xk, xk-1) + axk + bxk-1 + rk
ANFIS
close to zero
>> 1995>> matlab conference
22
Demo 2: Feedback LinearizationDemo 2: Feedback Linearization
Properties of feedback linearization• Exact plant model is not needed, but it has to be of
linearizable form.• Global stability is guaranteed when used with
sliding mode control.
>> 1995>> matlab conference
23
Demo 2: Feedback LinearizationDemo 2: Feedback Linearization
Demo• xk+1 = cxkxk-1(xk+2.5)/(1+xk+xk-1) + uk
f, unknown and time-varying
• Four-rule ANFIS is used to approximate f
• Desired model: xk+1 = 0.6xk + 0.2xk-1 + uk