Newbie - help creating a restriction

Started by mcdeluna, April 03, 2014, 12:33:18 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mcdeluna

Hi everyone!  I'm new to this forum, and I'm not familiar with programming.  I'm an assistant at a Brazilian college, and we have classes in three shifts - mornings (07:40-1:00pm), afternoons (1:10pm-6:30pm), and evenings, (7pm to 10:30pm).  Due to Brazilian labor laws, I need to have three restrictions for teachers, and I´ve only been able to solve two of them.
1 - Teachers can teach up to 08 hours/day - solved
2 - Teachers can teach up to 06 consecutive hours, then need at least a 1h gap. - solved
3 - Teachers need to have at least 11 hours between each work shift (if he teaches classes till 10:30 pm he can only begin again after 9:30am).  Is it possible to create this restriction?  I haven't been able to figure it out yet...  Thank you in advance!

Liviu Lalescu

I have an idea, let's discuss about it:

If you need to restrict that from these two slots: last slot in day n and first slot in day (n+1), the teacher needs to work in maximum one slot, you can use the constraint activities occupy max 1 time slot from selection of these two. And add (n_days_per_week-1) constraints of this type.

In your case, it is more complicated, because you have more slots involved. But maybe the above is a good starting point and let's talk about it.

Volker Dirr

if it doesn't work with 2 slots (because it can still break the rule; I am not sure, because i don't know how long a "hour" is in your dataset):
maybe do it with 3 or 4 slots:
So for example select the last and the slot before the last slot. Ans select the first and second slot of the following day.
In "worst" case this will be a bit much more constraint then you need, but it will care about your rule (and is hopefully still solveable)