Iasd Miniproj nr1
Iasd Miniproj nr1
IASD2020/21 Assignment #1
Introduction
Efficient patient scheduling in an urgency room may lead to a life or death situation. The
situation is even more critical in pandemic times, like the ones we leave today, in which the
numbers of patients may increase significantly. Depending on a given number of patients in
the waiting room and doctors in service, the goal is to minimize the patient waiting time
for a consult. A critical component is how we should handle the different seriousness levels
that each patient has. As standard in every urgency room, patients are labeled depending
on their needs (maximum waiting time and the duration of the consults), usually with color
bracelets. This project aims at addressing this problem of finding the patient/medical doctor
association schedule, from now called the PMDA problem.
1 Problem Statement
Consider the following specifications:
• Let M be a set of medical doctors in the urgency room. For several reasons that may
include the need to be focusing on other services, for each m ∈ M we have an efficient
rate me , which indicates the ration of time the medical doctor will be focused on the
patient. For a time interval of 10 minutes, a doctor with me = 0.5 will only contribute
to 5 min of the overall time for the consult of a patient.
• Consider a set of bracelet colors (patient labels) denoted as L, where each l ∈ L has a
tuple with two time intervals (lmw , lct ): 1) lmw indicates the maximum time a patient
with label l should wait; and 2) lct indicates the respective amount of time needed in
consult.
1
• P represents the set of patients. Each patient has associated a tuple (pwt , plabel ): 1) pwt
indicates the time the patient was waiting before the scheduling; and 2) plabel indicates
the label associated to the patient p.
• t is the time interval in which the evaluation and new assignments are done. For
simplicity, we will consider a fixed time interval equal to 5 min. Notice that patients
can be in a consult in a specific time interval and leave without accomplish the total
time needed for a consult (this means that he/she must return).
As indicated in the introduction, the problem consists of assigning patients to medical
doctors. Two main concerns must be considered: 1) the patients must not wait more than
the time indicated by their labels; and 2) we must minimize the long waiting times for all
the patients in the waiting room. For the second concern, we consider the following cost
associated to all the patients in the waiting room: C(P) = (p in P) p2cw where pcw is the
P
2 Objective
This mini-project aims to solve the previous section’s problem using uninformed/informed
search methods. This includes defining:
• A state representation;
• The operators;
• The goal condition;
• The heuristics (if needed); and
• The search strategy,
allowing an appropriate search method to find the optimal solution. The implementation
should be done in Python version 3.x. No extra modules, besides the Python Standard
Library, are allowed. The search algorithm implementations are the ones from the GitHub
repository of the course textbook, namely the module search.py available from https:
//github.com/aimacode/aima-python. The problem should be implemented as a Python
class with the name PMDAProblem, which derives from the abstract class search problem,
and that defines (at least) the following methods:
actions(s) Returns a list (or a generator) of operators applicable to state s;
result(s, a) Returns the state resulting from applying action a to state s;
goal test(s) Returns True if state s is a goal state, and False otherwise;
path cost(c, s1, a, s2) Returns the path cost of state s2, reached from state s1 by
applying action a, knowing that the path cost of s1 is c;
2
load(f) Loads a problem from a (opened) file object f (see below for format specification);
save(f, s) Saves a solution state s to a (opened) file object f (see below for format speci-
fication); and
search() Computes the solution to the problem. It should return True or False, indicating
whether it was possible or not to find a solution.
The choice of state and action representations and searching algorithm is entirely up to
the groups choice. If the students want to use informed search methods, an heuristic must
be defined: (Check the available options in the search.py module.)
MD <code> <efficiency>
to specify a medical doctor with code <code> and efficiency <efficiency>.
In the problem definition file, we will get all the lines specifying the available medical
doctors before the patient labels; and all the patient labels set before the list of presenting
the list of patients in the waiting room.
3
to specify the assignment of patients. The medical doctor with code <code> will first see
patient with code <patient1 code>, followed by <patient2 code>, and so on.
When a medical doctor has associated an empty slot (no patient needs attention), the
code should contain the sentence empty. See the example below.
Notice that, if the input problem is infeasible, the search() method should return False.
The evaluation will not consider any output file.
4 Evaluation
The deliverable for this mini-project has two components:
• A single Python file, called solution.py, implementing the above mentioned PMDAProb-
lem class, and
5 Example files
For the PMDA Problem specified with:
MD 0001 1
MD 0002 0.5
PL 01 10 15
PL 02 20 10
PL 03 40 5
P 001 0 01
P 002 15 03
P 003 0 02
4
P 004 5 01
P 005 10 03
P 006 15 03
which corresponds to a waiting time of 10 min for patient 001, 40 min for 002, 20 min for
003, 5 min for 004, 40 min for 005 , and 15 min for patient 006, and a total cost of 3950.