Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write PYTHON code for this problem. This should be Object Oriented Solution. Write two Classes for this problem. Class Task: Class Worker: Problem Statement

Write PYTHON code for this problem.

This should be Object Oriented Solution.

Write two Classes for this problem.

Class Task:

Class Worker:

""" Problem Statement customers send us collections of data over the course of each week. Lets call each unit of data a task. We send these tasks to our work force for labeling. When these tasks are labeled, we send them back to the customer.

Each task goes through three sequential stages:

L0 L1 L2

A task is only complete when it reaches the L2 stage and work is finished on the L2 stage

Notes: - There is a 1:1 mapping between task stages and workers working on a task stage. (i.e Task X L1 can only have 1 worker at one time, that worker cannot be working on anything else) - A worker can only work on a task if the worker has never worked on that task before. - For now, assume each worker takes 1 timestep. We may change this later. - Tasks should be greedily assigned to any free workers who can work on the task.

Write a system that simulates the environment and runs until all tasks are completed. Do not worry about runtime, we are looking for correctness. On every timestep where activity happens: Print out the timestep, and all the activities that happened. (worker assignment/completion). At the end, print out the total number of time steps taken to complete the simulation.

This is the input

Sample input 1: tasks = [Task('A')] workers = [Worker('X'), Worker('Y'), Worker('Z')]

This is the output look like

Sample output 1: 0 Assigning X to Task A for L0 1 Worker X finished Task A for L0 Assigning Y to Task A for L1 2 Worker Y finished Task A for L1 Assigning Z to Task A for L2 3 Worker Z finished Task A for L2 Total time taken: 3 ts

Sample input 2: tasks = [Task('A'), Task('B')] workers = [Worker('X'), Worker('Y'), Worker('Z')]

Sample output 2: 0 Assigning X to Task A for L0 Assigning Y to Task B for L0 1 Worker X finished Task A for L0 Worker Y finished Task B for L0 Assigning Z to Task A for L1 Assigning X to Task B for L1 2 Worker Z finished Task A for L1 Worker X finished Task B for L1 Assigning Y to Task A for L2 Assigning Z to Task B for L2 3 Worker Y finished Task A for L2 Worker Z finished Task B for L2 Total time taken: 3 ts

Class Task:

#Implement

Class Worker:

#Implement

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Horngrens Cost Accounting A Managerial Emphasis

Authors: Srikant Datar, Madhav Rajan

16th Global Edition

1292211547, 9781292211541

More Books

Students also viewed these Accounting questions

Question

=+ Interviews with key people. Which people?

Answered: 1 week ago

Question

=+ Judgmental assessment: personal experience or outside experts?

Answered: 1 week ago

Question

=+ On what criteria should the program be judged? 9

Answered: 1 week ago