Monday, April 14, 2014

Personal Reflection #5

I did it...

I came up with an algorithm for the program I am making for my job. The program, among other things, can create a random work schedule (there are various duties that need to be done throughout the day so we want to have everyone have a good variety) based on a number of parameters it can be given. My earlier algorthim had two flaws:

1. The program took too long to run, 1+ min
2. The hours were unevenly distributed between workers

The first algorithm basically just randomly assigned people to the job if they were free and if the schedule didn't work out (i.e. not all jobs filled) it started over.

While I was in Computer Science 227 lecture, I had a creative spark after hearing an example from my professor. We were discussing finding an element in a large array of values. He said if you were looking in a phone book, you wouldn't look on every page to find the number of the person you wanted. You narrow the search down based off of last name.

This is essentially what my new algorithm does. It keeps track of all of the employees in order based on hours. So, the program will first seek to assign jobs to those who are working the least amount of hours. With these new changes, my program only takes around 5 sec to run and has a much more even hour distribution.

2 comments:

  1. That seems like a pretty great idea even though I don't know a thing about computer programming. This seems to be what computer programming is all about though. Making things more efficient and quick! Side note, where do you work at?

    ReplyDelete
  2. I am a Cyclone Aide Advisor so I help out with ISU's Summer and Transfer Orientation programs

    ReplyDelete