You are on page 1of 6

First Homework

You must select one among the two projects proposed and described on the next pages (Project A or
Project B). This homework is carried out by teams of max 2 Students. If you prefer working alone, you
can.

Your program and report (with your comments, and justification of your technical choices and
conclusion about the work performed) must be upload on SAVOIR workspace (link here) before 16th
November (at noon).

1 Homework #1
Project A - Design a Fuzzy Logic Tool
The aim of this project is to implement a simple tool able to handle fuzzy logic rules. In short, the aim
of this work is to automatize what we handy solved during the course.

This implementation must be developed from scratch and should follow the 3 steps of a fuzzy logic
engine, which are reminded in the Figure 1:
- The translation of the data of the case to analyze into the Fuzzy World
- The inference of expert rules by the inference engine
- The translation of the fuzzy results of this inference into the real world

Inputs Fuzzycation Inference Engine De-Fuzzycation Outputs

Rules

Figure 1: Architecture of a fuzzy logic tool

To complete this project, you can use:

- Excel software (Excel functions and some VBA coding instructions too). This tool is freely
available in ENSAM computers, is accessible through remote access and can be freely
download (check how on ‘etre.ensam.eu’ Website).
- Python programming language with the classical libs (matplotlib, numpy). This program can be
performed without using Object Oriented Programming. Of course, since the goal is to design
a Fuzzy engine, do not use lib proposing already coded fuzzy engines such as Scikit-fuzzy...

The goal is to build a simple Fuzzy Logic engine following the article written by Utku Kose and to analyze
how is it possible to put priority on some rule in the whole decision process.

Step 1: Define the fuzzy parameters


Work to do: The first goal of this step is to implement the parameters proposed by Utku Kose in his
article. In short, you should:

- Define all the membership laws in a parametric way (useful for next steps) and define the
mathematical function which can determine the fuzzy memberships value of each parameter
(ammo, health, action)
- Plot all inputs and outputs parameters (with about 1000 points) to check graphically that
mathematical functions are fine.

Tips: To ease the development of your tool, you should consider this problem as a discrete one:
consequently, I suggest you to split the membership functions and each intermediate result

2 Homework #1
(aggregation, max, min…) into a set of points: the more points you have, the more precise will be your
system and its results.

Step 2: Express and infer the fuzzy rules


Work to do: By considering the matrices proposed in Figure 6 of the article, design a method composed
by a set of Excel’s functions (or Python’s) which can:
- Implement these rules into Excel worksheet. Keep the matrix shape of these fuzzy rules since
it is interesting and fully compatible with Excel work cells.
- Perform the inference of all rules, regarding the fuzzy memberships quantified in the previous
step. To do so, it is proposed to use the MAMDAMI operators (Min/max).
- Aggregate all the intermediate results from the inference of the fuzzy rule. In this project, the
Max operator is chosen.
- Plot the output parameters: the aim is to have a way to check if the previous steps work or
not.
- By using Center of Gravity operator, perform the de-fuzzycation to quantify the output
parameter. This output can be given as a number as described in the article or in a symbolic
way (“stop”, “hide, “attack” …). The output value is the closest one to this center of gravity
value.
- Verify that your system works by testing it with several couples of input values (ammo and
health)

Step 3: Express and apply the fuzzy rules


By considering the evolution domains of the two input parameters (Ammo and Health), plot the 3D
surface of the output variable. To avoid too long calculous, discretize these input domains and to
prevent you from doing this by hand, use VBA loops. Analyze this result. What is the parameter having
the biggest impact of both outputs?

At this step, you validated the fuzzy engine: it works and can simulate the expected behavior. The aim
of the next section is to check what are the impact of the aggregator operator and the robustness of
this approach.

Step 4: Effects of the aggregation and defuzzication operators


The goal of this section is to identify the impacts of two design choices in the building of the fuzzy
engine: the aggregation operator and the defuzzication operator.

Work to do:
- In a dedicate Excel workbook, implement the fuzzy logic engine for each case of the four
combinations sum-up in the Table 1.

Case 1
(previously Case 2 Case 3 Case 4
implemented)
Aggregation
Max Sum Max Sum
Operator
Defuzzication Center of Center of Mean of Mean of
Operator Gravity Gravity Maximum Maximum

3 Homework #1
Table 1 : Cases to implement

- Compare the results obtained in these different cases to identify what are the effects of
these operators on the final behavior of the engine.

Step 5: Putting weight on each rule


To increase the importance of some rules (linked to a particular strategy for the robot), we want to
weight them. To do so, consider two main strategies:
- Defensive: all rules leading to a safer situation for the robot must be considered more than
the other ones. Consequently, all rules concluding “Hide” or “Run Away” have now a weight
of 1.5 where the other rules keep a weigh of 1.0
- Offensive: all rules leading to a more aggressive situation for the robot are prioritized.
Consequently, all rules concluding “Attack” or “Walk Around” have now a weight of 1.5 where
the other rules keep a weigh of 1.0

Work to do: By considering these two strategies:


- In a new Excel workbook, build these two strategies
- Compare them.
- Conclude about the relevance of this idea.

4 Homework #1
Project B – CSP Project
Organisation of an assembly process
The aim of this project is to use the constraint satisfaction approach to generate, from the description
of a product, its assembly planning by taking into consideration some limitation of the production
system itself. This statement is partially based on a current work performed by LCFC laboratory for a
special vehicle manufacturer within the frame of the research cluster entitled: “Reconfigurable, safe,
and efficient production systems”.

The way to model this problem is partially given in this statement: it can be adapted or evolved if you
deem it necessary.

Description of product
The product is split into a set of parts, having a weight represented by a number (from 1 to 3). The links
between parts are represented in Figure 2. Each arrow means the relative location of a part regarding
another one. For instance, the arrow between the articulation and the front chassis means that the
front chassis is assembled on the articulation. These links occur then a precedence on their assembly.

Figure 2 : Structure of the product, its parts and their relationships.

In addition to these links, which incur the precedence between the assembly of the connected parts,
two other types of links are added in this structure:
- The one in bold lines represents a precedence link due to accessibility (and not directly on any
kinematic joint linking them)
- the one in dotted lines represents a preference expressed by the operators.
The goal of this work is then from these local precedence links generates several assembly schedules
meeting these temporal constraints.

5 Homework #1
In addition to these links (kinematic, accessibility and preference), the factory has some limit regarding
the weight capacities of their hoists available in the company. The weight of each parts is represented
by an integer from 1 to 3 (as illustrated in Figure 2). Each hoist cannot lift more than a weight of 3. For
safety reasons, it is forbidden to use several hoists to raise an assembly exceeding this limit of 3 weight
units.

Work assumptions and model


Several hypotheses are proposed to model this problem:
- The assembly plan must meet all precedencies
- A hoist cannot lift more than 3 weigh units
- The hydraulic parts must be assembled as early as possible
- The assembly must be finished with the wheels assembly

Work to do
The goals of your program are:
1. to propose firstly a valid ordering of assembly operations meeting the precedence and
preference constraints expressed in the product description,
2. to propose from the previous model, a gathering of parts into sub-assemblies regarding the
capacity of the hoists available in the factory,
3. to improve the previous model by minimizing the number of these sub-assemblies group.

To do so, please model this problem in a CSP way and use MiniZinc to solve it! To ease the evaluation
of your work, please upload one MiniZinc file for each goal expressed above, not only one merging all
of them. Do not forget that you can model constraint by constraint. Try to define simpler example to
check if the defined constraints are working.

6 Homework #1

You might also like