SoftSeqComp is an extension of SeqComp to soft constraints, always used in combination with sc3.AddSoft.

import sc3

for person in A_Member_in_All:
    list1=[]
    list2=[]
    for day in ThisMonth:
        v1=sc3.GetShiftVar(person,day,"After_Night_Shift")
        v2=sc3.GetShiftVar(person,day,"Night_Shift")
        list1.append(v1)
        list2.append(v2)
    st="SeqSoftComp " +staffdef[person]
    sc3.AddSoft(sc3.SoftSeqComp(0,8,list2,list1),st,5)

sc3.SoftSeqComp(offset,allowable_errors,List1,List2)

Two parameters have been added: offset and allowable_errors.
allowable_errors is the same as that of SeqError and sets a hard boundary.

A hard error occurs if |A-B|> allowable_errors is set, regardless of the offset.
Acts as a limiter, not linear. This is used when up to this level is acceptable, but greater than this is impossible and absolutely not allowed.
<br When offset is 0, the cost for |A-B| is centered around A==B (0 for A==B) and occurs as shown in the table below.



In contrast, when offset>0, when A<=B+offset is satisfied, no cost is incurred and it is 0.
Note that offset==0 acts on both sides, whereas offset>=1 acts on only one side.
In a constraint system, A and B can be anywhere if there is no cost incurred.



A sample with offset==0 is soft_seq_comp0. In the range |A-B|<=8, you can see that soft costs occur on both sides.



The sample with offset==1 is soft_seq_comp1. Soft cost is incurred on one side only.

Note that as long as A<=B+1 is satisfied, no cost is incurred for any combination of A/B.

import sc3

for person in A_Member_in_All:
    list1=[]
    list2=[]
    for day in ThisMonth:
        v1=sc3.GetShiftVar(person,day,"After_Night_Shift")
        v2=sc3.GetShiftVar(person,day,"Night_Shift")
        list1.append(v1)
        list2.append(v2)
    st="SeqSoftComp " +staffdef[person]
    sc3.AddSoft(sc3.SoftSeqComp(1,8,list2,list1),st,5)