From 1d83544eabe4ace9e45e4890dcccae2a82bb1dd3 Mon Sep 17 00:00:00 2001 From: Hilmar Magnusson Date: Thu, 14 Nov 2024 08:18:17 +0100 Subject: [PATCH] dump updates Signed-off-by: Hilmar Magnusson --- data/cases.csv | 2 +- modelling/scheduler.py | 21 +++++++++++++++++++-- requirements.txt | 3 +++ 3 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 requirements.txt diff --git a/data/cases.csv b/data/cases.csv index 14fdfc1..86adcf9 100644 --- a/data/cases.csv +++ b/data/cases.csv @@ -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 diff --git a/modelling/scheduler.py b/modelling/scheduler.py index faf4449..7cc09df 100644 --- a/modelling/scheduler.py +++ b/modelling/scheduler.py @@ -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) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..160f587 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +pandas +pyomo +matplotlib