AI Model for Assigning Work Orders to Teams: Use a Constraint Optimizer, Not a Team Classifier
Predicting which team handled similar work last year breaks deadlines and certification rules. OR-Tools or Dynamics 365 RSO should make the assignment, with any learned scorer kept as an optional input.
The model that should assign work orders to teams is a constraint optimizer, such as Google OR-Tools CP-SAT for employee scheduling or its vehicle routing solver for traveling crews. Dynamics 365 Field Service users already have one in Resource Scheduling Optimization (RSO). A classifier trained on past assignments can suggest a suitable team, but it cannot enforce today's skills, certifications, shifts, bookings and deadlines across all jobs at once. Use learned models to score suitability or estimate durations, and let the optimizer make the assignment.
Assignments compete for the same hours, so each job cannot be decided alone
A work order looks like a classification problem: read the description, pick a team. That works when jobs do not compete. In an office or IT help desk, each ticket can usually go to a queue on its own, and the queue handles workload.
Maintenance and field work are different. Two jobs that both "belong" to the electrical team cannot both start at 10:00 if there is only one electrical team. Giving a flexible team an easy job can leave no qualified team for an urgent specialist job later. Microsoft's description of RSO states the joint nature directly. The engine "processes a list of resources and a list of resource requirements and existing bookings." Bookings count as optimal only "if they meet all constraints and respect the importance of the listed objectives in the defined order."
That sentence contains the two parts that every work-order assignment model needs:
- Hard constraints decide whether a team is allowed to take a job at all, such as skills, certifications, shift hours, existing bookings and territory.
- Ranked objectives decide which allowed plan is best, such as finishing urgent work, avoiding late jobs, cutting travel and limiting overtime.
The right tool depends on whether jobs share capacity and whether teams travel
Three situations cover most requests for "an AI model for work orders", and they need different tools.
| Situation | What makes it hard | Sensible starting point |
|---|---|---|
| Office or IT tickets routed to queues | Reading the request and matching skills | Rules, or Dynamics 365 unified routing |
| Maintenance teams at one site | Shared hours, deadlines, certifications | OR-Tools CP-SAT scheduling model |
| Field crews driving between sites | Travel and arrival time windows | OR-Tools VRPTW, or RSO on Dynamics 365 |
For independent office and IT routing, rules are often enough. Microsoft's unified routing for Customer Service splits the work into two stages. In classification, "rules and machine learning (ML) models can be used to add information on the work item." In assignment, work is matched to skills, availability and workload. A text model helps in the first stage. The second stage stays rule-driven.
For shared-capacity maintenance at one site, the jobs interact through team hours and deadlines. This is the employee scheduling and job shop pattern in OR-Tools, solved with CP-SAT.
For traveling field crews, the order of visits matters as much as the team. Google's OR-Tools guide calls this a vehicle routing problem with time windows, where each location "can be visited only during a specific time window."
If you already run Dynamics 365 Field Service, check RSO before building anything. It covers working hours, required characteristics, roles, scheduling windows, territories and resource preferences as constraints, and it ranks objectives. Microsoft prices it per resource optimized, and it requires a Field Service licence. Microsoft also documents a Scheduling Operations Agent, but its overview labels it a preview feature that is not meant for production use.
A six-job example shows why predicting the historical assignee fails
The example below uses one site, three teams and six work orders. It is small enough to check every possible plan.
The teams have these skills and hours:
- The electrical team, T1, holds the high-voltage (HV) certification and works 08:00 to 16:00, with an existing booking from 08:00 to 10:00.
- The mechanical team, T2, covers mechanical and hydraulic work from 08:00 to 16:00, but its confined-space certificate has lapsed.
- The multi-skill team, T3, covers electrical and mechanical work on a later shift, 12:00 to 20:00, with no certifications.
Each team may work up to one hour of overtime. The work orders are:
| Work order | Needs | Hours, due, priority | Past team |
|---|---|---|---|
| WO1 Breaker trips on line 3 HV panel | Electrical, HV | 3 h, 13:00, urgent | T1 |
| WO2 Conveyor motor starter needs rewiring | Electrical | 2 h, 14:00, high | T1 |
| WO3 Hydraulic press leaking at ram seal | Hydraulics | 2 h, 12:00, urgent | T2 |
| WO4 Warehouse lighting circuit fault | Electrical | 2 h, 16:00, normal | T1 |
| WO5 Gearbox inspection on mixer 2 | Mechanical | 3 h, 18:00, normal | T2 |
| WO6 Inspect agitator inside tank 4 | Mechanical, confined space | 2 h, 15:00, high | T2 |
A classifier that learned from history would predict the "past team" column, and each prediction is reasonable on its own. The electrical jobs went to T1, and the mechanical jobs went to T2.
Taken together, the predictions produce a bad plan, even with the best order of jobs inside each team. T1 receives seven hours of new work after its booking ends at 10:00. WO2 finishes at 15:00, one hour late, and WO4 finishes at 17:00, one hour late and one hour into overtime. WO6 goes to T2, which no longer holds the certificate that the job requires. Meanwhile T3 receives no work at all.
The best plan under the ordered objectives looks like this:
- T1 does WO1 from 10:00 to 13:00, which is the only job that only T1 can do.
- T2 does WO3 from 08:00 to 10:00, then WO5 from 10:00 to 13:00.
- T3 does WO2 from 12:00 to 14:00, then WO4 from 14:00 to 16:00.
- WO6 stays explicitly unassigned, because no team holds a valid confined-space certificate today.
Nothing is late and nobody works overtime. One high-priority job goes to the dispatcher with a clear reason, instead of going to a team that is not certified to do it.
An OR-Tools CP-SAT model enforces eligibility and no-overlap as hard rules
The CP-SAT formulation follows the OR-Tools employee scheduling and job shop guides. The employee scheduling guide uses one Boolean variable per possible assignment and an add_exactly_one constraint. The job shop guide uses interval variables and add_no_overlap, which makes a machine "process one task at a time." For work orders, each team takes the place of a machine.
Three design choices matter most:
- Create a variable only for eligible team and job pairs, so an ineligible assignment cannot exist in any solution.
- Give each job one extra "unassigned" option, so the model stays solvable and reports infeasible jobs instead of failing.
- Use optional intervals for each eligible pair. The OR-Tools CP-SAT docs say that no-overlap constraints "correctly ignore inactive intervals," so only the chosen team's interval takes up time.
from ortools.sat.python import cp_model
m = cp_model.CpModel()
x, iv, end, late, unassigned = {}, {}, {}, {}, {}
for w in jobs:
options = []
for t in teams:
if not eligible(w, t): # skills, certifications, territory
continue
x[w, t] = m.new_bool_var(f"x_{w}_{t}")
lo, hi = shift[t][0], shift[t][1] + MAX_OVERTIME
s = m.new_int_var(lo, hi, "")
end[w, t] = m.new_int_var(lo, hi, "")
iv[w, t] = m.new_optional_interval_var(s, dur[w], end[w, t], x[w, t], "")
options.append(x[w, t])
unassigned[w] = m.new_bool_var(f"u_{w}")
m.add_exactly_one(options + [unassigned[w]])
late[w] = m.new_int_var(0, HORIZON, "")
for t in teams:
if (w, t) in x:
m.add(late[w] >= end[w, t] - due[w]).only_enforce_if(x[w, t])
for t in teams:
busy = [m.new_fixed_size_interval_var(a, b - a, "") for a, b in booked[t]]
m.add_no_overlap([iv[w, t] for w in jobs if (w, t) in iv] + busy)
Overtime per team is built the same way as lateness, from the end of the team's last job minus its shift end. Workload balance is the gap between the busiest and the least busy team, built with add_max_equality and add_min_equality.
CP-SAT works over integers only, and its guide says that "you must define your optimization problem using integers only." Minutes and integer priority weights meet that rule.
Ordered objectives keep cheap plans from leaving urgent work undone
The order of objectives decides which goal the plan gives up first. Microsoft's RSO documentation gives the clearest warning: minimizing travel time "can't be the first objective in the list," because to truly minimize travel, RSO "might not schedule any requirement that requires travel time." A plan with no work has no travel.
The example above uses this order:
- Leave as few urgent jobs unassigned as possible.
- Then leave as little weighted work unassigned as possible, with urgent, high and normal jobs weighted 10, 3 and 1.
- Then minimize weighted minutes of lateness.
- Then minimize travel time, which is zero at a single site.
- Then minimize overtime minutes.
- Then minimize the spread of work between the busiest and the least busy team.
The OR-Tools CP-SAT examples use a single objective and combine goals as one weighted sum. One way to get a strict order is to solve in stages. After each stage, add a constraint that holds that objective at its best value, then minimize the next one.
solver = cp_model.CpSolver()
solver.parameters.max_time_in_seconds = 10
for expr in [urgent_unassigned, weighted_unassigned, weighted_late,
overtime, spread]:
m.minimize(expr)
status = solver.solve(m)
if status not in (cp_model.OPTIMAL, cp_model.FEASIBLE):
break
m.add(expr <= round(solver.objective_value))
A status of FEASIBLE means that, in the words of the CP-SAT guide, "we don't know if it's optimal." Record the status with every published plan, so that a dispatcher can see when a time limit cut the search short.
Traveling crews need the OR-Tools routing solver with time windows and penalties
When crews drive between sites, the OR-Tools routing library fits better than a plain scheduling model. Its VRPTW guide adds a time dimension with AddDimension and sets each job's window with CumulVar(index).SetRange(start, end).
The same constraints and objectives map onto routing calls:
SetAllowedVehiclesForIndexlimits each job to eligible crews. The OR-Tools source notes that a job in a disjunction can still be left unperformed.AddDisjunctionwith a penalty makes each job optional at a cost. Google's penalties guide says that a penalty larger than the sum of all distances makes the solver drop only the visits it must.SetCumulVarSoftUpperBoundon the time dimension adds a cost for finishing after a deadline. The OR-Tools source calls it "handy to model tardiness costs."SetSpanCostCoefficientForAllVehiclesadds a cost for long working days, which acts as an overtime penalty.
The routing solver takes one combined cost, so the objective order comes from the size of the penalties. Set the penalty for an unassigned urgent job far above that of a normal job. Then set both far above the largest possible travel and lateness cost.
A learned scorer can add suitability judgments, but it should not make the assignment
Machine learning still has two useful places in this design. The first is estimating job durations from history, which feeds the dur values above. The second is scoring how well each eligible team suits a job from its free-text description, which rules handle badly.
Scoring is different from estimating durations, from optimization and from dispatch. A scorer ranks options that it is given. It receives no shift times, it does not check certifications, and it does not create bookings. The application must check constraints, run the optimizer and write the booking.
One option for the scoring step is Parsec's TOD, a decision model that ranks a fixed list of allowed options and generates no free text. Its public repo documents a call, predict(state, options, question, images), which returns one probability per supplied option, summing to 1. Parsec's TOD page names the release "TOD decision v1" with a release evaluation dated 29 September 2026, and it lists a price of $0.30 per 1,000 decisions. The release is LoRA adapters on Google's Gemma 4 12B model, so users must accept the Gemma 4 licence. The page shows TOD scoring below its untrained base model on the public JevBench test, and it says that recovering those decisions is planned for the next release. Parsec has published no evaluation of TOD on work-order assignment.
In the example, the call would pass the WO2 description as state and only the eligible teams, T1 and T3, as options. The application then uses the probabilities in a fixed way:
- Pass only eligible teams as options, so the scorer can never choose an impossible team.
- Add the scores to the optimizer as the lowest-ranked objective, so they break ties without overriding deadlines or certifications.
- Send a job to dispatcher review when the top probability falls below a threshold that you set, or when the optimizer's team differs from the top-scored team.
- Let the application write the booking, after the dispatcher accepts or the review rule passes.
A worked cost example shows that scoring fees are small next to licences and engineering
The cost assumptions are 300 work orders a day over 22 working days, which is 6,600 orders a month. Each order is scored once, and then again at up to two re-plans.
- OR-Tools is released under the Apache License 2.0, so the solver has no licence fee. You pay for the compute and for the engineering.
- RSO is priced per resource optimized, on top of a Field Service licence. Microsoft's RSO pages do not list a figure, so get a quote for your team count.
- Scoring with TOD at $0.30 per 1,000 decisions costs about $1.98 a month at one score per order. At three scores per order, 19,800 decisions cost about $5.94 a month.
On these assumptions, the scoring fee is very small. The cost that decides the project is the engineering time to model your constraints and to run the evaluation, and that has not been measured for any of these options.
The evaluation must measure operations, not prediction accuracy
No published study compares rules, an optimizer alone and an optimizer plus a learned scorer on held-out work orders. Any claim of improvement needs that comparison first.
Replay several weeks of held-out work orders, with the bookings and team availability as they stood at the time. Compare three arms:
- The current process, whether rules or human dispatch.
- The optimizer alone, with standard duration estimates.
- The optimizer plus scoring, once with a frozen scorer and once with a scorer tuned on your own past decisions.
Report these operational results for each arm, separately from any accuracy figure:
- Constraint violations, such as missing certifications, overlaps and work outside shifts.
- On-time completion rate.
- Urgent work left unassigned.
- Travel hours and overtime hours.
- Dispatcher overrides.
- Planning latency per run.
- Total cost, including licences, scoring fees and engineering time.
Report prediction accuracy and calibration of the scorer in a separate table. A scorer that matches the historical team on almost every job can still produce the late, uncertified plan shown above.
Sources
- Google OR-Tools, Employee Scheduling: https://developers.google.com/optimization/scheduling/employee_scheduling
- Google OR-Tools, Vehicle Routing Problem with Time Windows: https://developers.google.com/optimization/routing/vrptw
- Google OR-Tools, Penalties and Dropping Visits: https://developers.google.com/optimization/routing/penalties
- Google OR-Tools, Routing Options: https://developers.google.com/optimization/routing/routing_options
- Google OR-Tools, The Job Shop Problem: https://developers.google.com/optimization/scheduling/job_shop
- Google OR-Tools, CP-SAT Solver: https://developers.google.com/optimization/cp/cp_solver
- Google OR-Tools, CP-SAT scheduling docs: https://github.com/google/or-tools/blob/stable/ortools/sat/docs/scheduling.md
- Google OR-Tools, routing.h: https://github.com/google/or-tools/blob/stable/ortools/constraint_solver/routing.h
- Google OR-Tools repository and licence: https://github.com/google/or-tools
- Microsoft Learn, Optimization goals in Resource Scheduling Optimization: https://learn.microsoft.com/en-us/dynamics365/field-service/rso-optimization-goal
- Microsoft Learn, Overview of Resource Scheduling Optimization: https://learn.microsoft.com/en-us/dynamics365/field-service/rso-overview
- Microsoft Learn, Get Resource Scheduling Optimization: https://learn.microsoft.com/en-us/dynamics365/field-service/rso-get-install
- Microsoft Learn, Scheduling Operations Agent overview (preview): https://learn.microsoft.com/en-us/dynamics365/field-service/soa-overview
- Microsoft Learn, Overview of unified routing: https://learn.microsoft.com/en-us/dynamics365/customer-service/administer/overview-unified-routing
- Parsec, TOD: https://parseclab.ai/tod/
- Parsec, TOD model card: https://huggingface.co/parsecai/tod
- Parsec, TOD repository: https://github.com/daseinlabs/tod