Schedule Creation

So, someone recently asked me to make a schedule for them, and I agreed. When I sat down to do this, I realized that it was harder than I thought. This is just a schedule that allows you to move up to 4 people a day or night.

I thought of something like this:

for Monday to Saturday {
  for(i=0;i<people.length;i++){
    if (person[i].available()){
      person.worksDay()
      person is now not available.
    }
  }

  for(i=0;i<people.length;i++){
    if (person[i].available()){
      person[i].worksNight()
      person[i] is now not available.
    }
  }
}

Thus, the idea of ​​this algorithm is that for each day a person is assigned a day or night shift. A person is available if they DID NOT SELL work shift, and they are not on vacation. It is from Monday to Saturday. As you can probably say, given that people A, B, C, D will look like this (if no one is on holidays):

Mon A B
Tue C D
Wed A B
Th  C D
Fri A B
Sat C D

, , . , , . , , ? , ?

+3
3

, , :

  • .
  • ( )
  • , - .
  • .
  • , .

    GA

+2

.

, Drools Planner, Choco, JGap, cpsolver,... . ( Drools Planner) .

+1

The problems of programming constraints are complex and difficult to program as a whole. Although your problem is quite simple, you can download a tool for this. Gnu's linear software suite is probably the best option; it has a solver and a modeling language that you can use. I wrote a very long post about planning once .

0
source

Source: https://habr.com/ru/post/1770130/


All Articles