I want to constrain the combination of “competence” and “shift type.” Specifically, I have the following.
First, some combinations are not troubling. New Doctor C, “on duty,” and Doctor A, “second,” are yes.
New Doctor D “on duty” and Doctor A “second” is also possible.

The opposite combination is a bit problematic and should be avoided.
Specifically, combining Doctor A, “on duty,” and the new Doctor C, “second,” is not a good idea.
However, Doctor B, “on duty,” and the new Doctor C, “second,” is a good idea because the competence of Doctor B is much greater than the competence of Doctor A.

We recommend modeling competence in terms of years of experience.
Expressly, for example, prohibit all combinations where the sum of years of experience is less than six years.
If mathematical operations are required, we must write them in Python.
However, if there are not so many combinations of sums of years of experience, we can use modeling by group sets.

Below is an example implementation. Define years of experience on the staff property sheet.



Constrain them with pair constraints.



Define the required sets by group sets.