Keywords

These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

1 Introduction

In RoboCup 2D simulation league, every team consists of 12 autonomous agents (11 players and an online coach). For each agent, its goal is to make the best decision with the information observed. Up to now, Markov Decision Processes framework [1], multi-step decision-making framework [2], MAXQ hierarchical structure [3] and heuristic online planning [4, 5] techniques have been applied on WrightEagle to make decisions. To make better decisions, we want to forecast the actions or decisions made by the opponents. Apparently, as in a competition, if the agent is able to forecast the actions or decisions made by the opponents, it will be very helpful for the agents to make corresponding decisions. To this end, an intuitive method is to build a mathematical model for the opponent. But the scale of 2D simulation is so large that it is nearly impossible to build a mathematical model for the opponent completely. Then we come up with the fuzzy inference system. The fuzzy inference system makes it possible to map inputs (observations) to outputs (actions) without knowledge of the mathematical description of the opponent. With the rules or knowledge we concluded in the past, we can build some fuzzy inference systems. These systems can help us to forecast opponents’ actions in some aspects.

2 Fuzzy Inference System (FIS)

Fuzzy inference is the process of formulating the mapping form a given input to an output using fuzzy logic [6]. In fuzzy logic, a statement is able to assume any real value between 0 and 1, representing the degree to which an element belongs to a set. So it is able to work with human inputs. On the other hand, fuzzy logic does not need complicated mathematical models. So the FIS is easy to implement.

Mamdani-Type Fuzzy Inference and Sugeno-Type Fuzzy Inference are two of the most common types of fuzzy methodology. In the following sections, we will use these two methods to deal with a simple and specific scene in the 2D simulation.

2.1 Mamdani-Type Fuzzy Inference

The Mamdani’s fuzzy inference method is the most common fuzzy methodology. It was first proposed by Ebrahim Mamdani [7] in 1975. A Mamdani’s fuzzy inference system is generally composed of five steps:

  1. 1.

    Determine a set of fuzzy rules,

  2. 2.

    Fuzzify inputs with the input membership functions,

  3. 3.

    Obtain each rule’s conclusion,

  4. 4.

    Aggregate conclusions obtained in step 3,

  5. 5.

    Defuzzification.

The detailed description of these steps will be introduced in the following part.

Determine a Set of Fuzzy Rules. The form of fuzzy rules in Mamdani’s fuzzy inference system is always like this:

$$ If\;x\;is\; A\; and/or\; y\; is\; B,\; then\; z\; is\; C. $$

where A, B and C are linguistic values defined in the fuzzy set.

For such a scene in the 2D simulation (Fig. 1), we assume that opponent1 (opp1) is attending to pass the ball to opponent2 (opp2) to point A. Our teammate1 (tm1) is marking on opponent2. The goal of tm1 is to judge if opp1 would pass the ball to point A. Here, we assume the possibility of opp1 to pass the ball successfully to be the evaluation of opp1’s action.

It is intuitive that the possibility of opp1 to pass the ball to opp2 successfully (P) is positively related to \( \varDelta c1 = c1 - c2 \) and negatively related to \( \varDelta c2 = c1 - c3 \). So two simple rules can be concluded here:

$$\begin{aligned}&rule1{:}\; If\; \varDelta c1\; is\; large\; and\; \varDelta c2\; is\; small,\; then\; P\; is\; high.\\&rule2{:}\; If\; \varDelta c1\; is\; small\; or\; \varDelta c2\; is\; large,\; then\; P\; is\; low. \end{aligned}$$
Fig. 1.
figure 1

A specific scene in 2D simulation. c1 is the cycle needed by the ball to get to point A; c2 is the cycle needed by opp2 to get to point A; c3 is the cycle needed by tm1 to get to point A.

Fuzzify Inputs with the Input Membership Functions. For a fuzzy set A, its membership function is defined as \(\mu _A :X\rightarrow [0,1]\). Set X is the universe of discourse. For each \(x \in X\), the value \(\mu _A(x)\) is called the degree of membership of x to fuzzy set A. For example, if \(\mu _A(x) = 0.7\), we can say that x belongs to A to a degree of 0.7.

With the fuzzy set, we can describe fuzzy concept like “large"and “small". Therefore, the FIS is able to deal with human inputs. For the “large" and “small" in the rules, their membership functions are defined in Fig. 2.

Fig. 2.
figure 2

The membership functions of “small" and “large".

Using the fuzzy sets defined in Fig. 2, we can fuzzify the inputs. For example, with the inputs \( \varDelta c1 = 1\), \(\varDelta c2 = -2 \), we can obtain the membership values for each rule (Fig. 3).

Fig. 3.
figure 3

Obtain a single membership value for each rule.

The fuzzy operators “and" (min) and “or" (max) are used in Fig. 3, then we obtain a single membership value for each rule.

Obtain Each Rule’s Conclusion. To obtain each rule’s conclusion, we should define the membership functions of the outputs first. For the “high" and “low" in the rules, their membership functions are defined in Fig. 4.

Fig. 4.
figure 4

The membership functions of “low" and “high".

Then, with these membership values obtained in step 2, we can use a fuzzy implication operator (min) to obtain a fuzzy set for each rule (Fig. 5).

Fig. 5.
figure 5

Obtain a fuzzy set for each rule.

Aggregate Conclusions. We choose the max to be the aggregation operator, then we can combine the results obtained in last step (Fig. 6).

Fig. 6.
figure 6

Aggregate conclusions.

Defuzzification. The result of last step is a fuzzy set, it is not we want when we need to make a decision. As in the scene mentioned above, we do not want to know the P is high or low but the accurate value of P. Therefore, we need to transform the fuzzy set into an accurate value. The process of this transformation is called defuzzification. Here, we use the centroid method, which is one of the most common used methods for defuzzification. Centroid method is to compute the center of the mass. Here, we take some sample points to calculate the center (Fig. 7).

Fig. 7.
figure 7

Aggregate conclusions.

$$\begin{aligned} P = \frac{\sum \limits _{i=1}^{11} x_i \times \mu (x_i)}{\sum \limits _{i=1}^{11} \mu (x_i)} = 0.83 \end{aligned}$$
(1)

Now, the accurate value of P is obtained. So we can say that the possibility of opp1 to pass the ball to opp2 successfully is 0.83. Then, we can forecast that the possibility of opp1 to pass the ball to point A is 0.83. In other words, now we are able to forecast the possibility of an opponent to pass the ball to a certain point. Therefore, we can forecast to which point an opponent will pass the ball through enumeration.

2.2 Sugeno-Type Fuzzy Inference

The Sugeno fuzzy inference method was first proposed in 1985 [8], it is very similar to the Mamdani’s method. Generally, the Sugeno fuzzy inference system is composed of four steps:

  1. 1.

    Determine a set of fuzzy rules,

  2. 2.

    Fuzzify inputs with the input membership functions,

  3. 3.

    Obtain each rule’s conclusion,

  4. 4.

    Aggregate conclusions obtained in step 3.

Determine a Set of Fuzzy Rules. The form of the rules in Sugeno method is like this:

$$\begin{aligned} \textit{If x is A and/or y is B, then z is f(x, y)}. \end{aligned}$$

Unlike the Mamdani’s method, the output of Sugeno method is no longer a fuzzy set. It is a function of the inputs. So there is no need of defuzzification. For the same scene mentioned above, we can conclude two rules:

$$\begin{aligned}&\textit{rule1: If}\; \varDelta \textit{c1 is large and}\; \varDelta \textit{c2 is small, then P} = f(\varDelta c1 - \varDelta c2). \\&\textit{rule2: If}\; \varDelta \textit{c1 is small or}\; \varDelta \textit{c2 is large, then P} = g(\varDelta c1 - \varDelta c2). \end{aligned}$$

where f(x) and g(x) are defined in Fig. 8.

Fig. 8.
figure 8

f(x) and g(x).

Fuzzify Inputs with the Input Membership Functions. In this step, the Sugeno method is exactly the same with Mamdani’s method (Fig. 9).

Fig. 9.
figure 9

Obtain a single membership value for each rule.

Obtain Each Rule’s Conclusion. Science the output is a function of the inputs, it is much simpler to obtain each rule’s conclusion.

$$\begin{aligned}&{rule1: P = f(\varDelta c1 - \varDelta c2) = 0.8}\\&{rule2: P = g(\varDelta c1 - \varDelta c2) = 0.65} \end{aligned}$$

Aggregate Conclusions. In Sugeno method, aggregation is to compute the weighted average of the outputs obtained is last step. The membership value obtained in step 2 is used to be the weight of each rule (\(w_1 = 1/2,w_2 = 0\)).

$$\begin{aligned} P = \frac{\sum \limits _{i=1}^2 w_i \times p_i}{\sum \limits _{i=1}^2 w_i} = 0.8 \end{aligned}$$
(2)

2.3 Comparison Between Mamdani and Sugeno

Based on the form of the rules, we can find out that the Mamdani’s method is more intuitive. But in 2D simulation, every decision should be made within 100 ms. If the number of the rules is large, it will take much time to compute. So we should apply the Mamdani’s method on scenes with small number of rules. Science the output is a function of the inputs in Sugeno method, it is computationally efficient. So it is able to handle with scenes with large number of rules.

3 Experiment

We have implemented a FIS and applied it on the marking module of WrightEagle. To test the FIS, we played 2000 full games (1000 before we implemented the FIS and 1000 after) with each team (Helios2014, Yushan2014, Gliders and Oxsy). The binary code of Helios2014, Yushan2014, Gliders and Oxsy we used were released by RoboCup 2014. These games were played on the same hardware and software environment. For each team, we take account average goal and win rate. The results are shown in Tables 1 and  2.

Table 1 shows that, after we implemented the FIS, the win rate against opponent teams increased. The increase of win rate shows that the FIS works well. What’s more, Table 2 shows that the average goal of opponent teams decreased, from which we can conclude that the FIS did increase the defensive ability of WrightEagle.

Table 1. Win rate against each team
Table 2. Average goal against each team

4 Related Work

As for a FIS, how to get rules is the most important challenge. Soccer is the most popular sport in the world. The sport has developed for hundreds of years. There are so many matches from which we can conclude rules. The human players and coaches have come up with numbers of strategies. So we can conclude some general rules from these strategies. On the other hand, the 2D simulation has developed for decades, we can conclude rules from different teams and different matches. The machine learning techniques and big data techniques also can be used here.

The FIS we talked above is a multi-input, single-output model. There are some scenes in 2D simulation in which we need use multi-input, multi-output models. Actually, a multi-input, multi-out model can be separated into some multi-input, single-output models.

5 Conclusion

For the purpose of forecasting actions of opponents in soccer simulation 2D, we introduced Mamdani-Type Fuzzy Inference and Sugeno-Type Fuzzy Inference to deal with a specific scene in soccer simulation 2D. Then we implemented and applied a FIS to the marking module of WrightEagle. Based on the result of the experiment, we conclude that the FIS improves the defensive ability of our team. It did work like what we expected. The most important advantage of FIS is that it can work well without the knowledge of the mathematical description of the opponent. Another advantage of the FIS is that, when we want to take account more things, what we need to do is to add new rules or edit old rules. Then we do not have to take much time to write a new algorithm.