Skip to the content.

Edge-orchestrated Q-learning: the tier agent handed to an edge data center

What it shows

The same learned tier policy as examples/q_learning, but the decision no longer happens on the device. enable_orchestrators = true with deploy_orchestrator = EDGE routes every request to the closest edge data center first, which adds a MAN round trip before and after the placement. The agent itself is imported, not copied: QLearningOrchestrator still scores states, picks a tier and updates the table. Open reward and results_returned: the delay the agent is charged for now contains that MAN hop, so the value it learns for a tier includes the cost of delegating the choice, and a policy that looks good on-device can look worse here. Read initialize and node_in_tier for the part that did not change.

sequenceDiagram
    participant dev as Device
    participant dc as Closest edge DC
    participant ag as QLearningOrchestrator
    dev->>dc: request, MAN hop
    dc->>ag: state = type, len bucket, load bucket
    ag->>ag: epsilon-greedy, eps 0.1
    ag->>dev: chosen tier, cloud edge or mist
    dev->>dc: result, MAN hop
    dc->>ag: reward = -(delay with MAN), or -1000
    ag->>ag: Q += 0.2 (r + 0.9 maxQ - Q)

The scenario

settings/ is the neighbourhood-scale version of the Q-learning example:

Run it

From the repository root, after pip install -e .:

python examples/edge_orchestrated_q_learning/edge_orchestrated_q_learning.py

No-install variant:

PYTHONPATH=src python examples/edge_orchestrated_q_learning/edge_orchestrated_q_learning.py

What to look for

edge orchestrated        tasks= 56550 ok= 40930 avg_delay=0.1649   cloud=14674 edge=38713 mist= 3163 failed(delay)=15620 failed(mobility)=   0 energy=205.2936

Set enable_orchestrators = false in settings/ to run the agent back on the device and watch the cloud share fall.

Files

Where to go next