Skip to content

Commit

Permalink
cluttering -> clustering
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgengaldal committed Aug 18, 2024
1 parent 3a83af9 commit 613006b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions algorithm/src/mip_matching/match_meetings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
APPLICANT_BUFFER_LENGTH = timedelta(minutes=15)

# Et mål på hvor viktig det er at intervjuer er i nærheten av hverandre
CLUTTERING_WEIGHT = 0.001
CLUSTERING_WEIGHT = 0.001

# Når på dagen man helst vil ha intervjuene rundt
CLUTTERING_TIME_BASELINE = time(12, 00)
MAX_SCALE_CLUTTERING_TIME = timedelta(seconds=43200) # TODO: Rename variable
CLUSTERING_TIME_BASELINE = time(12, 00)
MAX_SCALE_CLUSTERING_TIME = timedelta(seconds=43200) # TODO: Rename variable


class MeetingMatch(TypedDict):
Expand Down Expand Up @@ -71,25 +71,25 @@ def match_meetings(applicants: set[Applicant], committees: set[Committee]) -> Me
model += m[(applicant, *interview_a)] + \
m[(applicant, *interview_b)] <= 1 # type: ignore

# Legger til sekundærmål om at man ønsker å sentrere intervjuer rundt CLUTTERING_TIME_BASELINE
cluttering_objectives = []
# Legger til sekundærmål om at man ønsker å sentrere intervjuer rundt CLUSTERING_TIME_BASELINE
clustering_objectives = []

for name, variable in m.items():
applicant, committee, interval = name
if interval.start.time() < CLUTTERING_TIME_BASELINE:
relative_distance_from_baseline = subtract_time(CLUTTERING_TIME_BASELINE,
interval.end.time()) / MAX_SCALE_CLUTTERING_TIME
if interval.start.time() < CLUSTERING_TIME_BASELINE:
relative_distance_from_baseline = subtract_time(CLUSTERING_TIME_BASELINE,
interval.end.time()) / MAX_SCALE_CLUSTERING_TIME
else:
relative_distance_from_baseline = subtract_time(interval.start.time(),
CLUTTERING_TIME_BASELINE) / MAX_SCALE_CLUTTERING_TIME
CLUSTERING_TIME_BASELINE) / MAX_SCALE_CLUSTERING_TIME

cluttering_objectives.append(
CLUTTERING_WEIGHT * relative_distance_from_baseline * variable) # type: ignore
clustering_objectives.append(
CLUSTERING_WEIGHT * relative_distance_from_baseline * variable) # type: ignore

# Setter mål til å være maksimering av antall møter
# med sekundærmål om å samle intervjuene rundt CLUTTERING_TIME_BASELINE
# med sekundærmål om å samle intervjuene rundt CLUSTERING_TIME_BASELINE
model.objective = mip.maximize(
mip.xsum(m.values()) + mip.xsum(cluttering_objectives))
mip.xsum(m.values()) + mip.xsum(clustering_objectives))

# Kjør optimeringen
solver_status = model.optimize()
Expand Down
2 changes: 1 addition & 1 deletion algorithm/src/mip_matching/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def group_by_committee(meetings: list[tuple[Applicant, Committee, TimeInterval]]
return result


def measure_cluttering(meetings: list[tuple[Applicant, Committee, TimeInterval]]) -> int:
def measure_clustering(meetings: list[tuple[Applicant, Committee, TimeInterval]]) -> int:
grouped_meetings = group_by_committee(meetings)

holes = 0
Expand Down

0 comments on commit 613006b

Please sign in to comment.