Machine Scheduling with Due Dates (QUBO)

Load sample or random orders, edit them on the chart or in the table, and press Solve. QUBO++ assigns every order to a machine so that all due dates are met with the least total processing time.

Explained in the docs: relu() and cons(): C++· Python

orders
Total processing time–
Late orders–
Total lateness–
Unassigned–
Makespan–
Lower bound–
Drag an order to move it to another machine or to another position. QUBO++ places the orders of each machine in due-date order.

Orders 0

Times are in minutes (multiples of 5, up to 600). Leave a machine blank if it cannot process the order.

# Due Machine 1 Machine 2 Machine 3 Assigned Start – End Status
How it works

Each order is processed on exactly one machine that can handle it. The processing time depends on the machine. Every order should finish by its due date; when that is impossible, every order is still assigned and the total lateness is minimized first. Among the assignments with the smallest total lateness, the total processing time (the sum of the processing times on the chosen machines) is minimized. Putting every order on its fastest machine gives the lower bound, but usually some orders then miss their due dates.

QUBO++ processes the orders of each machine in due-date order, which is always the best way to meet the due dates, so only the assignment has to be decided (you can still reorder them by hand). With a binary variable y[j][m] that is 1 when order j is processed on machine m, order j finishes on machine m at C[j][m] = Σi ≤ j p[i][m]·y[i][m], where i ≤ j runs over the orders with due dates no later than that of j.

  • Each order on exactly one machine: cons(Σm y[j][m] == 1)
  • Lateness of order j on machine m: relu(C[j][m] − d[j] − H[j][m]·(1 − y[j][m])). H[j][m] is the largest possible lateness, so the term is 0 when the order is not on machine m.
  • Objective: minimize W·(total lateness) + Σ p[j][m]·y[j][m]. The weight W makes 5 minutes of lateness cost more than any change in the total processing time, so due dates come first.

QUBO++ handles cons() and relu() directly, so the model has only the assignment variables: no slack variables are needed. The search stops early when it reaches the lower bound, which proves optimality.

QUBO++ model
Press Solve to build the model.

How to use

The demo runs on AWS Lambda with limited resources; QUBO++ on a desktop PC is several times faster.

How the schedule becomes a QUBO model

Each order $j$ has a due date $d_j$ and a processing time $p_{j,m}$ on each machine $m$ that can process it. The demo uses one binary variable per possible pair: $y_{j,m}=1$ if order $j$ is processed on machine $m$.

On each machine the orders are processed in due-date order. If some order of the jobs on a machine meets all their due dates, the due-date order does too, so this loses no schedule that meets every due date, and only the assignment has to be decided. With the orders numbered by due date, order $j$ finishes on machine $m$ at

\[C_{j,m} = \sum_{i \le j} p_{i,m}\, y_{i,m} .\]

The model is

\[\text{minimize}\quad \sum_{j,m} p_{j,m}\, y_{j,m} \;+\; W \sum_{j,m} \mathrm{relu}\big(C_{j,m} - d_j - H_{j,m}(1-y_{j,m})\big) \qquad\text{subject to}\quad \sum_{m} y_{j,m} = 1 \ \text{for every order } j,\]

where $\mathrm{relu}(z)=\max(z,0)$. The relu term is the lateness of order $j$ when it is on machine $m$; $H_{j,m}$ is the largest possible lateness, so the term is 0 when the order is not on machine $m$. The weight $W$ makes 5 minutes of lateness cost more than any change in the total processing time, so meeting the due dates comes first and the total processing time second.

QUBO++ writes the lateness with relu() and the assignment with cons(), and its solvers handle both directly: the model has only the assignment variables and no slack variables. The model is solved by the ABS3 solver of QUBO++ running on the CPU. The search stops early if it reaches the lower bound, which proves that the schedule is optimal. Because the coefficients can be large, the demo uses 64-bit coefficients (c64e64).

Run it on your computer

PyQBPP, the Python version of QUBO++, runs on Linux (x86-64 and ARM64) and on Windows through WSL:

pip install pyqbpp

The constraints page explains relu() and cons(). See Installation for details, and the other demos for more problems solved with QUBO++.