Skip to content

Agent recognition from data #106

@marco-create

Description

@marco-create

Hello @djordon :)
I have to simulate a one-node M/D/1 system where requests arrive with the arrival time defined as follows:
def slow_arr(t): return t + random.expovariate(1.5)

and service time:
def ser(t): return t + 0.5

During the simulation I need to simulate the arriving of additional requests that have lower arrival time:
def fast_arr(t): return t + random.expovariate(0.15)

From what I got from the docs, I defined two Agents (requests) as follows:

ag_slow = qt.Agent(
    agent_id = (1, 1),   # edge 1, agent 1
    arrival_f = slow_arr,
)

ag_fast = qt.Agent(
    agent_id = (1, 2),
    arrival_f = fast_arr
)

and the queue (which is only one in my simulation):

q = qt.QueueServer(
    num_servers = 1,
    collect_data = True,
    service_f = ser,
)

Now, I injected the first Agent into the server and simulate 10 events and checked the data (just in case)

q.set_active()  # accept agents
ag_slow.queue_action(queue=q)
q.simulate(n=10)
q.fetch_data()

Everything seems right.
Then I injected the second Agent (the requests with lower arrival time):

ag_fast.queue_action(queue=q)
q.simulate(n=10)

Then I port the data into a dataframe and that's the result:

arrival service departure num_queued num_total q_id index
0 1.967303 1.967303 2.467303 0.0 1.0 0.0 0
1 2.093401 2.467303 2.967303 1.0 2.0 0.0 1
2 5.400844 5.400844 5.900844 0.0 1.0 0.0 2
3 5.765601 5.900844 6.400844 1.0 2.0 0.0 3
4 8.493998 8.493998 8.993998 0.0 1.0 0.0 4
5 9.035278 9.035278 9.535278 0.0 1.0 0.0 5
6 9.874867 9.874867 10.374867 0.0 1.0 0.0 6
7 10.542173 10.542173 11.042173 0.0 1.0 0.0 7
8 11.993661 11.993661 12.493661 0.0 1.0 0.0 8
9 13.107135 13.107135 0.000000 0.0 1.0 0.0 9
10 13.565815 0.000000 0.000000 1.0 2.0 0.0 10

Now I have two questions (or more?).
  • First of all, is the way I simulate the network okay? (please don't roast me).

  • Second, is there a way to get the info about the agents? (like, "is this an agent from those with lower arrival time?"). Maybe should be implemented such a thing? Like a label.

Thanks for the help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions