I am modeling the type of Customer agents. They are given parameters: they work (true / false) and have education (true / false).
There is a condition that agents in the block service fall where works == true and education == true. And all the others go to the exit.
enter image description here
How do each agent specify different parameters?
So the first thing to notice here is that your queue block does nothing and you could just remove it.
And to change the parameters of your agent, in your source, in the "on at exit" action you can write the values you want, for instance:
agent.works=false;
agent.education==true;
you can also create random values...
agent.works=randomTrue(0.5);
agent.education==randomTrue(0.5);
also, if you go to your agent's variable "works", in the default value, you can make it also random writing randomTrue(0.5)
where randomTrue defines how likely it is for your variable to be true (0.5 means 50% chance)
Related
P.S. This Question has been edited to answer questions made by #Felipe
I have an Agent-Based model simulation for churn behavior modeling. On each iteration(based on time--month) each user reconsiders her choice of operator(our or other) based on model metrics (Cost/SocialNetwork/...). In runtime even when I change parameters to affect Agents' decision, no one changes his/her operator. here is my state chart image on the below:
I should note that internal transition of (our user) has below details:
the first two lines are something for display. Advocate() refers to the action of sending messages which affects social influence.
But Switch() is where decision happens based on new parameters' value. In short, d defines a normalized range between -1 and 1 : signum(d) predicts which provider is the preferred one and abs(d) shows how preferred the selected provider will be.
//Definition for Switch()
double d = (this.Social_impact()/20)+this.Monthly_Charge_Impact();
if (d>0)
SwitchToUs();
else
SwitchToOther();
the two SwitchToUs and SwitchToOther functions simply change the operator (as if creating arrows between OUR_USER and OTHER_USER states)
I am simulating last-mile delivery and I want to iteratively evaluate the co2 emissions between stops. The numbers of the first route evaluation add up i.e. it correctly counts/removes each stop embedded within the route. The problem is that when the first route is finished, the model should consider the next route embedded in a new agent of type 'Order', in 'toConsumer' but it does not. From what I can see, is that the order agent is not updated after the condition in the select block has been met. I am not sure however, why it does this. When the condition is satisfied the agent does continue to the sink. Does anybody know how i can ensure this updating of the agent?
The anylogic model looks as follows:
In the source block I create agents following optimization results via:
int r = 0;
agent.routeVeh = (int) parVehicle.get(r);
agent.route = (List) parRoute.get(r);
agent.routeDep = (int) parDepot.get(r);
r++;
And in the select block i have:
The to consumer block:
If you are doing this operation in the Main agent, you need to define routeCount and consumerCount inside your Order agent (or if you have a Vehicle agent defined, inside that). Because they are defined for each order. Then in the routeFinished you need update the variable as agent.consumerCount++;
Good day,
I'm trying in AnyLogic to make block "Ped Select Output" (from Pedestrian library) select output based on the received message, using the command in conditions table receive("go");. This block is located in Main, while the message is supposed to be sent from the agent tab (MyAgent) using the command send("go", main.pedSource);. Yet if I try to launch this model I get the error "Type mismatch, cannot convert void to boolean". I believe I have incorrectly selected one of the commands (or maybe both), thus I hope for advice about it. Thanks in advance for the answer.
P.s. check screenshots, for more detailed information.
P.p.s. the model, that is presented on screenshots is just an oversimplified example of the real model (that's why 4 out of 5 outputs of the block are connected to one place).
main
agent
Each condition in the selectoutput should return a boolean... a boolean can be true or false
Some example of booleans are 3==2, 5>4, agent.priority==1, etc
These things are booleand because they are true or false
you are putting in the condition a function that doesn't return anything (receive) and I have absolutely no idea what is in your head that would suggest that this might work in any way...
I suggest you add a variable in your ped agent that defines what the pedestrian should do...
I am trying to create a service that varies depending on the resources that are used.
For example if a nurse were to carry out the service it could take 10 - 35 mins, whereas if this is carried out by another member of staff it could take 5-25 minutes.
I have had a go - as in the picture below, however, what I've written doesn't seem to be working.
Resource dependent delays
Any help would be massively appreciated!
First, since the parameter "Delay time" accepts a value, you need to replace if-else statement with conditional expression "? :". The syntax is the following: condition ? value if true : value if false.
Moreover, your should use another condition to check if the agent has a resource unit from "Nurse":
agent.resourceUnitOfPool(Nurse) != null ? triangular(10, 15, 35) :
triangular(5, 10, 25)
I have a report using many variables to calculate a rolling inventory over 16 months. The users are requesting some difficult calculations in the rollover amount (or carryover) such as only carryover amounts > 0, but only for some categories(groups), and then add the carryover from one category to the carryover in another category. I have most of the issues worked out, but I need to set a variable for the carryover ONLY when the group ="XXX", and maintain that variable value even when the group changes. I can easily set the variable to change over categories (groups) $F{group1}=="XXX"?QTY_ON_HAND - QTY_ORDERED:0.0, but when the group changes to "YYY" and then to "ZZZ" the value of the variable changes to 0. I need to use the value of the variable when it is in the "XXX" group as part of the calculation when it gets to group "ZZZ", but if it resets to 0 at that time, it is useless. I have also tried setting the variable = $V{rollover_amount} and have tried that changing the Calculation Type, Reset Type, and Increment Types to no avail.
I have the Calculation set to "No Calculation", Increment and Reset types set to "None"
I am using Jaspersoft Studio 5.5, but the same would apply to iReport Designer.
I see two potential approaches.
1) It looks like you've already started by creating the calculation by using conditional logic in the Variable Expression property. Continue with this approach. Try resetting the variable to itself when the group condition fails. Something like:
$F{group1} == "XXX" ? {do what you need to do} : $F{group1}
2) Use a JasperReport Scriptlet and manage the logic outside the report.
http://jasperreports.sourceforge.net/sample.reference/scriptlet/