SolverRequest for the Python CP-SAT solver service.
Constructors
new ModelBuilder(config)
config:ModelBuilderConfig<CpsatRuleRegistry,AnyCpsatRuleConfigEntry>
ModelBuilder
Properties
Shared context for cost rules. Set by minimizeCost(), read by modifiers.
options
{ diagnostics?: "none" | "hard"; solutionLimit?: number; timeLimitSeconds?: number; } | undefined
required
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, id?)
terms:object[]op:"<=" | ">=" | "=="rhs:numberid?:string
addNoOverlap(intervals)
intervals:string[]
addPenalty(varName, weight)
varName:stringweight:number
addSoftLinear(terms, op, rhs, penalty, id?, stage?)
terms:object[]op:"<=" | ">="rhs:numberpenalty:numberid?:stringstage?:string
assignment(memberId, patternId, day)
Returns the aggregate shift assignment variable for a member, pattern, and day.
memberId:stringpatternId:stringday:SchedulingDay
string
boolVar(name)
name:string
string
calculateCost(assignments)
assignments: readonlyShiftAssignment[]
canAssign(member, pattern)
member:SchedulingMemberpattern:ShiftPattern
boolean
compile()
Returns: CompilationResult
endMinutes(pattern, day)
pattern:ShiftPatternday:SchedulingDay
number
getCompiledInstructions()
Returns model-backed coverage and rule instructions in explanation order.
Returns: readonly CompiledModelInstruction[]
getConstraintTraces()
Returns: readonly ConstraintTrace[]
getInstructionResults()
Returns: ReadonlyMap<string, readonly InstructionResult[]>
intervalVar(name, start, end, size, presenceVar?)
name:stringstart:numberend:numbersize:numberpresenceVar?:string
string
intVar(name, min, max)
name:stringmin:numbermax:number
string
membersForCoverage(cov)
Returns team members who can satisfy a coverage requirement.
Matching logic:
- If only roles: must have ANY of those roles (OR)
- If only skills: must have ALL specified skills (AND)
- If both: must have a matching role AND ALL specified skills
-
cov:CoverageRequirement
membersWithRole(roleId)
roleId:string
patternAvailableOnDay(pattern, day)
Checks if a shift pattern can be used on a specific day.
Returns false if the pattern has dayOfWeek restrictions that exclude this day.
pattern:ShiftPatternday:SchedulingDay
boolean
patternDuration(patternId)
patternId:string
number
shiftActive(patternId, day)
patternId:stringday:SchedulingDay
string
startMinutes(pattern, day)
pattern:ShiftPatternday:SchedulingDay
number