dump updates

Signed-off-by: Hilmar Magnusson <hilmarmag@protonmail.com>
This commit is contained in:
Hilmar Magnusson 2024-11-14 08:18:17 +01:00
parent 2c70326c7c
commit 1d83544eab
3 changed files with 23 additions and 3 deletions

View File

@ -1,4 +1,4 @@
CaseID,ConsultantID,Procedure,Speciality,Expected Duration,TargetDeadline
CaseID,ConsultantID,Procedure,Speciality,Median Duration,TargetDeadline
1,C011,Cataract Surgery,Ophthalmology,45,07/07/2020
2,C011,Vitrectomy ,Ophthalmology,70,17/07/2020
3,C011,Cataract Surgery,Ophthalmology,45,05/06/2020

1 CaseID ConsultantID Procedure Speciality Expected Duration Median Duration TargetDeadline
2 1 C011 Cataract Surgery Ophthalmology 45 07/07/2020
3 2 C011 Vitrectomy  Ophthalmology 70 17/07/2020
4 3 C011 Cataract Surgery Ophthalmology 45 05/06/2020

View File

@ -51,7 +51,10 @@ class TheatreScheduler:
(dict): dictionary with SessionID as key and start time in minutes since midnight as value
"""
# Convert session start time from HH:MM:SS format into seconds elapsed since midnight
print(self.df_sessions.loc[:, "Start"])
self.df_sessions.loc[:, "Start"] = pd.to_timedelta(self.df_sessions["Start"])
# pd.to_timedelta(s.dt.time.astype(str)).dt.total_seconds()
print(self.df_sessions.loc[:, "Start"])
self.df_sessions.loc[:, "Start"] = self.df_sessions["Start"].dt.total_seconds() / 60
return pd.Series(self.df_sessions["Start"].values, index=self.df_sessions["SessionID"]).to_dict()
@ -95,20 +98,32 @@ class TheatreScheduler:
# Model Data
print('test4')
# List of case IDs in surgical waiting list
model.CASES = pe.Set(initialize=self.df_cases["CaseID"].tolist())
print('test5')
print(model.CASES)
# List of sessions IDs
model.SESSIONS = pe.Set(initialize=self.df_sessions["SessionID"].tolist())
print('test6')
print(model)
# List of sessions IDs
# List of tasks - all possible (caseID, sessionID) combination
model.TASKS = pe.Set(initialize=model.CASES * model.SESSIONS, dimen=2)
print(model.TASKS)
print('test7')
# The duration (median case time) for each operation
model.CASE_DURATION = pe.Param(model.CASES, initialize=self._generate_case_durations())
print('test8')
# The duration of each theatre session
model.SESSION_DURATION = pe.Param(model.SESSIONS, initialize=self._generate_session_durations())
print('test9')
# The start time of each theatre session
model.SESSION_START_TIME = pe.Param(model.SESSIONS, initialize=self._generate_session_start_times())
print('te0')
# The deadline of each case
model.CASE_DEADLINES = pe.Param(model.CASES, initialize=self._get_ordinal_case_deadlines())
print('te1')
# The date of each theatre session
model.SESSION_DATES = pe.Param(model.SESSIONS, initialize=self._get_ordinal_session_dates())
@ -252,9 +267,11 @@ class TheatreScheduler:
if __name__ == "__main__":
print('tet')
case_path = os.path.join(os.path.dirname(os.getcwd()), "data", "cases.csv")
session_path = os.path.join(os.path.dirname(os.getcwd()), "data", "sessions.csv")
cbc_path = "C:\\Users\\LONLW15\\Documents\\Linear Programming\\Solvers\\cbc.exe"
case_path = "/home/hmag/code/theatre-scheduling/data/cases.csv"
session_path = "/home/hmag/code/theatre-scheduling/data/sessions.csv"
# cbc_path = "C:\\Users\\LONLW15\\Documents\\Linear Programming\\Solvers\\cbc.exe"
options = {"seconds": 300}
scheduler = TheatreScheduler(case_file_path=case_path, session_file_path=session_path)

3
requirements.txt Normal file
View File

@ -0,0 +1,3 @@
pandas
pyomo
matplotlib