I have defined a Person agent and a population of Person "living" inside Main agent environment. I'm wondering if in anylogic there is some kind of mechanism to define multiple layer networks and send messages only in specific layer, i.e I want to define for person agents some relations like "family connections" if agents are in the same family (see picture, each connected component is a family), "workplace connections" if agents works in the same place, etc. From the help guide I understood that is possible to create multiple custom connections links.
What isn't clear to me is how to reference a specific relation when I send messages between agents, i.e I would send messages from agent X only to the connected agents Y1,...,Y2 for the relation "family connections" ignoring connected agents for the relation "workplace connections".
From the api doc i see only methods like getConnections() (or send()) to return all the connected agents without the possibility to specify the connection links object (aka a specific network layer).
if you use a link to family members you can use the link to agents object, call it familyLink for instance and connect all your family together. You will have another independent workersLink.
you connect your agents by doing familyLink.connectTo(agent); where the agent is a person which is part of the family.
to send messages to all your family you can do:
familyLink.sendToAllConnected(msg);
You can use a paramter to define the layer of agents (like Person.layer = "XXX"), then make a filter on Persons that should receive the message:
for (Person p : populationOfPerson.stream().filter(predicate).collect(Collectors.toList())) {
/// send msg to p;
}
Related
I am new to sipp and network concepts i got a contact header
"Fin Tax" <sip:b2fdfc58-b7f2-a482-572c-8dbc1aae24#10.195.1.41:5060>;+
"ip.instance="urn:uuid:00000000-0000-0000-0000-34db8dc64>";+
u.sip!devicename="ATA34DBFD8DC64"4DBFD18DC64";+u.sip!model.cc.co.com="681"
Can you explain this contact paramerter i know the first part uri but what are next parameters
First parameter is +sip.instance (the double quote after + in the example above is a typo for sure), which is defined by IETF, it can be found in SIP Outbound (RFC5626) and GRUU (RFC5627):
https://www.rfc-editor.org/rfc/rfc5626
https://www.rfc-editor.org/rfc/rfc5627
Its purpose is to identify uniquely a device, independent of contact address (which can change in case of roaming around wifi hotspots or 4G/5G networks) or multiple connections, but contact addresses can also overlap when devices are located in private networks using same IP range.
Usually its value is build using a UUID (universally unique identifier), which should reduce the risk of duplicate values for users with multiple devices. Its uniqueness allows SIP Registrar Server to identify what contact record to update or remove when processing REGISTER requests from the same device.
The next two parameters prefixed with +u.sip! seem to be custom parameters set by the sending SIP UA. They look like specific to some CISCO equipment, probably a gateway. In general, SIP specifications tell that custom parameters can be ignored by receiving UA, if it does not know how to interpret them.
Usually I select RANDOM as second parameter but by doing so the message is likely to be sent to any agent regardless of its type. For example, in the model there are teachers and students, of which graduate and undergraduate are both states. And I'd like to assign teachers to send messages to students whose state is undergraduate. What should I write in teachers' action?
Main
Student's Stateschart
Teacher's Stateschart
Based on your updated question, you can do the following:
send("msg", randomWhere(main.students, s->s.inState(s.Undergraduate)));
send ("msg", main.undergrads.random());
Product Use Case - Our product has a typical use case where we will be having n no of users. Each user will have n no of workflows and each workflow can be run at any time(n of time).
I hope this is a typical use case of any workflow product.
can I use a domain to differentiate users (I mean to say that creating a domain per user)?
Can I create one WorkflowClient per user to serve all his workflow executions? Or for each request should I need to create one WorkflowClient? which one is a recommended approach?
What is the recommended approach in creating Worker objects to poll task list?
Please don't mistake me If I have asked anything meaningless
can I use a domain to differentiate users (I mean to say that creating a domain per user)?
Yes, especially when these users are working in different teams or product, using different domain will avoid workflowName/IDs conflicting each others, and also assign independent number of quotas for managing traffic.
Can I create one WorkflowClient per user to serve all his workflow executions? Or for each request should I need to create one WorkflowClient? which one is a recommended approach?
Use one WorkflowClient for each domain, but let all WorkflowClients on the same instance share the same TChannelService to save the TCP connection.
I would start with a single namespace (domain) for all users. Unless your users directly operate their workflow implementations it doesn't buy you much to use multiple namespaces.
As i am using getConnections() that will Returns a collection of agents(i.e,list not single agent) connected to any agent. I want to connect the agents (those which are present in the collection returned by getConnections()) to another agent. Problem is connectTo() function is only used for connecting to particuar agent, not list of agent.
Instead of connectTo(), which function can be used or any other way?
You need to loop across all agents retrieved from getConnections(). A simple solution assuming you want to connect myInitialAgent to all agents currently connected to myOtherAgent:
for (Agent currentAgent : myOtherAgent.getConnections()) {
myInitialAgent.connectTo(currentAgent);
}
You could also do it using Lambda expressions but I prefer readability ;-)
I am trying to model a Call Center with Chat communication and need your thoughts on this scenario. Real world scenario is that Customer Service Representatives[CSR] in Chat Call Center can service multiple customer chats at same time based on their capacity[integer value 1,2...]
"Chat" Agent [source]
"ChatAgent" resource unit with int parameters totalCapacity[default=3]
Using a service, incoming "Chat" from source seizes a "ChatAgent" from a resourcePool[with resourceUnit "ChatAgent"]. In this model, a "ChatAgent" accepts only 1 "Chat" inside the service block.
ResourcePool
On seize: unit.totalCapacity--;
On release: unit.totalCapacity++;
But I couldn't model a scenario where 1 "ChatAgent" can service multiple customer "Chats" at a time based on their totalCapacity like in a real chat call center.
Please advise on how I can configure this multiple agents to 1 resource seize/delay.
Updated Model
Updated ChatAgent Resource Structure
Thanks,
Shiva
Many ways of doing this, but the first thing that comes to mind is NOT to use ChatAgent as a resource (at least not the kind you use on a service block) because chats can come at any given time, and you can't have a resource taking many different agents that come at different times through the service block...
Instead you can use the following structure in the chatAgent:
The capacity of the resource will define how many agents can enter the restrictedArea block... This structure will exist inside your chatAgent resource.
Your main agent will have the following structure:
when the chat waits for an available chatAgent, if a chatAgent is available by doing:
chatAgent.beginService.entitiesInside() < chatAgent.capacity
These are the most important details to make it work... now you have to build the model properly.