from random import shuffle import random #Config simulation_iteration=8 #How much statistical iterations should the evaluation have, the higher is more precise capacity= 5 #How much tasks can you take once cur_tasks=[110,300,300,90,1000] #current tasks and how long do they take from now on (in days) forward_thinking_in_days=600 #Do you want to know if an opportunity is worth it in the long or short term? task_weight_in_days=180 #How much should the new task take to finish? sample_yearspan=19 #Previous sample length in years. meta_tasks=[1000,10,10,10,10,10,10,10,10,10,100,100,300,300,90,30,110] #The tasks so far you have received in your life. #END config DAYS_YEAR=365 day_chance=len(meta_tasks)/(DAYS_YEAR*sample_yearspan) missed_tasks=0 def try_insert_task(start_tasks,task): global missed_tasks if len(start_tasks)0: new_tasks.append(tasks[n]) return new_tasks def simulate_next_days(start_tasks=[],day_count=10): global missed_tasks missed_tasks=0 for n in range(0,day_count): #Integrate over each day passed start_tasks=age_tasks(start_tasks) start_tasks = simulate_get_meta_task(start_tasks) #print(start_tasks) return missed_tasks def simulate_N_tasks(start_tasks=[],day_count=10,N=1): total_missed_tasks=0 for n in range(0,N): total_missed_tasks+=simulate_next_days(start_tasks,day_count) return (total_missed_tasks) def is_opportunity_worth(cur_tasks=[],day_overtime=10,opportunity_completion_time=100): t1=cur_tasks.copy() avg_no_opp=simulate_N_tasks(t1,day_overtime,simulation_iteration) t2=cur_tasks.copy() t2.append(opportunity_completion_time) avg_yes_opp=simulate_N_tasks(t2,day_overtime,simulation_iteration) if avg_yes_opp<=avg_no_opp: return True return False print("Is opportunity worth it: "+str(is_opportunity_worth(cur_tasks,forward_thinking_in_days,task_weight_in_days)))