FET Forum

FET Support (English) => Get Help => Topic started by: mcdeluna on April 03, 2014, 12:33:18 AM

Title: Newbie - help creating a restriction
Post by: mcdeluna on April 03, 2014, 12:33:18 AM
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!
Title: Re: Newbie - help creating a restriction
Post by: Liviu Lalescu on April 03, 2014, 06:01:28 AM
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.
Title: Re: Newbie - help creating a restriction
Post by: Volker Dirr on April 03, 2014, 01:33:33 PM
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)