THINK FIRST·CODE LATER

← All labs

Multi-user offloading: best-response dynamics

Problem

Input: edgeGHz rttMs n, then n users name gigacycles fLocalGHz uploadMs.

Local time = cycles / fLocal. If k users offload, the edge capacity is shared equally: remote time = upload + RTT + cycles / (edgeGHz / k) (in ms).

Initially nobody offloads. In rounds, users update one at a time in input order: a user offloads iff its remote time (counting itself among the k offloaders) is strictly smaller than its local time. Print each change: round 1: U1 offloads (remote 55.0 ms vs local 100.0 ms) or … computes locally (…). Stop after a round without changes (at most 100 rounds).

Then print Equilibrium after r rounds: k of n offload, Latencies (ms): U1=edge 95.0, …, U6=local 100.0, Average latency: X ms and If all offload: Y ms; if none offload: Z ms (averages, 1 decimal).

Write it here or in your IDE, then paste it. Compile and test it yourself before comparing. Your code stays in your browser — it is never sent to or stored on the server.