# data[].attributes.headline
Part B | Calculate the Distance of the Path

# data[].attributes.subject
Part B | Calculate the Distance of the Path

# data[].attributes.body
it shows that the total distance of best path found by the genetic algorithm is 6.6928 units.

# data[].attributes.body
The output of location plot of the cities in blue circles as well as the path found by the genetic algorithm that the salesman will travel

# data[].attributes.headline
Part B (Genetic Algorithm: Optimization for TRS)

# data[].attributes.subject
Part B (Genetic Algorithm: Optimization for TRS)

# data[].attributes.body
This is the link for our example

# data[].attributes.attachment_link.readable_text
This example shows how to use the genetic algorithm to minimize a function using a custom data type. The genetic algorithm is customized to solve the traveling salesman problem.

Traveling Salesman Problem

The traveling salesman problem is an optimization problem where there is a finite number of cities, and the cost of travel between each city is known. The goal is to find an ordered set of all the cities for the salesman to visit such that the cost is minimized. To solve the traveling salesman problem, we need a list of city locations and distances, or cost, between each of them.

Our salesman is visiting cities in the United States. The file usborder.mat contains a map of the United States in the variables x and y, and a geometrically simplified version of the same map in the variables xx and yy.

We will generate random locations of cities inside the border of the United States. We can use the inpolygon function to make sure that all the cities are inside or very close to the US boundary.

Blue circles represent the locations of the cities where the salesman needs to travel and deliver or pickup goods. Given the list of city locations, we can calculate the distance matrix for all the cities.

Customizing the Genetic Algorithm for a Custom Data Type

By default, the genetic algorithm solver solves optimization problems based on double and binary string data types. The functions for creation, crossover, and mutation assume the population is a matrix of type double, or logical in the case of binary strings. The genetic algorithm solver can also work on optimization problems involving arbitrary data types. You can use any data structure you like for your population. For example, a custom data type can be specified using a MATLAB® cell array. In order to use ga with a population of type cell array you must provide a creation function, a crossover function, and a mutation function that will work on your data type, e.g., a cell array.

Required Functions for the Traveling Salesman Problem

This section shows how to create and register the three required functions. An individual in the population for the traveling salesman problem is an ordered set, and so the population can easily be represented using a cell array. The custom creation function for the traveling salesman problem will create a cell array, say P, where each element represents an ordered set of cities as a permutation vector. That is, the salesman will travel in the order specified in P{i}. The creation function will return a cell array of size PopulationSize.

The custom crossover function takes a cell array, the population, and returns a cell array, the children that result from the crossover.

The custom mutation function takes an individual, which is an ordered set of cities, and returns a mutated ordered set.

We also need a fitness function for the traveling salesman problem. The fitness of an individual is the total distance traveled for an ordered set of cities. The fitness function also needs the distance matrix to calculate the total distance.

ga will call our fitness function with just one argument x, but our fitness function has two arguments: x, distances. We can use an anonymous function to capture the values of the additional argument, the distances matrix. We create a function handle FitnessFcn to an anonymous function that takes one input x, but calls traveling_salesman_fitness with x, and distances. The variable, distances has a value when the function handle FitnessFcn is created, so these values are captured by the anonymous function.

We can add a custom plot function to plot the location of the cities and the current best route. A red circle represents a city and the blue lines represent a valid path between two cities.

Once again we will use an anonymous function to create a function handle to an anonymous function which calls traveling_salesman_plot with the additional argument locations.

Genetic Algorithm Options Setup

First, we will create an options container to indicate a custom data type and the population range.

We choose the custom creation, crossover, mutation, and plot functions that we have created, as well as setting some stopping conditions.

Finally, we call the genetic algorithm with our problem information.

The plot shows the location of the cities in blue circles as well as the path found by the genetic algorithm that the salesman will travel. The salesman can start at either end of the route and at the end, return to the starting city to get back home.

# data[].attributes.attachment_link.title
Custom Data Type Optimization Using the Genetic Algorithm

# data[].attributes.attachment_link.description
Solve a traveling salesman problem using a custom data type.

# data[].attributes.body
There are three part, we divide one person take two, another takes one. We use volunteer system, where the person who do the two part is the volunteer.

# data[].attributes.body
We use the optimization example that already been provide in our matlab add-ons example which is TRS

# data[].attributes.body
Using the data user's type for the food quality and service quality, the marks of the restaurant are calculated. Then the restaurant is rated between 1 to 3 stars according to the marks

# data[].attributes.body
https://unimas-my.sharepoint.com/:f:/g/personal/74864_siswa_unimas_my/EoeGXyymcjpLr98sxhy3qWMBM9hD-1qzZRS6rfRYMQWBhw?e=rgRKeu

# data[].attributes.body
Rule based 1: Food quality evaluation

If taste is excellent and presentation is excellent and freshness is excellent and consistency is excellent, then food quality is excellent.
If taste is good and presentation is good and freshness is good and consistency is good, then food quality is good.
If taste is average and presentation is average and freshness is average and consistency is average, then food quality is average.
If taste is poor or presentation is poor or freshness is poor or consistency is poor, then food quality is poor.

Rule based 2: Service evaluation

If staff friendliness is excellent and responsiveness is excellent and efficiency is excellent, then service quality is excellent.
If staff friendliness is good and responsiveness is good and efficiency is good, then service quality is good.
If staff friendliness is average and responsiveness is average and efficiency is average, then service quality is average.
If staff friendliness is poor or responsiveness is poor or efficiency is poor, then service quality is poor.

Rule based 3: Ambience evaluation

If lighting is excellent and music is excellent and cleanliness is excellent and overall atmosphere is excellent, then ambience quality is excellent.
If lighting is good and music is good and cleanliness is good and overall atmosphere is good, then ambience quality is good.
If lighting is average and music is average and cleanliness is average and overall atmosphere is average, then ambience quality is average.
If lighting is poor or music is poor or cleanliness is poor or overall atmosphere is poor, then ambience quality is poor.
These rules are just examples, and in practice, the specific fuzzy variables and their membership functions would need to be defined based on the requirements and characteristics of the restaurant being evaluated.

# data[].attributes.headline
Rule Based for Restaurant Recommendation System

# data[].attributes.subject
Rule Based for Restaurant Recommendation System

# data[].attributes.body
Rule based 1: Food quality evaluation
This rule evaluates the quality of food based on fuzzy variables like taste, presentation, freshness, and consistency.

Rule based 2: Service evaluation
This rule assesses the quality of service provided by the restaurant, considering fuzzy variables such as staff friendliness, responsiveness, and efficiency.

Rule based 3: Ambience evaluation
This rule evaluates the ambiance of the restaurant based on fuzzy variables like lighting, music, cleanliness, and overall atmosphere.

# data[].attributes.body
Here are the possible resources that we can use:
1) Fuzzy Logic to decide the publishment of an online course
http://www.aasmr.org/jsms/Vol12/JSMS%20OCT%202022/Vol.12.No.05.11.pdf

2) Fuzzy Logic to determine the anxiety level
https://link.springer.com/article/10.1007/s42452-020-2726-z

3) Fuzzy Logic to control Temperature level
https://arxiv.org/ftp/arxiv/papers/1402/1402.3654.pdf

4) Fuzzy Logic for Restaurant Tipping
https://pythonhosted.org/scikit-fuzzy/auto_examples/plot_tipping_problem_newapi.html

# data[].attributes.body
- Understand what aspect needed to be included and how part A should be done

# data[].attributes.body
An online report is created for each member to modify it.
https://unimas-my.sharepoint.com/:w:/g/personal/74864_siswa_unimas_my/ESzHptZXNQdGtcDingxkH8QBHFIZXLVsCouHxiTg73rZVA?e=q2NKWs

# data[].attributes.body
After everyone completed the task, an online group discussion will be held to onboard everyone on what they have done for the project.

Every member can ask question during the meeting for in-depth understanding.

# data[].attributes.body
After the topic is selected, group member can propose fuzzy variables, fuzzy rules and related information in the group for further discussion

# data[].attributes.body
the member involve in part A have to propose a topic for Part A 21 May 2023 (Sunday)

# data[].attributes.body
Part A
1. Kit Yeng
2. Chivonne
3. Dray Ng
4. Azri

Part B
1. Pamela
2. Hazif

# data[].attributes.body
Foong Kit Yeng  | 74864
Chivonne Choi Yuping  | 74438
Ng Kian Hwa |  76018
Azrisham Ismadi  | 74255
Hazif Haqimi bin Hasnul Hadi  | 73486
Pamela Anak Jong Min  | 76537