COMP9414: Artificial Intelligence
Assignment 1: Fuzzy Scheduling

“硬性”（必须在任何有效的时间表中满足最后期限）或“软性”（任务可能会延迟完成）
–尽管仍在下午5点或之前–但由于错过了截止日期，因此每小时收取“费用”。目的

“上午11点”，“下午12点”，“下午1点”，“下午2点”，“下午3点”，“下午4点”和“下午5点”。开始和结束的唯一可能值

＃二进制约束

＃硬域约束

＃软期限限制

＃个任务的名称和持续时间

（代表任务），C是所有软截止期限约束的集合。假设这样一个约束

cv∈C
costcv ∗δ（（dv，tv），（dcv
，电视
））

h（S）= P
cv∈Cmin（dv，tv）∈dom（v）costcv ∗δ（（dv，tv），（dcv
，电视
））
Implementation
Put all your code in one Python file called fuzzyScheduler.py. You may (in one or two cases)
copy code from AIPython to fuzzyScheduler.py and modify that code, but do not copy large
amounts of AIPython code. Instead, in preference, write classes in fuzzyScheduler.py that
extend the AIPython classes.
Use the Python code for generic search algorithms in searchGeneric.py. This code includes a
class Searcher with a method search that implements depth-first search using a list (treated
as a stack) to solve any search problem (as defined in searchProblem.py). For this assignment,
modify the AStarSearcher class that extends Searcher and makes use of a priority queue to store
the frontier of the search. Order the nodes in the priority queue based on the cost of the nodes
calculated using the heuristic function.
Use the Python code in cspProblem.py, which defines a CSP with variables, domains and constraints. Add costs to CSPs by extending this class to include a cost and a heuristic function h to
calculate the cost. Also use the code in cspConsistency.py. This code implements the transitions
in the state space necessary to solve the CSP. The code includes a class Search with AC from CSP
that calls a method for domain splitting. Every time a CSP problem is split, the resulting CSPs
are made arc consistent (if possible). Rather than extending this class, you may prefer to write
a new class Search with AC from Cost CSP that has the same methods but implements domain
splitting over constraint optimization problems.
You should submit your fuzzyScheduler.py and any other files from AIPython needed to run
your program (see below). The code in fuzzyScheduler.py will be run in the same directory
as the AIPython files that you submit. Your program should read input from a file passed as an
argument and print output to standard output.
Sample Input
All input will be a sequence of lines defining a number of tasks, binary constraints and domain
constraints, in that order. Comment lines (starting with a ‘#’ character) may also appear in the
file, and your program should be able to process and discard such lines. All input files can be
assumed to be of the correct format – there is no need for any error checking of the input file.
Below is an example of the input form and meaning. Note that you will have to submit at least
three input test files with your assignment. These test files should include one or more comments
to specify what scenario is being tested.
# two tasks with two binary constraints and soft deadlines
task, t1 3
task, t2 4
# two binary constraints
constraint, t1 before t2
constraint, t1 same-day t2
# domain constraint
domain, t2 mon
# soft deadlines
domain, t1 ends-by mon 3pm 10
domain, t2 ends-by mon 3pm 10
Sample Output
Print the output to standard output as a series of lines, giving the start day and time for each task
(in the order the tasks were defined). If the problem has no solution, print ‘No solution’. When
there are multiple optimal solutions, your program should produce one of them. Important: For
auto-marking, make sure there are no extra spaces at the ends of lines, and no extra line at the
end of the output. Set all display options in the AIPython code to 0.
The output corresponding to the above input is as follows:
t1:mon 9am
t2:mon 12pm
cost:10
Submission
• Submit all your files using the following command (this includes relevant AIPython code):
give cs9414 ass1 fuzzyScheduler.py search*.py csp*.py display.py *.txt
• Your submission should include:
– Your .py source file(s) including any AIPython files needed to run your code
– A series of .txt files (at least three) that you have used as input files to test your system
(each including comments to indicate the scenarios tested), and the corresponding .txt
output files (call these input1.txt, output1.txt, input2.txt, output2.txt, etc.);
submit only valid input test files
• When your files are submitted, a test will be done to ensure that your Python files run on
the CSE machine (take note of any error messages printed out)
• Check that your submission has been received using the command:
9414 classrun -check ass1
Assessment
Marks for this assignment are allocated as follows:
• Correctness (auto-marked): 10 marks
• Programming style: 5 marks
Late penalty: 3 marks per day or part-day late off the mark obtainable for up to 3
(calendar) days after the due date.
Assessment Criteria
• Correctness: Assessed on valid input tests as follows (where the input file can have any
name, not just input1.txt, so read the file name from sys.argv[1]):
python3 fuzzyScheduler.py input1.txt > output1.txt
• Programming style: Understandable class and variable names, easy to understand code,
good reuse of AIPython code, adequate comments, suitable test files
Plagiarism
Remember that ALL work submitted for this assignment must be your own work and no code
sharing or copying is allowed. You may use code from the Internet only with suitable attribution
of the source in your program. Do not use public code repositories. All submitted assignments will
be run through plagiarism detection software to detect similarities to other submissions, including
from past years. You should carefully read the UNSW policy on academic integrity and plagiarism
(linked from the course web page), noting, in particular, that collusion (working together on an
assignment, or sharing parts of assignment solutions) is a form of plagiarism. There is also a new
plagiarism policy starting this term with more severe penalties.

EasyDue™ 支持PayPal, AliPay, WechatPay, Taobao等各种付款方式!

E-mail: easydue@outlook.com  微信:easydue

EasyDue™是一个服务全球中国留学生的专业代写公司