def test_append_input_workplace(): """test_append_input_workplace.""" workplace = BaseWorkplace("workplace") workplace1 = BaseWorkplace("workplace1") workplace2 = BaseWorkplace("workplace2") workplace.append_input_workplace(workplace1) workplace.append_input_workplace(workplace2) assert workplace.input_workplace_list == [workplace1, workplace2] assert workplace1.output_workplace_list == [workplace] assert workplace2.output_workplace_list == [workplace]
def dummy_conveyor_project_with_child_component(): """dummy_conveyor_project_with_child_component.""" c1_1 = BaseComponent("c1_1") c1_2 = BaseComponent("c1_2") c2_1 = BaseComponent("c2_1") c2_2 = BaseComponent("c2_2") c3_1 = BaseComponent("c3_1") c3_2 = BaseComponent("c3_2") c1_2.append_child_component(c1_1) c2_2.append_child_component(c2_1) c3_2.append_child_component(c3_1) taskA1 = BaseTask("A1", need_facility=True, default_work_amount=6) taskA2 = BaseTask("A2", need_facility=True, default_work_amount=2) taskA3 = BaseTask("A3", need_facility=True, default_work_amount=2) taskB1 = BaseTask("B1", need_facility=True, default_work_amount=2) taskB2 = BaseTask("B2", need_facility=True, default_work_amount=7) taskB3 = BaseTask("B3", need_facility=True, default_work_amount=2) c1_1.append_targeted_task(taskA1) c1_2.append_targeted_task(taskB1) c2_1.append_targeted_task(taskA2) c2_2.append_targeted_task(taskB2) c3_1.append_targeted_task(taskA3) c3_2.append_targeted_task(taskB3) taskB1.append_input_task(taskA1) taskB2.append_input_task(taskA2) taskB3.append_input_task(taskA3) f1 = BaseFacility("f1") f1.workamount_skill_mean_map = { taskA1.name: 1.0, taskA2.name: 1.0, taskA3.name: 1.0, } f2 = BaseFacility("f2") f2.workamount_skill_mean_map = { taskA1.name: 1.0, taskA2.name: 1.0, taskA3.name: 1.0, } f3 = BaseFacility("f3") f3.workamount_skill_mean_map = { taskB1.name: 1.0, taskB2.name: 1.0, taskB3.name: 1.0, } f4 = BaseFacility("f4") f4.workamount_skill_mean_map = { taskB1.name: 1.0, taskB2.name: 1.0, taskB3.name: 1.0, } # Workplace in BaseOrganization wp1 = BaseWorkplace("workplace1", facility_list=[f1], max_space_size=1.0) wp1.extend_targeted_task_list([taskA1, taskA2, taskA3]) wp2 = BaseWorkplace("workplace2", facility_list=[f2], max_space_size=2.0) wp2.extend_targeted_task_list([taskA1, taskA2, taskA3]) wp3 = BaseWorkplace("workplace3", facility_list=[f3], max_space_size=4.0) wp3.extend_targeted_task_list([taskB1, taskB2, taskB3]) wp4 = BaseWorkplace("workplace4", facility_list=[f4], max_space_size=4.0) wp4.extend_targeted_task_list([taskB1, taskB2, taskB3]) wp3.append_input_workplace(wp1) wp4.append_input_workplace(wp2) # BaseTeams in BaseOrganization team = BaseTeam("team") team_list = [team] team.extend_targeted_task_list( [taskA1, taskA2, taskA3, taskB1, taskB2, taskB3]) # BaseWorkers in each BaseTeam w1 = BaseWorker("w1", team_id=team.ID) w1.workamount_skill_mean_map = { taskA1.name: 1.0, taskA2.name: 1.0, taskA3.name: 1.0, } w1.facility_skill_map = {f1.name: 1.0} team.add_worker(w1) w2 = BaseWorker("w2", team_id=team.ID) w2.workamount_skill_mean_map = { taskA1.name: 1.0, taskA2.name: 1.0, taskA3.name: 1.0, } w2.facility_skill_map = {f2.name: 1.0} team.add_worker(w2) w3 = BaseWorker("w3", team_id=team.ID) w3.workamount_skill_mean_map = { taskB1.name: 1.0, taskB2.name: 1.0, taskB3.name: 1.0, } w3.facility_skill_map = {f3.name: 1.0} team.add_worker(w3) w4 = BaseWorker("w4", team_id=team.ID) w4.workamount_skill_mean_map = { taskB1.name: 1.0, taskB2.name: 1.0, taskB3.name: 1.0, } w4.facility_skill_map = {f4.name: 1.0} team.add_worker(w4) workplace_list = [wp1, wp2, wp3, wp4] # BaseProject including BaseProduct, BaseWorkflow and Organization project = BaseProject( init_datetime=datetime.datetime(2021, 8, 20, 8, 0, 0), unit_timedelta=datetime.timedelta(days=1), product=BaseProduct([c1_1, c1_2, c2_1, c2_2, c3_1, c3_2]), workflow=BaseWorkflow([taskA1, taskA2, taskA3, taskB1, taskB2, taskB3]), organization=BaseOrganization(team_list, workplace_list), ) return project