You are on page 1of 7

RIMENTS ON USING FUZZY CLUSTERING FOR FUZZY CONTROL

SYSTEM DESIGN
Andreja Mikulcic and Jianhua Chen

Computer Science Department


Louisiana State University
Baton Rouge, LA 70803
{ mikulcic, jianhua} @ bit.csc.lsu.edu

We report experiments on using fuzzy clustering


method for fuzzy control system design. We compare, in
the context of the inverted pendulum problem, the "exact"
control surface generated by numerical integration and
modeled control surface generated by the fuzzy rules of a
fuzzy controller. The fuzzy rules are obtained by applying fuzzy clustering to a small random set of learning
points from the exact surface. Small difference between
the modeled and exact surface, mostly less than 1%, indicates that fuzzy clustering method is capable of capturing
the essence of the inherently non-linear and unstable system using only a small learning set. The fuzzy controller
is also tested through numerical simulation. The results
indicate that the control system reaches the stable state
rapidly without any overshoot, and that it is robust even in
the presence of disturbances.
1. INTRODUCTION
Fuzzy control system identification and design has
been a subject of intense research in recent years. The
heart of a fuzzy control system consists of a set of fuzzy
"If-then'' rules, which models the process state-control
action relationship in the control domain. The design of
appropriate fuzzy rules is a critical bottleneck in developing powerful fuzzy control systems. Typically, the specification of a real-world control problem is given by a
finite set of input-output data points p r = (xr,yi), and the
design task is to extract a good set of fuzzy rules that best
represent the input-output relationship in the data. In this
paper, we address the design issue by demonstrating good
performance of the fuzzy clustering-based method, which
identifies clusters in the input-output data and constructs a
fuzzy rule for each cluster.
Various approaches have been proposed for the
fuzzy system identification task. Takagi and Sugeno [l]
proposed a heuristic method for designing TakagiBugeno
type of fuzzy rules from I/O data, using some performance index, Subsequently, Sugeno and Tanaka reported
[2] a method for on-line identification of a fuzzy system.
Recently, several proposals are made to use fuzzy clustering for fuzzy system identification. Sugeno and
Yasukawa [3] uses the fuzzy C-means algorithm to cluster
the output data points to determine the fuzzy rules, and
0-7803-3645-3/96 $5.0001996 IEEE

2168

use some heuristics to select the most relevant input variables in fuzzy system design. Bezdek [4] combines the
ideas in [3] and [5] to develop a neural network fuzzy
control system which also utilizes clustering. Sin and
deFigueiredo [6] use fuzzy c-means algorithm to cluster
the input data points in finding the fuzzy rules. Notice
that in these works, fuzzy clustering is mainly used to find
either the antecedent part of the rules, or the number of
fuzzy rules, however, it will not directly produce fuzzy
rules - subsequent processing is needed to generate the
rules. In contrast, Kundu and Chen propose [7] to use the
fuzzy linear clustering (by Bezdek and Hathaway) [8] to
generate Takagi-Sugeno type fuzzy rules directly from I/O
data. The advantage of the proposal in [7] is that the
fuzzy clusters on the input space are discovered simultaneously as the algorithm learns the consequent part (output pattern) of each fuzzy rule, represented as a liner
function of the input. Some preliminary experiments of
function approximation were reported in [7] indicating the
promise of the fuzzy linear clustering approach to fuzzy
system design.
In this paper, we enhance the work [7] by reporting
experiments on using fuzzy clustering to learn control
rules for the inverted pendulum problem. The inverted
pendulum problem has been considered a typical representative of inherently unstable nonlinear control systems,
thus it is an ideal choice for testing the modeling capability of the fuzzy clustering algorithm. Our simulation
involves several steps. The first step consists of generation of the inverted pendulum problem's "exact" control
surface, which is itself of important interest. The second
step applies fuzzy clustering to learn fuzzy rules from the
control surface. The third step utilizes the fuzzy rules to
generate modeled control surface and simulate the
inverted pendulum control, with or without perturbations.
The experimental results show that fuzzy clustering is a
powerful tool for fuzzy system modeling.
The contributions of the current paper are two
folds. First, it further provides support for the fuzzy clustering approach to fuzzy system design. The success of
our experiments suggests that one may further consider to
adopt fuzzy clustering for fuzzy modeling in other settings (e.g. on-line learning) and thus opens up promising
directions for future exploration. Second, the approach

developed in constructing the exact control surface for the


inverted pendulum problem is of independent interest. It
provides a simple, efficient method for generating a
"good enough" approximation of the inverted pendulum
control surface, whereas it is computationally expensive
to systematically generate the optimal control surface for
such unstable, non-linear systems. This is in contrast to
the cell state space approach [9] where the computation of
the optimal control table takes a global search.

2. BACKGROUND
2.1. Fuzzy Control Systems
A fuzzy control system typically consists of a fuzzy
controller and a plant as shown in the following Figure 1.
............................................

Fuzzy
C6ntroller

Jm

.........................................

Figure 1. Fuzzy control system architecture


In this paper, we focus on Takagi-Sugeno type fuzzy rules
of the form
iS g k ( X ) ,

(1)

where x E X c Rd for some d 2 1 is the input variable


and y E Y E R is the output variable, Ak is a fuzzy set
over X , g k ( X ) is a linear function of the input variable x.
The purpose of a fuzzy control system is to predict
the (crisp) output value y (the control action) from a specific (crisp) input value xo (the state of the plant), so that
applying y will drive the plant to some desirable state
(set-point). This involves computing a (crisp) Y k = g k ( X 0 )
with membership value p A k ( x Oby
) each rule rkrand then
combining the results from all the rules to generate the
predicted y value by the following equation:

c gk(XO)pAk(XO)

Y=

k=l

n
%'!ki)mllpi
k=l i=l

- vkll

(3)

is minimized under the: constraints that x p k i = 1


(summed overall k) for each i , and each p k i 2 0. Here,
Upi - v k l l denotes the Euclidean distance between the
points p i and v k and v k i:s visualized as the center of the
cluster A k .
In fuzzy clustering, the membership values p k i and
the coefficients in the (:non)linear functions g k ( x ) are
selected such that the objective function (4), which is similar to eqn. (3), is minimizled:

If X iS A k , then y

In the fuzzy C - means algorithm [101 we are given


a set of sample data poinltspi = ( x i , y i ) : 1 I i I n and the
desired number of clusters C (2 2). It produces C fuzzy
clusters Akr 1 I k 5 C, b,y giving the membership values
p k i = & ( p i ) for each point p i and cluster A k . It chooses
the p k j so that the followiing objective function (where m
> 1 is a fixed constant)

FuzzyRuleBase

rk:

fuzzy control rule design. The main thrust of fuzzy linear


clustering is to simu1tane:ously search for the fuzzy clusters and their linear reipresentative hyperplanes. The
method easily generalizes to the case where the representative surface is a non-linear function of the input variables. This can also be viewed as a generalization of the
C - means algorithm [ 1011 (which is also known as fuzzyISODATA algorithm) for fuzzy clustering.

(2)

k=l p A k ( X O )

2.2. Fuzzy Linear Clustering and Its Application in


Fuzzy Control

In the following we first briefly review the fuzzy


linear clustering method by Hathaway and Bezdek [8],
which Kundu and Chen propose [7] to use as a means for

2169

@m =

xC(pki)"n[Yi
-gk(Xi)l2,
k=l i=l

m > 1.

(4)

The constraints pkj = 1 (summed over all k) and pki 2 0


apply here as well. The essential difference here is the
replacement of the centeir v k for the cluster Ak by the
hyperplane (hypersurface in the non-liner case) y = g k ( X ) .
The distance llpi - v k l l is now replaced by the distance of
p i from the hyperplane y = gk(X),WhiCh is llyi - g k ( x i ) l l .
In [ 7 ] , Kundu and Chen proposed to use fuzzy linear clustering for fuzzy rules design. In this work, we present our
experimentations and control simulations for the inverted
pendulum control to verify the viability of the generalized
fuzzy linear clustering approach.

2.3. The Inverted Pendulum Problem


Very often the quality of a control algorithm is
tested and demonstrated an the inverted pendulum problem [9] due to its inherent unstability and dynamic characteristics.
As shown in Figure 2, the inverted pendulum problem is the problem of learning how to balance an upright
pole. Its solution consists of finding the horizontal force
to be applied to the cart in order to balance the pole. The
cart is moving on the track with no friction. Also, the

pole is tied up to the cart by a frictionless hinge. Both the


cart and the pole have only one degree of freedom, i.e.
each of them can move in vertical plane only. The state
equations for three-dimensional inverted pendulum system are given in Figure 2.

3.1. ~ ~ g oforr learning


~ t ~ set~ generation
Although a significant number of experiments considering inverted pendulum has been conducted, most of
the papers do not offer algorithms for generating the control surface of the system. One of the rare papers that has
partially outlined its algorithm [9] for generating control
table is using cell state space method which is very
exhaustive and computationally expensive. In contrast,
this paper proposes a simple algorithm that captures physical behavior of inverted pendulum system and generates
a "good enough' control surface of it. A subset of the
control surface will be used as the learning set by the
fuzzy clustering algorithm.
The goal of proposed algorithm is to find the right
(correct) deceleration force under the following conditions: (1) the same force will be applied for the n integration steps and then set to 0; (2) the pendulum must be in
the shortest amount of time turned around and brought
through equilibrium point with velocity within 5% of the
initial one; (3) if pendulum is initially moving towards the
equilibrium position, no force is applied. The problem
with these conditions is that they contain two unknown
parameters, magnitude of F and n. However, we have
found that the second condition depends heavily on the
number of intervals force is applied: smaller the n, shorter
the time and, smaller the final chart velocity. Based on
this observation, we have chosen to set n = 2, corresponding to the application of the force for 20ms.

x, = x2

where xl= e denotes the angle of the pole from upright


position in degrees, x2 = 6 denotes angular velocity of the
pole, and x3 denotes velocity of the cart ( d s ) . Other
parameters are: (1) g = 9.81, acceleration due to gravity;
(2) mc = 0.9 kg, mass of the cart; (3) m p = 0.1 kg, mass
of the pole; (4) I = 0.5, half pole length; (5) F (in Newtons), the only control action applied horizontally to the
cart.

3. EX
ENT
Our experiment is mainly concerned with the angular position and angular velocity of the inverted pendulum's pole, although cart velocity and displacement are
considered when deciding about the length of time interval in which force F is applied to the cart. The experiment consists of three steps: exact control surface and
learning set generation, fuzzy clustering, and simulation
and modeled surface generation. Since the latter two
steps use output produced by the algorithm for the learning set generation, we will give it extra attention.

2170

Once the boundary conditions are known, Bi and bi


are given, and bf=0.05*8,,where subscripts i and f denote
initial and final values, respectively, the appropriate value
of F can be determined by numerical integration of system of equations, Figure 2, using the Shooting Method
[ll]. The whole process starts with the initial value of the
force which is then incremented in fixed steps until it
becomes either correct or too big, i.e., pendulum passes
through the equilibrium point with the speed above 5% of
the initial one. If the force is too big, it is being decremented in smaller steps until it becomes either correct or
too small, Le., pendulum does not reach the equilibrium
point. If the force is too small, increment step is further
reduced and procedure is repeated. Because of the nonlinear and unstable nature of inverted pendulum system,
some of the previous works were restricted to small initial
angles of the pole. In our case maximal possible initial
angle is 0.873 rad c- 50" .
um Learning et Generation (
A~go~~t~m

Input:

Initial angle @(within[0, .873] rad)


Initial angular velocity
(within [0, .5] rad/s, clockwise)

Output:

Force F that should be applied to the cart

1.

Initial force F := 0.

2.

Initial cart velocity x3 := 0; initial force-inc :=l.

3.

Save force, F' := F; x1 := 8, x2 := 8, initial time t


:=O, initial number of steps STEPS :=O.
If STEPS 2 2 then F :=0 (F is applied only in the
first two time steps)

4.

5.

Integrate one step, using the state equations in Fig.


2. This will produce new xl, x2, x3.

6.
7.

t := t +At, STEPS := STEPS + 1.

8.
9.

10.

If STEPS < MAX-STEPS (the maximal number of


steps) and 0 e 0 < 373 rad, then go to step 4.
Restore force: F := F'.
If x1 > 0 (current angle is positive), then determine
force-inc (> 0), F := F + force-inc, go to step 3.
Here force-inc is determined as follows:
9.1

If force-inc > 0, then do nothing.

9.2

Else force-inc := (-l)*FACT*force-inc.

If x1 < 0 and x2 is not within 5% of 8, then determine force-inc (< 0) and set F := F + force-inc, go
to step 3. Here force-inc is determined as follows:
10.1 If force-inc < 0, then do nothing.
10.2 Else force-inc := (-l)*FACT*force-inc.

11.

The right value of F is found for the 0 and 8. Output F and terminate the algorithm.

with MAX_STEPS=512, FACT=0.2, and A,=O.Ol second.


Using the IPLSG algorithm repeatedly with 150
randomly generated pairs of e and 8 as input, we obtain
the learning set (in the form of 150 data points each being
a triplet (0, 8, F)). The IPLSG is also used to generate
exact control surface, i.e. a mesh of 100 by 100 points
with the correspondingforces, see Figure 3 (Exact).

3.2 Fuzzy Rules and Fuzzy Controller


In the second step of the experiment, the learning
set is clustered using fuzzy linear clustering algorithm
[7,8], once with linear form, y = a. + alxl + ~ 2 x 2 ,and
once with non-linear (transcendental) form,
=
3
a. + alyo4+ a 2 x 1 + a3xf + a 4 4 + ~ 4 x 2
+ a5x; + agx2, of
the hypersurface equation y = gk(x,y). To use linear
clustering algorithm in the later case, the equation must be
"linearized." That is done by replacing each term on the
RHS of the equation by a new independent variable x;,
i.e.,
-> x i , x1 -> xi, xf -> xi, etc., and LHS by y'.
Values of the new (primed) variables used in clustering
are calculated accordingly.

2171

Once fuzzy rules are determined, the controller output can be generated for any value of input by using eqn.
(2); pAk'sare taken from the nearest neighbor in the learning set, so called, the nearest neighbor (NN) method.
However, in the non-linear case when gk is a function of
y, solving eqn. (2) becomes complicated: for determination of the nearest neighbor, the value of y has to be
known, which in turn, can not be calculated without
knowing the nearest neighbor first. The solution to the
problem is iteration. In the n-th iteration step, the nearest
neighbor is found by using the current value of y. Then,
eqn. (2), now a transcendental equation, is solved and the
new nearest neighbor is determined by using the new
value of y. The algorithm ends if either the new nearest
neighbor is the same as the previous one or the procedure
is repeated a predetermined number of times.
Using the method described above, the new control
surfaces based on the same mesh as the exact one are generated, see Figure 3 (Clustered (linear) and Clustered
(non-linear)). Note that these control surfaces are calculated using fuzzy rules generated by only 150 randomly
chosen points constituting a learning set. The exact and
clustered surfaces are then compared and relative errors,
titled "(Exact-C1ustered)Exact (non-linear)", "(ExactC1ustered)Exact
(linear-detail)",
and
"(ExactC1ustered)Exact (non-linear-detail)", are shown in Figure
3. In the last two graphs, data for the nine smallest values
of angle and angular velocity is skipped so more details
are visible for the rest of the mesh. These results clearly
demonstrate the significant generalization power of the
clustering algorithm used. Note that the surfaces are plotted only for the positive values of angle and angular
velocity. When both variables are negative force changes
sign but not the magnitude, and when they have opposite
sign force is zero due to the condition ( 3 ) given above.

3.3 Simulation Results


In the third step of our experiment, additional tests
were done to show that system really stabilizes in a very
short time both with and without application of disturbance force. This is achieved through the simulation of
the inverted pendulum system according to the following
algorithm:
Inverted Pendulum Simulation (IPS) Algorithm
1.
Initialize: choose angle and angular velocity randomly.
2.
3.
4.

Get F (force) from the controller (see section


above)
Randomly generate disturbance F' and interval in
which F' is applied.
F:=F+F'

5.

Evolution: use angle, angular velocity and F for


integration in time

6.

If system escaped or more than maximum number


of steps elapsed, terminate. Otherwise go to step 2.

The results of simulation with and without presence of disturbance force are given in the Figure 4.
These results show the robustness of the developed system due its capability to sustain additional disturbance
despite its already unstable and dynamic nature.
4. CONCLUSIONS AND FUTU
In this paper we present results on using fuzzy clustering to learn control rules for the inverted pendulum
problem. We design and implement an algorithm for generating the learning set of the control problem, then we
apply fuzzy clustering to obtain fuzzy control rules, and
simulate the inverted pendulum system using the learned
rules. The experimental results are highly encouraging,
which support the following conclusions:
The algorithm for generating the control surface
(the learning set) of the inverted pendulum problem
is simple and efficient. The control surface generated has proven to be effective as the simulation
shows that the system using an approximation of
the control surface does stabilize quickly.
The fuzzy rules obtained from fuzzy clustering
have strong generalization and approximation capabilities. Using only 150 data points as the learning
set, fuzzy clustering produces fuzzy rules which can
approximate the entire space of 10,000 points with
high precision.
The fuzzy inverted pendulum control system
obtained by fuzzy clustering is robust and can resist
quite amount of disturbances.
To sum up, the experimental results clearly demonstrate that fuzzy linear clustering is a powerful means for
fuzzy system modeling.
Although the non-linear generalization of fuzzy linear clustering can achieve lower errors, see Figure 3, this
method gives rise to new dilemmas: which powers to
choose for LHS and RHS of the hypersurface equation:
whether to use the transcendental form or not; complicated algorithm for determining value of y, etc. All of the
above suggests that one should first use fuzzy linear clustering and only when such attempt does not give the
expected results, turn to the non-linear version.
In order to further improve clustering quality in the
non-linear case, we are planning to implement genetic
algorithms to achieve a better description of cluster representative hypersurfaces, i.e., better choice of powers in
the hypersurface equations.

2172

T
We are grateful to Professor Sukhamay Kundu for
helpful discussions on topics related to this work and for
letting us to use his program for fuzzy linear clustering.
The second author's work is supported in part by the NSF
grant ##9409370.
REFERENCES
T. Takagi, M. Sugeno, Fuzzy identification of systems and its applications to modeling and control,
IEEE Transactions on Systems, Man, and Cybernetics, Vol. SMC-15, No. 1, 1987, pp. 116-132.

M. Sugeno, K. Tanaka, Successive identification of


a fuzzy model and its application to prediction of a
complex system, Fuuy sets and systems, Vol. 42,
1991, pp. 335-344.
M. Sugeno, T. Yasukawa, A fuzzy logic based
approach to qualitative modeling, IEEE Transactions on Fuuy Systems, Vol. 1, No. 1, 1993, pp.
7-3 1.
J. Bezdek, Hybrid models for fuzzy control, Proc.
of the First Int. Symp. on Integrating Knowledge
and Neural Heuristics, May 1994, pp. 3-14.
H. Berenji, Y.Y. Chen, C.C. Lee, J.S. Jang, S.
Murugesan, A hierarchical approach to designing
approximate-reasoning based controllers for
dynamical physical systems, Proc. of 6th Con$ on
Uncertainty in AI, 1990, pp. 362.
S.K. Sin and R.J.P. deFigueiredo, Fuzzy system
design through fuzzy clustering and optimal predefuzzification, Proc. of the 2nd IEEE International
Conference on Fuzzy Systems, San Francisco, CA,
March 1993, pp. 190-193.

S. Kundu, J. Chen, Fuzzy linear invariant clustering


with applications in fuzzy control, Proc. of
NASALWAFIPS, 1994.
Hathaway, J. Bezdek, Switching regression models
and fuzzy clustering, IEEE Transactions on Fuzzy
Systems, Vol. 1, No. 3, Aug. 1993, pp. 195-204.
S . Smith, B. Nokleby, D. Comer, A computational
approach to fuzzy logic controller design and analysis using cell state space methods, In: F u u y Control
Systems, Kandel, Langholz, (Eds), pp. 398-426.
J.C. Bezdek, A convergence theorem for the fuzzy
ISODATA clustering algorithms, IEEE Transactions on Pattern Analysis and Machine Intelligelace
(2), 1980, pp. 1-8.
W. 3. Press, S. A. Teukolsky, W. T. Vetterling, B. P.
Flannery, Numerical Recipes in C, Cambridge University Press, Cambridge, 1992

Exact

Clustered (linear)

.8

ang. velocity

.8

angle

ang. velocity

Clustered (non-linear)

angle

(Exact-Clustered)/Exact(non-linear)
. ..

. . I

150

z
w

IO0

50
0
.8

.8
- ._

ang. velocity

ang. velocity

angle

angle

(Exact-Clustered)/Ex;d (non-linear-detail)
. .
,. , . ,.
. ..
.
.. , . ..
.. .
,
: . ,. . , . . .

(Exact-Clustered)/Exact (linear-detail)

ang. velocity

0.1

.a
_..

0.2

angle

Figure 3 Comparison of control surfaces generated heuristicaly and by clustering


(in the last two graphs nine smallest values for angle and ang. velocity weire skipped)

2173

0.3- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

s3o 2. . .-. . . .\. . . .!. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


-0
.

Of-:.

......

:. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4
6
Time (s)

'

4
6
Time (s)

Time (s)
0.2

-0.2
..................................

.1

-1.5'

........................

< . . . . . . . I

601

: 1

........

...........

.........................................

-1.4
-1.6

4
6
Time (s)

. . . . . . .:. . . :_
. . .:.I... . . .

40
I

It

.......I..

....

....... ......

4
6
Time (s)

_ : . . . . . . _.:. . . . . .:. . . . . . .

40

z 20
a,

: 0
3
.+-

E -20
....

-40

I I

6
Time (s)

Time (s)

- ~ i ~ u l a t results
~ o n for eases with and without disturbance
(initial conditions: angle = 20 deg. and angular velocity = .1 rads)

2174

You might also like