Dir Sir:
How should I deal with this situation?
If a teacher only have 2 activities in a day, they wish these 2 activities all taught in AM or PM.
Looking forward to your wisdom suggestion.
There are different solutions:
It's depending on your dataset:
variant 1:
at my school there are only a very few activities at PM. So i choose the PM activities myself and place them myself and/or i allow only activities with duration 2 at PM.
variant 2:
maybe it is enough if you try to add a teacher max gaps constraint, so of course he can still have just a single hour at PM, but since the AM hours are late there won't be a too big gap.
variant 3: (This is what you asked for)
you need to use a custom fet version. Use "Maroccan" or the "Algerian" custom version. Check carefully the description since i guess only one of that versions will be fine for your school.
Both versions split the days into 2 parts (AM and PM), so you only need to add a min 2 hours per day constraint.
see:
https://lalescu.ro/liviu/fet/forum/index.php?topic=487.0
and
https://lalescu.ro/liviu/fet/forum/index.php?topic=485.0