Assigning Workloads

Problem Statement

Having a limited number of machines to schedule workloads on, assign the jobs so as to minimize the number of machines impacted.

Full example scenario

A DevOps engineer is responsible for scheduling workloads on a limited number of onsite machines, each with its own capacity in virtual CPUs (vCPU), RAM, and GPU FLOPS, and every workload requires a certain amount of these resources to run. Which workloads should go on which machines, in order to maximize the total resources of the machines left with no workloads assigned?

  • The total vCPU requirement of the workloads assigned to a machine must not exceed that machine’s vCPU capacity.

  • The total RAM requirement of the workloads assigned to a machine must not exceed that machine’s RAM capacity.

  • The total GPU FLOPS requirement of the workloads assigned to a machine must not exceed that machine’s GPU FLOPS capacity.

  • All workloads must be scheduled.

  • The machine data can be found in assigning_workloads_machines.csv, with the columns Machines,vCPU Capacity,RAM Capacity (GB),GPU Capacity (GFLOPS), and the workload data can be found in assigning_workloads_workloads.csv, with the columns Workloads,vCPU Requirement,RAM Requirement (GB),GPU Requirement (GFLOPS).

What an optimal solution looks like

Resource usage per machine, workload by workload.

Colored segments are the workloads hosted on that machine; grey is capacity left unused. Only Machines 1, 3 and 6 stay on — the rest have nothing assigned and could be powered down. Hover or focus a segment for its exact vCPU/RAM/GPU split.

0 50 100 150 200 Machine Total resources (units) Workload B on Machine 1 · 16 vCPU + 32 GB RAM + 10 GFLOPS = 58 units Workload E on Machine 1 · 2 vCPU + 4 GB RAM + 1 GFLOPS = 7 units Workload F on Machine 1 · 4 vCPU + 16 GB RAM + 3 GFLOPS = 23 units Workload H on Machine 1 · 8 vCPU + 16 GB RAM + 6 GFLOPS = 30 units Machine 1 · 118 of 180 total capacity used (62 unused) Machine 1 Machine 2 · 0 of 95 total capacity used (idle) Machine 2 Workload D on Machine 3 · 32 vCPU + 64 GB RAM + 25 GFLOPS = 121 units Machine 3 · 121 of 126 total capacity used (5 unused) Machine 3 Machine 4 · 0 of 50 total capacity used (idle) Machine 4 Machine 5 · 0 of 95 total capacity used (idle) Machine 5 Workload A on Machine 6 · 8 vCPU + 16 GB RAM + 5 GFLOPS = 29 units Workload C on Machine 6 · 4 vCPU + 8 GB RAM + 2 GFLOPS = 14 units Workload G on Machine 6 · 16 vCPU + 32 GB RAM + 12 GFLOPS = 60 units Machine 6 · 103 of 180 total capacity used (77 unused) Machine 6 Machine 7 · 0 of 50 total capacity used (idle) Machine 7 Machine 8 · 0 of 50 total capacity used (idle) Machine 8
Workload A Workload B Workload C Workload D Workload E Workload F Workload G Workload H Capacity

Active machines — resource usage per machine.

Red marks the resource that is fully saturated on that machine — the one actually forcing it to stay active.

Machine 1

Hosts B, E, F, H

vCPU
30/32
RAM
68/128
GPU
20/20

Machine 3

Hosts D only

vCPU
32/32
RAM
64/64
GPU
25/30

Machine 6

Hosts A, C, G

vCPU
28/32
RAM
56/128
GPU
19/20

Idle machines — freed and available to power down.

Machine 2

95 freed

16 vCPU · 64 GB · 15 GFLOPS

Machine 4

50 freed

8 vCPU · 32 GB · 10 GFLOPS

Machine 5

95 freed

16 vCPU · 64 GB · 15 GFLOPS

Machine 7

50 freed

8 vCPU · 32 GB · 10 GFLOPS

Machine 8

50 freed

8 vCPU · 32 GB · 10 GFLOPS

Workload D (32 vCPU, 64 GB, 25 GFLOPS) is the only workload that fits Machine 3's GPU capacity, so Machine 3 is always active. This is the baseline plan, before the Workload B / Workload H redundancy requirement introduced in the Changing the model tab. Under that requirement B and H swap onto Machine 1 and Machine 6 respectively — the same 340 units stay freed, only the hosting changes.

Built with Modeler

The problem above is stated as a single shot: you hand over the whole problem and get a model back. Modeler takes the other route — you start with the business question you actually have, and it works with you until the problem is pinned down, the data is in, the code runs, and the answer holds up when the problem changes.

The tabs below walk the same workload assignment problem through that route, one Modeler capability at a time.

Instead of writing the whole prompt up front, you start with the business question you actually have. Modeler searches the knowledge base, asks one clarifying question at a time — always the most important one first — and tells you which parts of the model are still missing. The options it offers come from examples in the knowledge base and from how similar problems are usually modeled in your industry, so you can answer with a number instead of prose.

I’m a DevOps engineer. I have a limited number of onsite machines, and I need to assign a batch of workloads onto them. Each machine has some capacity, and each workload needs a chunk of that capacity to run. I want to pack the workloads onto as few machines as possible, so the rest sit idle and I can shut them down or save on them. Can you help me build this as an optimization model?

This reads as a bin-packing / assignment problem with a consolidation objective — workloads are items, machines are bins, and “pack onto as few machines as possible” means the objective rewards leaving some bins completely empty. Let me check the knowledge base for how similar resource-consolidation problems are modeled before asking anything.

Good, the knowledge base confirms this is an assignment problem with a machine-level idle indicator. Before anything else, I need to know what “capacity” actually means here — a single number, or several resources that each have their own limit — because that decides the whole variable and constraint structure, so it has to be the first question.

Good, I have useful context from the knowledge base. Let me now start building the specification with you by asking questions one at a time.

Question 1 of ~6: What dimension(s) does “capacity” represent for your machines?

  1. A single resource (e.g., CPU cores only)

  2. Multiple independent resources (e.g., CPU cores AND memory GB)

  3. A generic “capacity unit” (e.g., a combined score or weight that represents overall load)

Which option best matches your situation, or would you like to describe it differently?

Option 2 — multiple independent resources: vCPU, RAM (GB), and GPU (GFLOPS). Every machine has a capacity for each of the three, and every workload has a requirement for each of the three. I have 8 machines and 8 workloads. One more requirement: every workload must be scheduled on exactly one machine, and instead of just minimizing the count of machines used, I actually want to maximize the total unused resources (summed across vCPU+RAM+GPU) of the machines that end up with zero workloads assigned — so it’s rewarded for freeing up the biggest machines, not just any machine. And to keep it simple, just add the three resources as a raw sum in that objective — no need to weight vCPU, RAM, and GPU differently.

That resolves the capacity question and volunteers four more things at once: the exact resource list, the problem size, the all-workloads-must- be-scheduled rule, and — most importantly — a fully specified objective, including how to combine three differently-scaled resources into one number. Nothing about the objective or the constraints is still ambiguous; the specification is buildable as-is.

Got it. Here is what I have captured so far:

• Resources: vCPU, RAM (GB), GPU (GFLOPS) — 8 machines, 8 workloads
• Every workload assigned to exactly one machine
• Objective: maximize the raw sum (vCPU + RAM + GPU) of machines with
zero workloads assigned

That’s a complete specification to build from — no open questions remain. I’ll save this and move on to bringing in your data.

Modeler updates the specification after every answer, even while it is still incomplete — so you can always see what it has understood and what it is still waiting on.