CNSCC.361 Artificial Intelligence


CW Assignment CNSCC.361
AI
CNSCC.361 Artificial Intelligence Coursework
Introduction:
Marking Scheme
20% of the mark for the CNSCC.361 module is based on the coursework.
At the end of this document, there is an Appendix providing suggestions for a well written
report.
Submission
Put your codes in separate folders (“cw_task1” for task1 and “cw_task2” for task2)
and call the overall zipped file “cw_lastname_firstname.zip” (replace lastname and
firstname with your names). Submit your “cw_lastname_firstname.zip” file and your
report on Moodle.
The length of the report should not exceed 5 pages (the format is specified at the
end of this document – two column, minimum font size 10pt). It is important to
note that we do not want separate reports. There has to be one report.
CW Assignment CNSCC.361
AI
Task 1
This task of the assignment requires you to perform pre-processing of the real climate data
set (temperature and wind speed) measured in Manchester, UK for the period 2010–2015
provided in the file “ClimateData.csv”. This data is a subset of publically available (from
http://www.worldweatheronline.com) data about climate at Manchester which contain 938
records and five features写CNSCC.361 Artificial Intelligence (i.e., five dimensional vectors) of data from the Summer and the
Winter seasons of the period from 2010 to 2014. The meaning of each column of data is
listed below:
Temperature, oC Wind speed, mph Wind direction, deg Precipitation, mm Humidity, %
Recall from the Lectures and the Lab sessions, the main pre-processing steps:
i) normalization,
ii) standardization,
iii) anomaly detection.
Explain clearly the work of the algorithms, analyze their advantages and disadvantages,
provide the code that you developed (do not use downloaded code from elsewhere and be
aware about the plagiarism policy of the University) and the results.
From the literature you may find other pre-processing algorithms (e.g. recursive density
estimation, PCA, etc.) which you can also mention in your analysis and/or use. For these
additional (optional) algorithms you can use available code assuming you correctly make a
reference to it; however, demonstrating the understanding of it is necessary. These
additional/optional algorithms are for distinguishing between good, average and excellent
reports.
Task 2
The Traveling Salesman Problem (TSP) is one of the most famous problems in computer
science. Here we describe the problem and you will implement a Genetic Algorithm (GA)
to find a solution, and show and analyse your results. These are to be done in MATLAB.
GA has been introduced and discussed as part of a lecture. There was also a lab about
GA to give you an initial understanding of the GA approach, but this Task will be applying
GA to a different problem than the one in the lab.
TSP consists of attempting to find the shortest complete tour through a series of points
(cities), starting and ending with the same point (see Figure 1). Finding the shortest route
that visits a set of locations is an exponentially difficult problem: finding the shortest path
for 20 cities is much more than twice as hard as 10 cities. An exhaustive search of all
possible paths would be guaranteed to find the shortest, but is computationally intractable
for all but small sets of locations. For larger problems, optimization techniques, such as
GA, are needed to intelligently search the solution space and find near-optimal solutions.
CW Assignment CNSCC.361
AI
Mathematically, traveling salesman problem can be represented as a graph, where the
locations are the nodes and the edges (or arcs) represent direct routes between the nodes.
The weight of each edge is the distance between the nodes. It is a minimization problem
starting and finishing at a specified vertex after having visited each other vertex exactly
once. The goal is to find the path with the shortest sum of weights. Below, we see a simple
five-node graph:
Figure 1- Shortest route example: the problem lies in finding a minimal path passing from all vertices once. For
example the path Path1 {A, B, C, D, E, A} and the path Path2 {A, B, C, E, D, A} pass all the vertices but Path1 has a
total length of 24 and Path2 has a total length of 31.
In this task, you will be given the (x,y) location of 100 cities in “xy.mat” file. So, each
population member (chromosome) will have 100 gens.
Finding a solution to the travelling salesman problem requires that you set up a genetic
algorithm in a specialized way. For instance, a valid solution need to represent a route
where every location is included at least once and only once. If a route contain a single
location more than once, or missed a location out completely it would not be valid. To
ensure the genetic algorithm does indeed meet this requirement special types of mutation
and crossover methods are needed. Firstly, the mutation method should only be capable
of shuffling the route, it shouldn't ever add or remove a location from the route, and
otherwise it would risk creating an invalid solution. Question: What type of mutation? For
each selected population member, try three different mutation operators (Swap, Flip and
Slide) to generate three new population members. With swap mutation two location in the
route are selected at random then their positions are simply swapped. For example, if we
apply swap mutation to the following list, [1,2,3,4,5,6,7,8,9] we might end up with,
[1,2,5,4,3,6,7,8,9]. Here, positions 3 and 5 were switched creating a new list with exactly
the same values, just a different order. Because swap mutation is only swapping preexisting values, it will never create a list which has missing or duplicate values when
compared to the original, and that's exactly what we want for the traveling salesman
problem. With Flip mutation two locations in the route are selected at random, and then,
the positions between two locations are simply flipped. For example, given two randomly
selected locations 3 and 7, if we apply swap mutation to the following list [1,2,3,4,5,6,7,8,9],
we end up with [1,2,7,6,5,4,3,8,9]. Moreover, if we apply slide mutation to the list
[1,2,3,4,5,6,7,8,9], we end up with [1,2,4,5,6,7,3,8,9]. You also need to pick a crossover
method which can enforce the same constraint. What type of crossover? Ordered
crossover.
CW Assignment CNSCC.361
AI
Implement Genetic Algorithm
Your main task is to implement with MATLAB a genetic algorithm that attempts to find a
near-optimal solution. You cannot use MATLAB's “ga” function, so you have to implement
something similar to what you did in the lab.
Your algorithm should make use of crossover and mutation as described above. Begin
with an initial population of at least 50 members and then increase to 200 members (start
with 50 members, then try 100, 150 and 200 members). Run your algorithm for at least
1000 generations/iterations and then increase to 10000 (start with 1000 generations, then
try 2000, 4000, 6000, 8000, and 10000 generations/iterations). Choose the best ones.
You will need to make many design decisions on how to implement the algorithm and what
parameter values to use. For example, you could try different selection methods including
roulette-wheel selection, ranking selection and tournament selection to see which one is
better. Submit the best algorithm. Your mark will depend not only on the code that you
write but also on how well you document your design decisions. In your report, you should
also answer the following questions:
What was the fitness score of the most-fit individual in the first generation? What was
the fitness score of the most-fit individual in the last generation? Plot the fitness score of
the most-fit individual in each generation.
What path did the most-fit individual in the final generation take through the cities? Run the
following code to visualize the path of the most-fit individual in the last generation.
figure('Name','TSP_GA | Results','Numbertitle','off');
subplot(2,2,1);
pclr = ~get(0,'DefaultAxesColor');
plot(xy(:,1),xy(:,2),'.','Color',pclr);
title('City Locations'); subplot(2,2,2);
rte = optRoute([1:100 1]);
plot(xy(rte,1),xy(rte,2),'r.-');
title(sprintf('Total Distance = %1.4f',minDist));
Note that “xy” variable is a 100 × 2 matrix consisting of the (x,y) location of 100 cities
and optRoute variable (integer array) is the best route found by the algorithm (i.e., the
most-fit individual in the final generation). optRoute is 1 × 100 vector. This code will show
a figure as shown below but the connections between cities and total distance might be
different.
CW Assignment CNSCC.361
AI
What was the string of 100 digits of the most-fit individual in the final generation?
Run the algorithm 10 times. Does the fitness score of the most-fit individual in the last
generation change? If so, why?
Run the algorithm using tournament selection, without cross-over operator and using all
three mutation operators (swap, flip and slide) with population of 100 members. Run your
algorithm for 10000 generations/iterations. What was the fitness score of the most-fit
individual in the last generation? Run the above mentioned code to visualize the path of
the most-fit individual in the last generation.
The coursework will be marked based on:
• Code efficiency
• Code commenting and writing style
• Presentation and writing of the report
• Critical Understanding
• Research and Results
• Use of Literature
• Conclusion and Analysis
CW Assignment CNSCC.361
AI
Appendix
Requirements for a Well Written Report
The report should contain:
1. Title, name, student number, course, etc., followed by an abstract.
2. Main part: Introduction, review of the state of the art. The description of the
algorithm and how it performs, including showing results with images. For instance:
“This report describes development and application of the k-means clustering
algorithm to image processing data…” Give the software code that you used to
obtain the results in an Appendix. A very important part of your report is the
analysis of the results. For instance, what are the advantages and limitations of the
algorithms that you used? How can you characterize the results? Are they
accurate?)
3. Conclusions: should describe briefly what has been done, with a summary of
the main results and outline of the possible future work.The objective of the assignment is to conduct data analysis on a set of data, and presentconclusions on the results.
WX:codinghelp

  • 11
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
牙科就诊管理系统利用当下成熟完善的SSM框架,使用跨平台的可开发大型商业网站的Java语言,以及最受欢迎的RDBMS应用软件之一的Mysql数据库进行程序开发。实现了用户在线查看数据。管理员管理病例管理、字典管理、公告管理、药单管理、药品管理、药品收藏管理、药品评价管理、药品订单管理、牙医管理、牙医收藏管理、牙医评价管理、牙医挂号管理、用户管理、管理员管理等功能。牙科就诊管理系统的开发根据操作人员需要设计的界面简洁美观,在功能模块布局上跟同类型网站保持一致,程序在实现基本要求功能时,也为数据信息面临的安全问题提供了一些实用的解决方案。可以说该程序在帮助管理者高效率地处理工作事务的同时,也实现了数据信息的整体化,规范化与自动化。 管理员在后台主要管理病例管理、字典管理、公告管理、药单管理、药品管理、药品收藏管理、药品评价管理、药品订单管理、牙医管理、牙医收藏管理、牙医评价管理、牙医挂号管理、用户管理、管理员管理等。 牙医列表页面,此页面提供给管理员的功能有:查看牙医、新增牙医、修改牙医、删除牙医等。公告信息管理页面提供的功能操作有:新增公告,修改公告,删除公告操作。公告类型管理页面显示所有公告类型,在此页面既可以让管理员添加新的公告信息类型,也能对已有的公告类型信息执行编辑更新,失效的公告类型信息也能让管理员快速删除。药品管理页面,此页面提供给管理员的功能有:新增药品,修改药品,删除药品。药品类型管理页面,此页面提供给管理员的功能有:新增药品类型,修改药品类型,删除药品类型。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值