Skip to content

Commit

Permalink
[joonspk-research#24, joonspk-research#38] Fix generate_hourly_schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
septagram committed Jan 13, 2024
1 parent 0fbd963 commit 289b4b9
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions reverie/backend_server/persona/cognitive_modules/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,29 @@ def generate_hourly_schedule(persona, wake_up_hour):
"10:00 AM", "11:00 AM", "12:00 PM", "01:00 PM", "02:00 PM",
"03:00 PM", "04:00 PM", "05:00 PM", "06:00 PM", "07:00 PM",
"08:00 PM", "09:00 PM", "10:00 PM", "11:00 PM"]
# Discarded original implementation: we don't have the luxury for multiple passes.
#
# n_m1_activity = []
# diversity_repeat_count = 3
# for i in range(diversity_repeat_count):
# n_m1_activity_set = set(n_m1_activity)
# if len(n_m1_activity_set) < 5:
# n_m1_activity = []
# for count, curr_hour_str in enumerate(hour_str):
# if wake_up_hour > 0:
# n_m1_activity += ["sleeping"]
# wake_up_hour -= 1
# else:
# n_m1_activity += [run_gpt_prompt_generate_hourly_schedule(
# persona, curr_hour_str, n_m1_activity, hour_str)[0]]
n_m1_activity = []
diversity_repeat_count = 3
for i in range(diversity_repeat_count):
n_m1_activity_set = set(n_m1_activity)
if len(n_m1_activity_set) < 5:
n_m1_activity = []
for count, curr_hour_str in enumerate(hour_str):
if wake_up_hour > 0:
n_m1_activity += ["sleeping"]
wake_up_hour -= 1
else:
n_m1_activity += [run_gpt_prompt_generate_hourly_schedule(
persona, curr_hour_str, n_m1_activity, hour_str)[0]]
for count, curr_hour_str in enumerate(hour_str):
if wake_up_hour > 0:
n_m1_activity += ["sleeping"]
wake_up_hour -= 1
else:
n_m1_activity += [run_gpt_prompt_generate_hourly_schedule(
persona, curr_hour_str, n_m1_activity, hour_str)[0]]

# Step 1. Compressing the hourly schedule to the following format:
# The integer indicates the number of hours. They should add up to 24.
Expand Down

0 comments on commit 289b4b9

Please sign in to comment.