Re: Even Distribution
Bob belabored, > BAs I said, all else being equal, roughly same work required, localized > territory, no chance of a job being rescheduled, etc. Use a Round Robin > approach. For that matter, if it is an ongoing situation, where this is simply a daily load of randomly sized tasks, round robin works in the long and even intermediate term. So would random assignment, but it would have more short term spikes. Or a modified round robin, with assignment to either the next available, or to the next driver with only one item in his queue ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Even Distribution
Awesome. thank you! On Fri, Apr 17, 2020 at 1:15 PM Alex Tweedly via use-livecode < use-livecode@lists.runrev.com> wrote: > Or to do the full distribution ... > > put Njobs div Ndrivers into tMin > put NJobs mod Ndrivers into tExtras > > repeat with i = 1 to NDrivers > if i <= tExtras then >allocate tMin+1 >else > allocate tMin >end if > end repeat > > However, say your drivers are sorted alphabetically, then before long > Andy will realise that he is being allocated more jobs that Zebedee. You > could (sometimes) reverse the order of drivers - but then Mary loses out > on jobs compared to both Andy and Zebedee. Or you could randomize the > order of the drivers - but maybe they're also pre-sorted by location. > > Instead, you want to even out the spread of extras across the drivers - > so you need something like > > repeat with i = 1 to Ndrivers > if tExtras > (Ndrivers-i)/2 then >allocate tMin+1 >subtract 1 from tExtras >else > allocate tMin >end if > end repeat > > (which still has a slight bias towards giving jobs to Zebedee - but it's > so slight it will take probably take him years to notice :-) > > Alex. > > On 17/04/2020 05:28, Jerry Jensen via use-livecode wrote: > > Hi Skip, > > Forgive me if this is not the answer you seek, or an oversimplification, > but there is an easy way to find if the jobs can be exactly evenly > distributed, with nothing left over: > > if (tjobs mod tdrivers) = 0 then // it is evenly distrutable. > > .Jerry > > > >> On Apr 16, 2020, at 7:41 PM, Skip Kimpel via use-livecode < > use-livecode@lists.runrev.com> wrote: > >> > >> I have working on creating a loop that would divide the number of jobs > by > >> the number of users and then checking to see to see if it is evenly > >> divisible but that is kind of where I am stuck. Everything I have tried > >> thus far has proven to be unsuccessful. > > > > ___ > > use-livecode mailing list > > use-livecode@lists.runrev.com > > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > > http://lists.runrev.com/mailman/listinfo/use-livecode > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Even Distribution
Or to do the full distribution ... put Njobs div Ndrivers into tMin put NJobs mod Ndrivers into tExtras repeat with i = 1 to NDrivers if i <= tExtras then allocate tMin+1 else allocate tMin end if end repeat However, say your drivers are sorted alphabetically, then before long Andy will realise that he is being allocated more jobs that Zebedee. You could (sometimes) reverse the order of drivers - but then Mary loses out on jobs compared to both Andy and Zebedee. Or you could randomize the order of the drivers - but maybe they're also pre-sorted by location. Instead, you want to even out the spread of extras across the drivers - so you need something like repeat with i = 1 to Ndrivers if tExtras > (Ndrivers-i)/2 then allocate tMin+1 subtract 1 from tExtras else allocate tMin end if end repeat (which still has a slight bias towards giving jobs to Zebedee - but it's so slight it will take probably take him years to notice :-) Alex. On 17/04/2020 05:28, Jerry Jensen via use-livecode wrote: Hi Skip, Forgive me if this is not the answer you seek, or an oversimplification, but there is an easy way to find if the jobs can be exactly evenly distributed, with nothing left over: if (tjobs mod tdrivers) = 0 then // it is evenly distrutable. .Jerry On Apr 16, 2020, at 7:41 PM, Skip Kimpel via use-livecode wrote: I have working on creating a loop that would divide the number of jobs by the number of users and then checking to see to see if it is evenly divisible but that is kind of where I am stuck. Everything I have tried thus far has proven to be unsuccessful. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Even Distribution
As I said, all else being equal, roughly same work required, localized territory, no chance of a job being rescheduled, etc. Use a Round Robin approach. Start with first worker, store as next worker, assign first job, update next worker. On to job 2 and so forth until no more jobs. Next day start with the next worker, rinse and repeat. Bob S > On Apr 16, 2020, at 7:41 PM, Skip Kimpel via use-livecode > wrote: > > I have working on creating a loop that would divide the number of jobs by > the number of users and then checking to see to see if it is evenly > divisible but that is kind of where I am stuck. Everything I have tried > thus far has proven to be unsuccessful. > > SKIP > > On Thu, Apr 16, 2020 at 10:36 PM Skip Kimpel wrote: > >> Dev, I have already sorted the jobs out by proximity so I don't need to >> worry about that. Just need the distribution piece down. I agree, you >> have a good point an might prove valuable in the future. >> >> SKIP >> >> On Thu, Apr 16, 2020 at 10:33 PM Skip Kimpel wrote: >> >>> Haha... Let me specify, I am looking to do this programmatically :) >>> >>> SKIP >>> >>> On Thu, Apr 16, 2020 at 10:31 PM Dev via use-livecode < >>> use-livecode@lists.runrev.com> wrote: >>> Since you would probably have long trips and short trips, I would try and allocate on an estimated time to complete basis so that all were busy for about the same time. > On 16-Apr-2020, at 8:23 PM, Skip Kimpel via use-livecode < use-livecode@lists.runrev.com> wrote: > > I have 15 "jobs" that need to be assigned to 7 "drivers". How would you > evenly distribute the jobs to the drivers? In this case one of the drivers > would have 3 jobs while the others have two. > > Obviously, the number of drivers and number of jobs would fluctuate. > > This has been my mind twister for the night thus far :) > > SKIP > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode >>> > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Even Distribution
Wait, what? You didn’t mention that! Okay we do service for copiers in the greater LA area. We assign territories for every technician and every customer. Also, the nearest technician to any zone may be called upon to service another technician’s copiers if the assigned technician is unavailable. If we hire a new technician, the zones are adjusted. Every so often we review the location of active devices and may rezone for that as well. This is not a math problem, it is a logistics one. This does not in and of itself evenly distribute jobs, but if the zoning is properly done, over time the distribution is fairly even. Other factors may need to be taken into account, like frequency of job orders in certain areas (people at the beach may want their cars washed twice a week instead of once). Bob S > On Apr 16, 2020, at 7:36 PM, Skip Kimpel via use-livecode > wrote: > > Dev, I have already sorted the jobs out by proximity so I don't need to > worry about that. Just need the distribution piece down. I agree, you > have a good point an might prove valuable in the future. > > SKIP ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Even Distribution
That wasn’t part of the initial problem. :-) Bob S > On Apr 16, 2020, at 7:30 PM, Dev via use-livecode > wrote: > > Since you would probably have long trips and short trips, I would try and > allocate on an estimated time to complete basis so that all were busy for > about the same time. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Even Distribution
Assign the jobs round robin if all other things are equal. Bob S > On Apr 16, 2020, at 7:23 PM, Skip Kimpel via use-livecode > wrote: > > I have 15 "jobs" that need to be assigned to 7 "drivers". How would you > evenly distribute the jobs to the drivers? In this case one of the drivers > would have 3 jobs while the others have two. > > Obviously, the number of drivers and number of jobs would fluctuate. > > This has been my mind twister for the night thus far :) > > SKIP ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Even Distribution
Jerry, You did not over simplify at all! I used your basic concept and tweaked it and then applied it to my nested repeats and BAM... got it. Thanks again, everybody! SKIP On Fri, Apr 17, 2020 at 12:28 AM Jerry Jensen wrote: > Hi Skip, > Forgive me if this is not the answer you seek, or an oversimplification, > but there is an easy way to find if the jobs can be exactly evenly > distributed, with nothing left over: > if (tjobs mod tdrivers) = 0 then // it is evenly distrutable. > .Jerry > > > On Apr 16, 2020, at 7:41 PM, Skip Kimpel via use-livecode < > use-livecode@lists.runrev.com> wrote: > > > > I have working on creating a loop that would divide the number of jobs by > > the number of users and then checking to see to see if it is evenly > > divisible but that is kind of where I am stuck. Everything I have tried > > thus far has proven to be unsuccessful. > > ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Even Distribution
Hi Skip, Forgive me if this is not the answer you seek, or an oversimplification, but there is an easy way to find if the jobs can be exactly evenly distributed, with nothing left over: if (tjobs mod tdrivers) = 0 then // it is evenly distrutable. .Jerry > On Apr 16, 2020, at 7:41 PM, Skip Kimpel via use-livecode > wrote: > > I have working on creating a loop that would divide the number of jobs by > the number of users and then checking to see to see if it is evenly > divisible but that is kind of where I am stuck. Everything I have tried > thus far has proven to be unsuccessful. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Even Distribution
Maybe I’m misunderstanding but if you just want to divide the jobs you could have a counter for the current driver and after assigning a job you increase the counter and wrap it when you exceed the number of drivers. If you’re looking for a more fancy job division algorithm you should take a look at the classical traveling salesman problem but with multiple drivers. And even with one driver this is a tricky solution. If you are building an app that really needs a good solution for the vehicle routing problem you can maybe wrap the optaplanner Java library. (optaplanner.org) Good luck! Håkan On 17 Apr 2020, 04:42 +0200, Skip Kimpel via use-livecode , wrote: > I have working on creating a loop that would divide the number of jobs by > the number of users and then checking to see to see if it is evenly > divisible but that is kind of where I am stuck. Everything I have tried > thus far has proven to be unsuccessful. > > SKIP > > On Thu, Apr 16, 2020 at 10:36 PM Skip Kimpel wrote: > > > Dev, I have already sorted the jobs out by proximity so I don't need to > > worry about that. Just need the distribution piece down. I agree, you > > have a good point an might prove valuable in the future. > > > > SKIP > > > > On Thu, Apr 16, 2020 at 10:33 PM Skip Kimpel wrote: > > > > > Haha... Let me specify, I am looking to do this programmatically :) > > > > > > SKIP > > > > > > On Thu, Apr 16, 2020 at 10:31 PM Dev via use-livecode < > > > use-livecode@lists.runrev.com> wrote: > > > > > > > Since you would probably have long trips and short trips, I would try > > > > and allocate on an estimated time to complete basis so that all were > > > > busy > > > > for about the same time. > > > > > > > > > On 16-Apr-2020, at 8:23 PM, Skip Kimpel via use-livecode < > > > > use-livecode@lists.runrev.com> wrote: > > > > > > > > > > I have 15 "jobs" that need to be assigned to 7 "drivers". How would > > > > > you > > > > > evenly distribute the jobs to the drivers? In this case one of the > > > > drivers > > > > > would have 3 jobs while the others have two. > > > > > > > > > > Obviously, the number of drivers and number of jobs would fluctuate. > > > > > > > > > > This has been my mind twister for the night thus far :) > > > > > > > > > > SKIP > > > > > ___ > > > > > use-livecode mailing list > > > > > use-livecode@lists.runrev.com > > > > > Please visit this url to subscribe, unsubscribe and manage your > > > > subscription preferences: > > > > > http://lists.runrev.com/mailman/listinfo/use-livecode > > > > > > > > > > > > > > > > > ___ > > > > use-livecode mailing list > > > > use-livecode@lists.runrev.com > > > > Please visit this url to subscribe, unsubscribe and manage your > > > > subscription preferences: > > > > http://lists.runrev.com/mailman/listinfo/use-livecode > > > > > > > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Even Distribution
I have working on creating a loop that would divide the number of jobs by the number of users and then checking to see to see if it is evenly divisible but that is kind of where I am stuck. Everything I have tried thus far has proven to be unsuccessful. SKIP On Thu, Apr 16, 2020 at 10:36 PM Skip Kimpel wrote: > Dev, I have already sorted the jobs out by proximity so I don't need to > worry about that. Just need the distribution piece down. I agree, you > have a good point an might prove valuable in the future. > > SKIP > > On Thu, Apr 16, 2020 at 10:33 PM Skip Kimpel wrote: > >> Haha... Let me specify, I am looking to do this programmatically :) >> >> SKIP >> >> On Thu, Apr 16, 2020 at 10:31 PM Dev via use-livecode < >> use-livecode@lists.runrev.com> wrote: >> >>> Since you would probably have long trips and short trips, I would try >>> and allocate on an estimated time to complete basis so that all were busy >>> for about the same time. >>> >>> > On 16-Apr-2020, at 8:23 PM, Skip Kimpel via use-livecode < >>> use-livecode@lists.runrev.com> wrote: >>> > >>> > I have 15 "jobs" that need to be assigned to 7 "drivers". How would you >>> > evenly distribute the jobs to the drivers? In this case one of the >>> drivers >>> > would have 3 jobs while the others have two. >>> > >>> > Obviously, the number of drivers and number of jobs would fluctuate. >>> > >>> > This has been my mind twister for the night thus far :) >>> > >>> > SKIP >>> > ___ >>> > use-livecode mailing list >>> > use-livecode@lists.runrev.com >>> > Please visit this url to subscribe, unsubscribe and manage your >>> subscription preferences: >>> > http://lists.runrev.com/mailman/listinfo/use-livecode >>> > >>> >>> >>> ___ >>> use-livecode mailing list >>> use-livecode@lists.runrev.com >>> Please visit this url to subscribe, unsubscribe and manage your >>> subscription preferences: >>> http://lists.runrev.com/mailman/listinfo/use-livecode >>> >> ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Even Distribution
It was already mentioned somewhat, but you need some sort of weight metric for each job. Save the “smallest” job. For each driver, assign the largest and smallest job remaining. When done, add the weight for each driver and give the remaining job to the one with the least work. Thanks, Brian On Apr 16, 2020, 10:34 PM -0400, Skip Kimpel via use-livecode , wrote: > Haha... Let me specify, I am looking to do this programmatically :) > > SKIP > > On Thu, Apr 16, 2020 at 10:31 PM Dev via use-livecode < > use-livecode@lists.runrev.com> wrote: > > > Since you would probably have long trips and short trips, I would try and > > allocate on an estimated time to complete basis so that all were busy for > > about the same time. > > > > > On 16-Apr-2020, at 8:23 PM, Skip Kimpel via use-livecode < > > use-livecode@lists.runrev.com> wrote: > > > > > > I have 15 "jobs" that need to be assigned to 7 "drivers". How would you > > > evenly distribute the jobs to the drivers? In this case one of the > > drivers > > > would have 3 jobs while the others have two. > > > > > > Obviously, the number of drivers and number of jobs would fluctuate. > > > > > > This has been my mind twister for the night thus far :) > > > > > > SKIP > > > ___ > > > use-livecode mailing list > > > use-livecode@lists.runrev.com > > > Please visit this url to subscribe, unsubscribe and manage your > > subscription preferences: > > > http://lists.runrev.com/mailman/listinfo/use-livecode > > > > > > > > > ___ > > use-livecode mailing list > > use-livecode@lists.runrev.com > > Please visit this url to subscribe, unsubscribe and manage your > > subscription preferences: > > http://lists.runrev.com/mailman/listinfo/use-livecode > > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Even Distribution
Dev, I have already sorted the jobs out by proximity so I don't need to worry about that. Just need the distribution piece down. I agree, you have a good point an might prove valuable in the future. SKIP On Thu, Apr 16, 2020 at 10:33 PM Skip Kimpel wrote: > Haha... Let me specify, I am looking to do this programmatically :) > > SKIP > > On Thu, Apr 16, 2020 at 10:31 PM Dev via use-livecode < > use-livecode@lists.runrev.com> wrote: > >> Since you would probably have long trips and short trips, I would try and >> allocate on an estimated time to complete basis so that all were busy for >> about the same time. >> >> > On 16-Apr-2020, at 8:23 PM, Skip Kimpel via use-livecode < >> use-livecode@lists.runrev.com> wrote: >> > >> > I have 15 "jobs" that need to be assigned to 7 "drivers". How would you >> > evenly distribute the jobs to the drivers? In this case one of the >> drivers >> > would have 3 jobs while the others have two. >> > >> > Obviously, the number of drivers and number of jobs would fluctuate. >> > >> > This has been my mind twister for the night thus far :) >> > >> > SKIP >> > ___ >> > use-livecode mailing list >> > use-livecode@lists.runrev.com >> > Please visit this url to subscribe, unsubscribe and manage your >> subscription preferences: >> > http://lists.runrev.com/mailman/listinfo/use-livecode >> > >> >> >> ___ >> use-livecode mailing list >> use-livecode@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your >> subscription preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode >> > ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Even Distribution
Haha... Let me specify, I am looking to do this programmatically :) SKIP On Thu, Apr 16, 2020 at 10:31 PM Dev via use-livecode < use-livecode@lists.runrev.com> wrote: > Since you would probably have long trips and short trips, I would try and > allocate on an estimated time to complete basis so that all were busy for > about the same time. > > > On 16-Apr-2020, at 8:23 PM, Skip Kimpel via use-livecode < > use-livecode@lists.runrev.com> wrote: > > > > I have 15 "jobs" that need to be assigned to 7 "drivers". How would you > > evenly distribute the jobs to the drivers? In this case one of the > drivers > > would have 3 jobs while the others have two. > > > > Obviously, the number of drivers and number of jobs would fluctuate. > > > > This has been my mind twister for the night thus far :) > > > > SKIP > > ___ > > use-livecode mailing list > > use-livecode@lists.runrev.com > > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > > http://lists.runrev.com/mailman/listinfo/use-livecode > > > > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Even Distribution
Since you would probably have long trips and short trips, I would try and allocate on an estimated time to complete basis so that all were busy for about the same time. > On 16-Apr-2020, at 8:23 PM, Skip Kimpel via use-livecode > wrote: > > I have 15 "jobs" that need to be assigned to 7 "drivers". How would you > evenly distribute the jobs to the drivers? In this case one of the drivers > would have 3 jobs while the others have two. > > Obviously, the number of drivers and number of jobs would fluctuate. > > This has been my mind twister for the night thus far :) > > SKIP > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Even Distribution
On Apr 16, 2020, at 7:23 PM, Skip Kimpel via use-livecode wrote: > > I have 15 "jobs" that need to be assigned to 7 "drivers". How would you > evenly distribute the jobs to the drivers? Fire two drivers. :_) If they complain, fire two more, and it’s still easy . . . ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Even Distribution
I have 15 "jobs" that need to be assigned to 7 "drivers". How would you evenly distribute the jobs to the drivers? In this case one of the drivers would have 3 jobs while the others have two. Obviously, the number of drivers and number of jobs would fluctuate. This has been my mind twister for the night thus far :) SKIP ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode