Answered step by step
Verified Expert Solution
Question
1 Approved Answer
WRITE IN PYTHON:In this task you will finally allocate the Zoomerbinis to their study groups! Write a function alloc _ study _ groups ( zbinis
WRITE IN PYTHON:In this task you will finally allocate the Zoomerbinis to their study groups!
Write a function allocstudygroupszbinis where the parameter zbinis is a list of Zoomerbinis, each represented as a typeid subjects tuple this is again of the same form as in the previous two tasks The function should compute a set of groups of zbinis such that the number of Zoomerbinis without a group is minimised. We call this an optimal grouping.
The return value must be a list of tuples of indices into the zbinis list, where each tuple corresponds to a valid group in descending score order following the same ordering rules as in Task Importantly, a Zoomerbini cannot be allocated to more than one group, that is any index in the result should appear at most once.
In the case that there are multiple optimal groupings, the grouping with the highest combined score out of these should be returned. This score is computed by summing up all the individual group scores that make up a given grouping each group should be scored using the same points system as described in Task
If there is still a tie between optimal groupings after considering combined scores, your function should preference the grouping with the smallest minimum index. For example, in the grouping the minimum index is and hence should be preferred over which has a minimum index of If more than one optimal grouping has the same minimum index, the secondtominimum index should be used to tiebreak instead or the thirdtominimum if there's a tie on both the minimum and secondtominimum indices, etc No further tiebreaking beyond this point is required.
Since this is a computationally expensive problem to solve, you may assume the length of zbinis will be at most A working version of the possiblestudygroupszbinis function has been provided to help you with this task.
Example Calls:
printallocstudygroupsFoCFoCFoCFoC
printallocstudygroupsFoCFoC 'Calc FoC 'Calc FoC 'Calc
printallocstudygroupsFoC 'Logic'Calc Calc FoC 'Logic'FoC 'Logic'FoC 'Logic'Calc
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started