SolverRequest for the Python CP-SAT solver service.
Constructors
new ModelBuilder(config)
config:ModelBuilderConfig
ModelBuilder
Properties
Methods
addAtMostOne(vars)
vars:string[]
addBoolAnd(vars)
vars:string[]
addBoolOr(vars)
vars:string[]
addExactlyOne(vars)
vars:string[]
addImplication(ifVar, thenVar)
ifVar:stringthenVar:string
addLinear(terms, op, rhs)
terms:object[]op:"<=" | ">=" | "=="rhs:number
addNoOverlap(intervals)
intervals:string[]
addPenalty(varName, weight)
varName:stringweight:number
addSoftLinear(terms, op, rhs, penalty, id?)
terms:object[]op:"<=" | ">="rhs:numberpenalty:numberid?:string
assignment(employeeId, patternId, day)
employeeId:stringpatternId:stringday:string
string
boolVar(name)
name:string
string
canAssign(employee, pattern)
employee:SchedulingEmployeepattern:ShiftPattern
boolean
compile()
Returns: CompilationResult
employeesForCoverage(cov)
Returns team members who can satisfy a coverage requirement.
Matching logic:
- If only roleId: must have that role
- If only skillIds: must have ALL specified skills
- If both: must have the role AND ALL specified skills
-
cov:CoverageRequirement
employeesWithRole(roleId)
roleId:string
endMinutes(pattern, day)
pattern:ShiftPatternday:string
number
intervalVar(name, start, end, size, presenceVar?)
name:stringstart:numberend:numbersize:numberpresenceVar?:string
string
intVar(name, min, max)
name:stringmin:numbermax:number
string
patternAvailableOnDay(pattern, day)
Checks if a shift pattern can be used on a specific day.
Returns false if the pattern has daysOfWeek restrictions that exclude this day.
pattern:ShiftPatternday:string
boolean
patternDuration(patternId)
patternId:string
number
shiftActive(patternId, day)
patternId:stringday:string
string
startMinutes(pattern, day)
pattern:ShiftPatternday:string
number
validateSolution(assignments)
Run post-solve validation on all rules.
Call this after solving with the resolved assignments.
assignments:ResolvedShiftAssignment[]