Main Content

Decision Making Using Fuzzy Discrete Event Systems

You can use a fuzzy discrete event system (FDES) for deciding between different outcomes in scenarios where discrete events can be modeled using a fuzzy transition matrix.

This example shows a sample FDES for clinical decision making in selecting medical treatments. A clinical decision-making system assists a medical practitioner in the diagnosis and treatment of a disease using relevant medical evidence. An FDES [1] allows continuous monitoring of the patient state to recommend a possible course of treatments for a disease [2]. This medical application in this example is for illustrative purposes and does not include real clinical data.

An FDES compactly and explicitly represents application-specific knowledge, even when the knowledge is imprecise or subjective. Also, an FDES model is not a black box. Rather, you can intuitively understand and validate the model structure and operational logic based on the event-transition matrices and related fuzzy state transfers. This model interpretability is important to many applications, especially those in medicine, as patient safety is paramount. Also, interpretability makes model design, development, refinement, and implementation easier, quicker, and more cost-effective.

This example performs decision making using single-event FDES models. You can also use multi-event FDES models for more complex treatment decision where each option consists of two or more different kinds of treatment.

FDES Basics

An FDES complements a conventional discrete event system (DES) by using fuzzy sets and fuzzy logic. A conventional automaton model, which defines a DES, is extended to a fuzzy automaton to define an FDES as follows:



  • Q is a 1-by-N vector that represents the overall system state using N fuzzy states. Each fuzzy state in Q can have membership values in the range [0, 1], as opposed to only 0 or 1 in conventional discrete event systems.

  • qo is the initial fuzzy state vector.

  • Σ is a set of fuzzy events, each of which is represented by an N-by-N state-transition matrix. The elements of a fuzzy state-transition matrix can have values in the range [0, 1] rather than only 0 or 1. Therefore, the occurrence of a fuzzy event can produce a new overall system state Q with partial membership values for the individual fuzzy states. An FDES can consist of one or more fuzzy events, which can be defined by domain experts or learned from available domain-specific data.

  • φ:Q×ΣQ represents state transitions. The state-transition mapping uses fuzzy reasoning, such as the max-product composition method.

A conventional automaton is a special case of a fuzzy automaton while a discrete event system is a special case of a fuzzy discrete event system.

FDES Model for Clinical Status

For this example, the treatment model uses an FDES for patients recently diagnosed with an aggressive, early-stage cancer.

The FDES represents the clinical status of the patient using four fuzzy states, each of which is defined by a fuzzy set.

  • Healthy — Fuzzy set with maximum membership or peak value at xh=4

  • Good — Fuzzy set with peak value at xg=3

  • Fair — Fuzzy set with peak value at xf=2

  • Poor — Fuzzy set with peak value at xp=1

xPeak = 4:-1:1;
statusStateNames = ["Healthy" "Good" "Fair" "Poor"];
State vector, xPeak:

            Healthy    Good    Fair    Poor
            _______    ____    ____    ____

    Peak       4        3       2       1  

Q is the fuzzy state vector representing the patient status.



  • μh[0,1] is the membership value in Healthy state.

  • μg[0,1] is the membership value in Good state.

  • μf[0,1] is the membership value in Fair state.

  • μp[0,1] is the membership value in Poor state.

Lower values of μh, μg, and μf, and corresponding higher values of μp indicate a more serious status of the patient.

To obtain a crisp health index value for the patient, you can defuzzify Q using the centroid method. For more information on defuzzification, see defuzz.

The resulting health index is in the range [1, 4], where a lower value indicates a more serious patient status.

Initial State

Before starting the treatment process, the initial clinical state of the patient is diagnosed as qo,c.

qo_c = [0 0.2 0.7 0.1];
State vector, qo_c:

                  Healthy    Good    Fair    Poor
                  _______    ____    ____    ____

    Membership       0       0.2     0.7     0.1 

The initial state vector represents the following crisp health index value xo,c.

xo_c = defuzz(xPeak,qo_c,"centroid")
xo_c = 2.1000

Hence, the patient is initially somewhat in the Fair state.


Assume that the patient is considering the following two treatment options:

  1. Surgery to remove the cancer

  2. Radiation therapy to kill cancer cells

You can model each option as a single-event fuzzy discrete system.

Define the fuzzy state-transition matrix αc for the surgery option.

alpha_c = [
    1 0.8 0.1 0;
    0.9 0.8 0.2 0.1;
    0.1 0.6 0.3 0.2;
    0 0.3 0.5 0.3];
Event matrix, alpha_c:

               Healthy    Good    Fair    Poor
               _______    ____    ____    ____

    Healthy        1      0.8     0.1       0 
    Good         0.9      0.8     0.2     0.1 
    Fair         0.1      0.6     0.3     0.2 
    Poor           0      0.3     0.5     0.3 

Each row of the transition matrix represents the possible surgery outcomes for a patient in a given state. For example:

  • A patient in a Fair state will transition to a Good state with a likelihood of 0.6.

  • A patient in a Good state will transition to a Poor state with a likelihood of 0.1.

  • A patient in a Poor state will remain in a Poor state with a likelihood of 0.3.

Similarly, define fuzzy state-transition matrix βc for the radiation option.

beta_c = [
    1 0.7 0.2 0; 
    0.7 0.6 0.4 0.3;
    0 0.4 0.5 0.4;
    0 0 0.7 0.6];
Event matrix, beta_c:

               Healthy    Good    Fair    Poor
               _______    ____    ____    ____

    Healthy        1      0.7     0.2       0 
    Good         0.7      0.6     0.4     0.3 
    Fair           0      0.4     0.5     0.4 
    Poor           0        0     0.7     0.6 

Comparing βc to αc suggests that radiation therapy is a less effective treatment for this particular cancer. For example, in βc, the possibilities for patients in a Good or Fair state to respectively transition to a Healthy or Good state significantly smaller than in αc. Furthermore, the possibilities for these two states to change to a Fair or Poor state are significantly higher than in αc.

State Transition

The patient state changes after the occurrence of an event. Each state-transition matrix, constructed using historical patient cases, represents the general clinical state transfer for all patients. When you apply the matrices to a new individual patient, the computed post-event fuzzy state is an estimation of the expected outcome. You cannot predict the actual treatment outcome in advance.

This example uses max-product composition to determine an expected post-event state. Expected state vectors are optionally normalized for comparison.

Compute the expected state Qαc after occurrence of event αc.

Qalpha_c = findNextState(qo_c,alpha_c);
State vector, Qalpha_c:

                  Healthy     Good       Fair       Poor  
                  _______    _______    _______    _______

    Membership    0.18947    0.44211    0.22105    0.14737

Comparing Qαc with the initial state qo,c, the overall clinical state of the patient is expected to improve significantly after the surgery since the membership values for the Healthy and Good states increase, the membership value for Fair state (from 0.7 to 0.221), and a little change in Poor state (0.1 from 0.147).

Compute a crisp health index for xαc from Qαc.

xalpha_c = defuzz(xPeak,Qalpha_c,"centroid")
xalpha_c = 2.6737

Similarly, compute the expected state Qβc after occurrence of event βc.

Qbeta_c = findNextState(qo_c,beta_c);
State vector, Qbeta_c:

                  Healthy     Good       Fair       Poor  
                  _______    _______    _______    _______

    Membership    0.13333    0.26667    0.33333    0.26667

As compared to Qαc, Qβc has higher membership values for the Fair and Poor states but lower membership values for Healthy and Good states. Therefore, the overall clinical state of the patient after radiation would not be as good as after surgery.

Compute the crisp health index xβc from Qβc.

xbeta_c = defuzz(xPeak,Qbeta_c,"centroid")
xbeta_c = 2.2667

To confirm this assessment compare the crisp health index values for each option. While both xαc and xβc are higher than the original health index xo,c, the post-surgery index is higher than the post-radiation index.

FDES Model for Quality of Life

While the surgery appears to be a better treatment option in terms of clinical status, it may have adverse effects on the long-term quality of life of the patient. For example, the following factors can impact a the post-treatment quality of life for the patient.

  1. Known historical permanent medical problems caused by the treatment under consideration

  2. Adverse effects from preexisting medical issues and the age of the patient to be treated

For this example, create a separate FDES for assessing the impact of treatment on the patient quality of life. Represent the expected long-term quality of life using three fuzzy states, each of which is defined by a fuzzy set.

  • High — Fuzzy set with peak value at yh=3

  • Medium — Fuzzy set with peak value at ym=2

  • Low — Fuzzy set with peak value at yl=1

yPeak = 3:-1:1;
qualityStateNames = ["High" "Medium" "Low"];
State vector, yPeak:

            High    Medium    Low
            ____    ______    ___

    Peak     3        2        1 

Initial State

Before starting the treatment process, the initial quality of life of the patient is assessed as qo,l.

qo_l = [0.1 0.5 0.4];
State vector, qo_l:

                  High    Medium    Low
                  ____    ______    ___

    Membership    0.1      0.5      0.4

The initial state vector represents the following crisp health index value xo,l.

xo_l = defuzz(yPeak,qo_l,"centroid")
xo_l = 1.7000

Hence, the patient is initially somewhat in the Medium state.


Define two more event matrices to model the treatment effects of surgery and radiation therapy on long-term life quality of life.

Transition matrix αl represents the impact of surgery on quality of life.

alpha_l = [
    0.6 0.8 0.3;
    0 0.5 0.4;
    0 0 1];
Event matrix, alpha_l:

              High    Medium    Low
              ____    ______    ___

    High      0.6      0.8      0.3
    Medium      0      0.5      0.4
    Low         0        0        1

Transition matrix βl represents the impact of radiation therapy on quality of life.

beta_l = [
    0.8 0.6 0.1;
    0 0.9 0.2;
    0 0 1];
Event matrix, beta_l:

              High    Medium    Low
              ____    ______    ___

    High      0.8      0.6      0.1
    Medium      0      0.9      0.2
    Low         0        0        1

A comparison of the two matrices shows that the surgery can potentially induce more side effects than the radiation therapy can because:

  • The possibility (0.6) that a High quality state remains unchanged after the surgery is lower than for radiation therapy (0.8).

  • The possibility of a High quality state to worsen to a Medium or Low quality state are higher for surgery.

  • It is less likely that a Medium quality state remains unchanged after surgery and it is more likely to worsen to Low quality state.

State Transition

Similar to the clinical status model, the expected long-term quality of life of the patient changes after treatment.

Compute the quality-of-life state after surgery Qαl.

Qalpha_l = findNextState(qo_l,alpha_l);
State vector, Qalpha_l:

                    High      Medium       Low  
                  ________    _______    _______

    Membership    0.084507    0.35211    0.56338

Compute the quality-of-life state after radiation Qβl.

Qbeta_l = findNextState(qo_l,beta_l);
State vector, Qbeta_l:

                    High      Medium       Low  
                  ________    _______    _______

    Membership    0.086022    0.48387    0.43011

To assess the expected quality of life, compute crisp quality-of-life index values by defuzzifying the corresponding fuzzy state vectors.

Qαl and Qβl represent the following crisp index values, , respectively, for quality of life.

yalpha_l = defuzz(yPeak,Qalpha_l,'centroid')
yalpha_l = 1.5211
ybeta_l = defuzz(yPeak,Qbeta_l,'centroid')
ybeta_l = 1.6559

The post-surgery index value yαl is lower than the post-radiation index value yβl. Therefore, the radiation treatment provides a better expected long-term quality of life for the patient.

Treatment Selection

The quantitative estimations obtained above show that the surgery is expected to deliver a better cancer control at the expense of possibly worse long-term health-related quality of life. The reverse is true for the radiation therapy.

Ultimately, the final decision on which treatment to use depends on the personal preference of the patient. For this example, represent the patient using weight factor θ in the range [0, 1]. A higher value of θ indicates a patient preference for disease control and a lower value indicates a preference for long-term health-related quality of life.

The following treatment preference functions provide a combined consideration of the two weighting factors.



A higher value of Fα indicates patient preference for surgery and a higher value of Fβ indicates patient preference for radiation.

Plot the treatment preference functions for all values of θ.

theta = 0:0.01:1;
F_alpha = theta*xalpha_c + (1-theta)*yalpha_l;  
F_beta = theta*xbeta_c + (1-theta)*ybeta_l;

title("Treatment Selection")
xlabel("Patient Weighting Factor, theta")
legend("Surgery Preference","Radiation Preference",...
grid on

In this case, for θ greater than about 0.25, surgery is the preferred choice of treatment.

Online Supervised Learning of FDES

You can learn the event-transition matrices of an FDES online as new data becomes available. In the case of a clinical decision-making system, you can use the results from new patients to gradually improve the FDES model through supervised learning. Over time, the resulting model would cover a more diverse patient population, which can improve prediction accuracy for individual patients in the future.

This example demonstrates the learning process for a single patient.

Generally, an event transition matrix αk at the kth instant is updated with its previous value αk-1,the current pre-event state Qk-1, and current expected post-event state Qk [3].


αk=[αijk]N×N, where i,j=1,,N



Each element of the event matrix is learned as follows:


Here, λ>0 is a learning rate whose value is determined by the model.

Qˆk=Qk-1αk-1=[μˆik]N is an actual state at the kth instant obtained from αk-1 and Qk-1 using max-product fuzzy inference ().


For this example, update the surgery event-transition matrix αcusing the results for a single patient.


Suppose that the target state Qk corresponding to qo,c is determined using a physical diagnosis after the treatment.


Assume the patient represented by the pair (qo,c,Qk) is the only sample available for learning.

Iteratively update event matrix αk with learning rate λ=0.2 for a preset root-mean-square-error (RMSE) goal of 0.02.

N = 4;
lambda = 0.2;
alphak_1 = alpha_c;
Qk_1 = qo_c;
Qhat = Qalpha_c;
Qk = [0.2 0.6 0.15 0.1];
alphak = zeros(N,N);
rmse = sqrt(mean((Qhat-Qk).^2));
fprintf("Initial RMSE = %g\n",rmse);
Initial RMSE = 0.089908
errorGoal = 0.02;
iteration = 0;
while rmse>errorGoal
    iteration = iteration + 1;
    for i = 1:N
        for j = 1:N
            alphak(i,j) = alphak_1(i,j)-lambda*Qk_1(i)*(Qhat(j)-Qk(j));
    alphak_1 = alphak;
    Qhat = findNextState(Qk_1,alphak_1);
    rmse = sqrt(mean((Qhat-Qk).^2));
    fprintf("Iteration %d: RMSE = %g\n",iteration,rmse);
Iteration 1: RMSE = 0.0812763
Iteration 2: RMSE = 0.0736111
Iteration 3: RMSE = 0.0668027
Iteration 4: RMSE = 0.0607548
Iteration 5: RMSE = 0.055383
Iteration 6: RMSE = 0.0506125
Iteration 7: RMSE = 0.0463777
Iteration 8: RMSE = 0.0426206
Iteration 9: RMSE = 0.0392899
Iteration 10: RMSE = 0.03634
Iteration 11: RMSE = 0.0337306
Iteration 12: RMSE = 0.0314255
Iteration 13: RMSE = 0.0293927
Iteration 14: RMSE = 0.0276031
Iteration 15: RMSE = 0.0260309
Iteration 16: RMSE = 0.0246527
Iteration 17: RMSE = 0.0234472
Iteration 18: RMSE = 0.0223954
Iteration 19: RMSE = 0.02148
Iteration 20: RMSE = 0.0206853
Iteration 21: RMSE = 0.0199972

You can follow a similar approach for online supervised learning of other event transition matrices.


  1. Feng Lin and Hao Ying. “Modeling and Control of Fuzzy Discrete Event Systems.” IEEE Transactions on Systems, Man and Cybernetics, Part B (Cybernetics) 32, no. 4 (August 2002): 408–15.

  2. Ying, H., F. Lin, R.D. Macarthur, J.A. Cohn, D.C. Barth-Jones, H. Ye, and L.R. Crane. “A Fuzzy Discrete Event System Approach to Determining Optimal HIV/AIDS Treatment Regimens.” IEEE Transactions on Information Technology in Biomedicine 10, no. 4 (October 2006): 663–76.

  3. Ying, Hao, and Feng Lin. “Online Self-Learning Fuzzy Discrete Event Systems.” IEEE Transactions on Fuzzy Systems 28, no. 9 (September 2020): 2185–94.

Helper Functions

Calculate the next state using the current state and event, normalizing the next-state values.

function nextState = findNextState(currentState,event)
nextState = zeros(size(currentState));
stateSum = 0;
for col=1:size(event,2)
    stateValue = max(currentState.*event(:,col)');
    nextState(col) = stateValue;
    stateSum = stateSum + stateValue;

if stateSum~=0
    nextState  = nextState/stateSum;

Display a fuzzy event matrix.

function showEventMatrix(eventMatrix,stateNames,varName)
description = sprintf("Event matrix, %s",varName);

Display a fuzzy state vector.

function showStateVector(stateVector,stateNames,varName,label)
description = sprintf("State vector, %s",varName);

Display a matrix.

function showMatrix(mat,rowNames,colNames,description)
vars = mat2cell(mat,size(mat,1),ones(1,size(mat,2)));
t = table(vars{:},VariableNames=colNames,RowNames=rowNames);

See Also