Icon

Equally distribute work package minutes amongst employees

https://forum.knime.com/t/divide-rows-into-7-even-groups-based-on-sum-of-values-in-a-column/19189 We've got to:1. accept that perfect equal distribution ispure coincidence2. distribute large work packages prior tosmaller because if all small would beendistributed first, the bigger ones wouldcause larger differences IMPORTANTMultiple employees mighthave the same currentmax. of work packageminutes assigned already! Pre-assigning 1st workpackage eliminatesfallback in loop! Approach taken1. Add work package minutes if sum doesnot exceed of already max. assigned2. Remove assigned from list workpackages3. If sum of both, min. remainingassignable minutes in work package listand min. already assigned minutes,exceeds max. assigned minutes. Enforceaddition to prevent infinite loop.4. Ensure certain randomness in employeeand work package table and by invertconcatenation If sum of min. assignaed and assignable minutesexceeds the alrady assigned max. then enforde addition.Otherwise infinite loop! Work packagesAdd workpackage nameEmployeesReademployeestableReadwork packagestableLoop untilsum ofwork packages minutesis as close to max.assigned work pages min.Work packagewith max. minutesUpdate assignedwork package minutesGet max. distributedwork package minutesTOPAll employeesbased on max. minutesSort descby assignedwork minutesTOPGet 1stwork packageWork packagewith max. minutesUpdate assignedwork package nameBOTTOMnext one employeeConcat UpdateemployeetableUpdatework packagestableReverse concatso emploees sothose w/o least recentassigned work packgesget some assigned nextInvert concatto start next iterationwith next work packageif sum of minutesexceed max sumalready assignedGet min. distributablework package minutesSum ofboth min assingedand assignable work package minutesSetEnforce additionReademployeestableTable Creator Table Writer Create Temp Dir String Manipulation Table Creator Table Writer Table Reader Table Reader Generic Loop Start Merge Variables Variable ConditionLoop End Table Rowto Variable ConstantValue Column GroupBy Table Rowto Variable Row Splitter Sorter Row Splitter Table Rowto Variable Assign firstwork package Table Rowto Variable Java EditVariable (simple) Rule EngineVariable String Manipulation(Variable) Rule EngineVariable ConstantValue Column Row Splitter Concatenate Table Writer Table Writer Concatenate Rule EngineVariable Row Filter Extract TableDimension Row Splitter Concatenate GroupBy Table Rowto Variable Math Formula(Variable) Rule EngineVariable Table Reader https://forum.knime.com/t/divide-rows-into-7-even-groups-based-on-sum-of-values-in-a-column/19189 We've got to:1. accept that perfect equal distribution ispure coincidence2. distribute large work packages prior tosmaller because if all small would beendistributed first, the bigger ones wouldcause larger differences IMPORTANTMultiple employees mighthave the same currentmax. of work packageminutes assigned already! Pre-assigning 1st workpackage eliminatesfallback in loop! Approach taken1. Add work package minutes if sum doesnot exceed of already max. assigned2. Remove assigned from list workpackages3. If sum of both, min. remainingassignable minutes in work package listand min. already assigned minutes,exceeds max. assigned minutes. Enforceaddition to prevent infinite loop.4. Ensure certain randomness in employeeand work package table and by invertconcatenation If sum of min. assignaed and assignable minutesexceeds the alrady assigned max. then enforde addition.Otherwise infinite loop! Work packagesAdd workpackage nameEmployeesReademployeestableReadwork packagestableLoop untilsum ofwork packages minutesis as close to max.assigned work pages min.Work packagewith max. minutesUpdate assignedwork package minutesGet max. distributedwork package minutesTOPAll employeesbased on max. minutesSort descby assignedwork minutesTOPGet 1stwork packageWork packagewith max. minutesUpdate assignedwork package nameBOTTOMnext one employeeConcat UpdateemployeetableUpdatework packagestableReverse concatso emploees sothose w/o least recentassigned work packgesget some assigned nextInvert concatto start next iterationwith next work packageif sum of minutesexceed max sumalready assignedGet min. distributablework package minutesSum ofboth min assingedand assignable work package minutesSetEnforce additionReademployeestableTable Creator Table Writer Create Temp Dir String Manipulation Table Creator Table Writer Table Reader Table Reader Generic Loop Start Merge Variables Variable ConditionLoop End Table Rowto Variable ConstantValue Column GroupBy Table Rowto Variable Row Splitter Sorter Row Splitter Table Rowto Variable Assign firstwork package Table Rowto Variable Java EditVariable (simple) Rule EngineVariable String Manipulation(Variable) Rule EngineVariable ConstantValue Column Row Splitter Concatenate Table Writer Table Writer Concatenate Rule EngineVariable Row Filter Extract TableDimension Row Splitter Concatenate GroupBy Table Rowto Variable Math Formula(Variable) Rule EngineVariable Table Reader

Nodes

Extensions

Links