5090

No Regrets Dispatch

Algorithm
Hard
Pro
matching
scheduling
optimization

No Regrets Dispatch

Every morning the dispatch board pairs the day's service orders with the available technicians. Both sides have opinions: each order ranks the technicians (skills, distance, customer history), and each technician ranks the orders. Whenever the board publishes a pairing in which some order and some technician would both rather have each other than the partners they got, the planner's phone rings and the whole board gets reshuffled by hand. Your job is to compute an assignment nobody can complain about — no regrets.

Requirements

The starter contains two tables — keep their fields and keys exactly as shipped; the grading tests seed them and read them back:

"Dispatch Preference" — the ranking lists of both sides:

  • Side — Option with members ServiceOrder,Technician: whose ranking list this row belongs to
  • "Agent No." — Code[20], the service order no. (when Side is ServiceOrder) or technician no. (when Side is Technician) doing the ranking
  • Rank — Integer, the position in that agent's list; 1 is the most preferred
  • "Counterpart No." — Code[20], the agent on the other side being ranked
  • primary key: Side, "Agent No.", Rank

"Service Assignment" — the result buffer:

  • "Order No." — Code[20], the primary key
  • "Technician No." — Code[20]

Create a codeunit named "Service Dispatcher" with one public procedure:

procedure Dispatch(var DispatchPreference: Record "Dispatch Preference"; var ServiceAssignment: Record "Service Assignment")
The rest of the statement and 3 hints Unlock with Pro
ALBusiness Central 28.5
Pro
Pro problem

Solve it with Pro

You’re reading the opening of the statement. Pro unlocks the whole problem:

  • The full statement
  • Starter code in the browser editor
  • 7 grading tests, run on Business Central 28.5
  • 3 hints
  • The reference solution

Pro also opens all 92 Pro problems and lifts the daily limits on compile checks and submissions.

$10 / month
or $100 / year
Upgrade
This problem is part of Pro
Pro unlocks the full statement, tests, hints and solution. The code editor works on a computer.
Upgrade