supply-roster-optimization / src /config /optimization_config.py
HaLim
Change fixed values into variables from the UI or the database
29608b7
raw
history blame
3.43 kB
import pandas as pd
import src.etl.transform as transformed_data
import streamlit_page.page1 as dashboard
import datetime
from datetime import timedelta
import src.etl.extract as extract
def get_date_span():
try:
start_date = dashboard.start_date
end_date = dashboard.end_date
date_span = list(range(1, (end_date - start_date).days + 1))
print(f"date from user input")
return date_span, start_date, end_date
except Exception as e:
print(f"using default value for date span")
return list(range(1, 5)), datetime(2025, 3, 24), datetime(2025, 3, 28) # Default 7 days
#fetch date from streamlit or default value. The streamlit and default references the demand data (COOIS_Planned_and_Released.csv)
DATE_SPAN, start_date, end_date = get_date_span()
# COOIS_Released_Prod_Orders.csv
PRODUCT_LIST = transformed_data.get_released_product_list(start_date, end_date)
print(PRODUCT_LIST)
def get_employee_type_list():
try:
streamlit_employee_type_list = dashboard.employee_type_list
return streamlit_employee_type_list
except Exception as e:
print(f"using default value for employee type list")
employee_type_list = extract.read_employee_data()
emp_type_list = employee_type_list["employment_type"].unique()
return emp_type_list
EMPLOYEE_TYPE_LIST = get_employee_type_list()
print(EMPLOYEE_TYPE_LIST)
def get_shift_list():
try:
streamlit_shift_list = dashboard.shift_list
return streamlit_shift_list
except Exception as e:
print(f"using default value for shift list")
shift_list = extract.read_shift_data()
shift_list = shift_list["shift"].unique()
return shift_list
SHIFT_LIST = get_shift_list()
print(SHIFT_LIST)
LINE_LIST = ["long", "short"] # WH_Workforce_Hourly_Pay_Scale.csv -> This is default setting. User should be able to manipulate
LINE_LIST_PER_TYPE = {
"long": 2,
"short": 3,
} # Work_centre_capacity but not enough on the number of line and exact number of capacity
DEMAND_LIST = {"a": 1000, "b": 6000, "c": 4000} # COOIS_Planned_and_Released.csv
COST_LIST_PER_EMP_SHIFT = { # WH_Workforce_Hourly_Pay_Scale
"Fixed": {1: 0, 2: 22, 3: 18},
"Humanizer": {1: 10, 2: 10, 3: 10},
}
PRODUCTIVITY_LIST_PER_EMP_PRODUCT = { # Kits_Calculation
"Fixed": {
1: {"a": 1000, "b": 1000, "c": 1000},
2: {"a": 1000, "b": 1000, "c": 1000},
3: {"a": 1000, "b": 1000, "c": 1000},
},
"Humanizer": {
1: {"a": 10, "b": 6, "c": 5},
2: {"a": 1000, "b": 1000, "c": 1000},
3: {"a": 1000, "b": 1000, "c": 1000},
},
} # Kits_Calculation.csv
MAX_EMPLOYEE_PER_TYPE_ON_DAY = { # Not available information
"Fixed": {
t: 8 for t in DATE_SPAN
}, # EDIT: e.g., {'x': {1:5,2:5,...}, 'y':{1:6,...}}
"Humanizer": {t: 6 for t in DATE_SPAN},
}
# available employee but for fixed in shift 1, it is mandatory employment
MAX_HOUR_PER_PERSON_PER_DAY = 14 # legal standard
MAX_HOUR_PER_SHIFT_PER_PERSON = {1: 3, 2: 4, 3: 6} # work_shifts_timing.csv
CAP_PER_LINE_PER_HOUR = {
"long": 2200,
"short": 1600,
}
# number of products that can be produced per hour per line
DAILY_WEEKLY_SCHEDULE = "daily" # daily or weekly ,this needs to be implementedin in if F_x1_day is not None... F_x1_week is not None... also need to change x1 to Fixedstaff_first_shift