Anylogic change sequence in service block











up vote
1
down vote

favorite












Dear AnyLogic community,



I have created a model to evaluate different methods of autonomous control.



I have agents with different due dates and want the agent with the soonest due date to be served first. At the moment the incoming agents are not sorted in any way but served according to the FIFO rule.



Is there a possibility to modify the sequence of the agents in a service block without adding a seperate queue?



Many thanks for your time & help!










share|improve this question







New contributor




Marie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • use priorities... The sooner the due date, the higher the priority. Agents will be served according to their priorities. Have you tried that out?
    – Felipe
    Nov 9 at 18:04












  • I assigned priorities now, but I don't know how to call them up within the service block?
    – Marie
    2 days ago










  • In a service block, you can only use priorities to call up resources by their priority. You cannot sort the embedded queue within the service object. You need to add another queue object ahead of the service, only there can you make it sort by priority (or agent comparison as suggested below). Also, make sure to set the service-object queue size to 1 (0 is impossible) so there is no queing happening within service.
    – Benjamin
    2 days ago










  • Does that mean that setting the task priority according to the agent's priority like suggested by Felipe does not ensure that the order with the highest priority gets served first?
    – Marie
    2 days ago










  • I think it might not, actually. It isn't clear from the help on the Service block. Suggest you just create your own manual test to see how it really works :-) You could be right that the priority for service blocks actually sorts the queue. I never use it as the queue-seize-delay-release blocks allow me greater flexibility :-) sorry for the confusion
    – Benjamin
    yesterday

















up vote
1
down vote

favorite












Dear AnyLogic community,



I have created a model to evaluate different methods of autonomous control.



I have agents with different due dates and want the agent with the soonest due date to be served first. At the moment the incoming agents are not sorted in any way but served according to the FIFO rule.



Is there a possibility to modify the sequence of the agents in a service block without adding a seperate queue?



Many thanks for your time & help!










share|improve this question







New contributor




Marie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • use priorities... The sooner the due date, the higher the priority. Agents will be served according to their priorities. Have you tried that out?
    – Felipe
    Nov 9 at 18:04












  • I assigned priorities now, but I don't know how to call them up within the service block?
    – Marie
    2 days ago










  • In a service block, you can only use priorities to call up resources by their priority. You cannot sort the embedded queue within the service object. You need to add another queue object ahead of the service, only there can you make it sort by priority (or agent comparison as suggested below). Also, make sure to set the service-object queue size to 1 (0 is impossible) so there is no queing happening within service.
    – Benjamin
    2 days ago










  • Does that mean that setting the task priority according to the agent's priority like suggested by Felipe does not ensure that the order with the highest priority gets served first?
    – Marie
    2 days ago










  • I think it might not, actually. It isn't clear from the help on the Service block. Suggest you just create your own manual test to see how it really works :-) You could be right that the priority for service blocks actually sorts the queue. I never use it as the queue-seize-delay-release blocks allow me greater flexibility :-) sorry for the confusion
    – Benjamin
    yesterday















up vote
1
down vote

favorite









up vote
1
down vote

favorite











Dear AnyLogic community,



I have created a model to evaluate different methods of autonomous control.



I have agents with different due dates and want the agent with the soonest due date to be served first. At the moment the incoming agents are not sorted in any way but served according to the FIFO rule.



Is there a possibility to modify the sequence of the agents in a service block without adding a seperate queue?



Many thanks for your time & help!










share|improve this question







New contributor




Marie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











Dear AnyLogic community,



I have created a model to evaluate different methods of autonomous control.



I have agents with different due dates and want the agent with the soonest due date to be served first. At the moment the incoming agents are not sorted in any way but served according to the FIFO rule.



Is there a possibility to modify the sequence of the agents in a service block without adding a seperate queue?



Many thanks for your time & help!







java simulation anylogic






share|improve this question







New contributor




Marie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Marie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Marie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 9 at 17:16









Marie

82




82




New contributor




Marie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Marie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Marie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • use priorities... The sooner the due date, the higher the priority. Agents will be served according to their priorities. Have you tried that out?
    – Felipe
    Nov 9 at 18:04












  • I assigned priorities now, but I don't know how to call them up within the service block?
    – Marie
    2 days ago










  • In a service block, you can only use priorities to call up resources by their priority. You cannot sort the embedded queue within the service object. You need to add another queue object ahead of the service, only there can you make it sort by priority (or agent comparison as suggested below). Also, make sure to set the service-object queue size to 1 (0 is impossible) so there is no queing happening within service.
    – Benjamin
    2 days ago










  • Does that mean that setting the task priority according to the agent's priority like suggested by Felipe does not ensure that the order with the highest priority gets served first?
    – Marie
    2 days ago










  • I think it might not, actually. It isn't clear from the help on the Service block. Suggest you just create your own manual test to see how it really works :-) You could be right that the priority for service blocks actually sorts the queue. I never use it as the queue-seize-delay-release blocks allow me greater flexibility :-) sorry for the confusion
    – Benjamin
    yesterday




















  • use priorities... The sooner the due date, the higher the priority. Agents will be served according to their priorities. Have you tried that out?
    – Felipe
    Nov 9 at 18:04












  • I assigned priorities now, but I don't know how to call them up within the service block?
    – Marie
    2 days ago










  • In a service block, you can only use priorities to call up resources by their priority. You cannot sort the embedded queue within the service object. You need to add another queue object ahead of the service, only there can you make it sort by priority (or agent comparison as suggested below). Also, make sure to set the service-object queue size to 1 (0 is impossible) so there is no queing happening within service.
    – Benjamin
    2 days ago










  • Does that mean that setting the task priority according to the agent's priority like suggested by Felipe does not ensure that the order with the highest priority gets served first?
    – Marie
    2 days ago










  • I think it might not, actually. It isn't clear from the help on the Service block. Suggest you just create your own manual test to see how it really works :-) You could be right that the priority for service blocks actually sorts the queue. I never use it as the queue-seize-delay-release blocks allow me greater flexibility :-) sorry for the confusion
    – Benjamin
    yesterday


















use priorities... The sooner the due date, the higher the priority. Agents will be served according to their priorities. Have you tried that out?
– Felipe
Nov 9 at 18:04






use priorities... The sooner the due date, the higher the priority. Agents will be served according to their priorities. Have you tried that out?
– Felipe
Nov 9 at 18:04














I assigned priorities now, but I don't know how to call them up within the service block?
– Marie
2 days ago




I assigned priorities now, but I don't know how to call them up within the service block?
– Marie
2 days ago












In a service block, you can only use priorities to call up resources by their priority. You cannot sort the embedded queue within the service object. You need to add another queue object ahead of the service, only there can you make it sort by priority (or agent comparison as suggested below). Also, make sure to set the service-object queue size to 1 (0 is impossible) so there is no queing happening within service.
– Benjamin
2 days ago




In a service block, you can only use priorities to call up resources by their priority. You cannot sort the embedded queue within the service object. You need to add another queue object ahead of the service, only there can you make it sort by priority (or agent comparison as suggested below). Also, make sure to set the service-object queue size to 1 (0 is impossible) so there is no queing happening within service.
– Benjamin
2 days ago












Does that mean that setting the task priority according to the agent's priority like suggested by Felipe does not ensure that the order with the highest priority gets served first?
– Marie
2 days ago




Does that mean that setting the task priority according to the agent's priority like suggested by Felipe does not ensure that the order with the highest priority gets served first?
– Marie
2 days ago












I think it might not, actually. It isn't clear from the help on the Service block. Suggest you just create your own manual test to see how it really works :-) You could be right that the priority for service blocks actually sorts the queue. I never use it as the queue-seize-delay-release blocks allow me greater flexibility :-) sorry for the confusion
– Benjamin
yesterday






I think it might not, actually. It isn't clear from the help on the Service block. Suggest you just create your own manual test to see how it really works :-) You could be right that the priority for service blocks actually sorts the queue. I never use it as the queue-seize-delay-release blocks allow me greater flexibility :-) sorry for the confusion
– Benjamin
yesterday














2 Answers
2






active

oldest

votes

















up vote
0
down vote



accepted










Benjamin's solution is good, but if you insist in not wanting to use a queue before the service block, and that you need to use a service block no matter what then you can set up priorities like this:



how to set priorities



Your agent's priority will be higher when the due date is closer.



Since you have already set up the priorities inside your agent, then there is nothing else to do but this (unless you want preemption).



But the priority can just be this if you want to set it up (priority being a parameter defined in your agent):
priority setting






share|improve this answer























  • Thanks a lot. Your solution does really help me!
    – Marie
    2 days ago


















up vote
0
down vote













You can map due dates to priorities, as Felipe suggested.



Alternatively, a more direct approach would be to use the queue priorisation mode "Agent comparison". Lets say your agents have a parameter "myDueDate" of type Date.



Then you can simply arrange agents with the most urgent due date as below, essentially saying "prefer the incoming agent1 to an existing agent2 if it is more urgent". The incoming agent will jump ahead of each of the queue members until it finds one that is even more urgent.
enter image description here






share|improve this answer





















  • I know that this would be the best way, but actually I wanted to solve the problem without adding a seperate queue. Is there a possibility to include this comparison in the service block so I can leave out the extra queue?
    – Marie
    2 days ago










  • No. But the service block is really just a seize-delay-release combination to save some space. However, some of the detailed properties cannot be found in the service object. So if you need one (like queue ordering) you must untangle your service object. All it costs you is a little screen space... Go for it 🙂
    – Benjamin
    2 days ago










  • The problem was that the queue length of the service block was already used in several decision processes within my model, so Felipe's solution helps me best. Next time I will untangle the service object and use seperate elements.
    – Marie
    2 days ago










  • Nevertheless, thanks a lot for your quick answers and your time and help!
    – Marie
    2 days ago










  • no worries, I get your point. I just thought that the mapping from a date to an int-priority might be non-trivial. In general, though, you should get comfortable with so-called "refactoring" as you build larger models: it is inevitable to having to shed some objects, replace it with others and "reattach" code that uses old objects to new ones. Otherwise, you will get stuck soon with messy make-dos :-)
    – Benjamin
    2 days ago











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Marie is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53230472%2fanylogic-change-sequence-in-service-block%23new-answer', 'question_page');
}
);

Post as a guest
































2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote



accepted










Benjamin's solution is good, but if you insist in not wanting to use a queue before the service block, and that you need to use a service block no matter what then you can set up priorities like this:



how to set priorities



Your agent's priority will be higher when the due date is closer.



Since you have already set up the priorities inside your agent, then there is nothing else to do but this (unless you want preemption).



But the priority can just be this if you want to set it up (priority being a parameter defined in your agent):
priority setting






share|improve this answer























  • Thanks a lot. Your solution does really help me!
    – Marie
    2 days ago















up vote
0
down vote



accepted










Benjamin's solution is good, but if you insist in not wanting to use a queue before the service block, and that you need to use a service block no matter what then you can set up priorities like this:



how to set priorities



Your agent's priority will be higher when the due date is closer.



Since you have already set up the priorities inside your agent, then there is nothing else to do but this (unless you want preemption).



But the priority can just be this if you want to set it up (priority being a parameter defined in your agent):
priority setting






share|improve this answer























  • Thanks a lot. Your solution does really help me!
    – Marie
    2 days ago













up vote
0
down vote



accepted







up vote
0
down vote



accepted






Benjamin's solution is good, but if you insist in not wanting to use a queue before the service block, and that you need to use a service block no matter what then you can set up priorities like this:



how to set priorities



Your agent's priority will be higher when the due date is closer.



Since you have already set up the priorities inside your agent, then there is nothing else to do but this (unless you want preemption).



But the priority can just be this if you want to set it up (priority being a parameter defined in your agent):
priority setting






share|improve this answer














Benjamin's solution is good, but if you insist in not wanting to use a queue before the service block, and that you need to use a service block no matter what then you can set up priorities like this:



how to set priorities



Your agent's priority will be higher when the due date is closer.



Since you have already set up the priorities inside your agent, then there is nothing else to do but this (unless you want preemption).



But the priority can just be this if you want to set it up (priority being a parameter defined in your agent):
priority setting







share|improve this answer














share|improve this answer



share|improve this answer








edited 2 days ago

























answered 2 days ago









Felipe

1,5672721




1,5672721












  • Thanks a lot. Your solution does really help me!
    – Marie
    2 days ago


















  • Thanks a lot. Your solution does really help me!
    – Marie
    2 days ago
















Thanks a lot. Your solution does really help me!
– Marie
2 days ago




Thanks a lot. Your solution does really help me!
– Marie
2 days ago












up vote
0
down vote













You can map due dates to priorities, as Felipe suggested.



Alternatively, a more direct approach would be to use the queue priorisation mode "Agent comparison". Lets say your agents have a parameter "myDueDate" of type Date.



Then you can simply arrange agents with the most urgent due date as below, essentially saying "prefer the incoming agent1 to an existing agent2 if it is more urgent". The incoming agent will jump ahead of each of the queue members until it finds one that is even more urgent.
enter image description here






share|improve this answer





















  • I know that this would be the best way, but actually I wanted to solve the problem without adding a seperate queue. Is there a possibility to include this comparison in the service block so I can leave out the extra queue?
    – Marie
    2 days ago










  • No. But the service block is really just a seize-delay-release combination to save some space. However, some of the detailed properties cannot be found in the service object. So if you need one (like queue ordering) you must untangle your service object. All it costs you is a little screen space... Go for it 🙂
    – Benjamin
    2 days ago










  • The problem was that the queue length of the service block was already used in several decision processes within my model, so Felipe's solution helps me best. Next time I will untangle the service object and use seperate elements.
    – Marie
    2 days ago










  • Nevertheless, thanks a lot for your quick answers and your time and help!
    – Marie
    2 days ago










  • no worries, I get your point. I just thought that the mapping from a date to an int-priority might be non-trivial. In general, though, you should get comfortable with so-called "refactoring" as you build larger models: it is inevitable to having to shed some objects, replace it with others and "reattach" code that uses old objects to new ones. Otherwise, you will get stuck soon with messy make-dos :-)
    – Benjamin
    2 days ago















up vote
0
down vote













You can map due dates to priorities, as Felipe suggested.



Alternatively, a more direct approach would be to use the queue priorisation mode "Agent comparison". Lets say your agents have a parameter "myDueDate" of type Date.



Then you can simply arrange agents with the most urgent due date as below, essentially saying "prefer the incoming agent1 to an existing agent2 if it is more urgent". The incoming agent will jump ahead of each of the queue members until it finds one that is even more urgent.
enter image description here






share|improve this answer





















  • I know that this would be the best way, but actually I wanted to solve the problem without adding a seperate queue. Is there a possibility to include this comparison in the service block so I can leave out the extra queue?
    – Marie
    2 days ago










  • No. But the service block is really just a seize-delay-release combination to save some space. However, some of the detailed properties cannot be found in the service object. So if you need one (like queue ordering) you must untangle your service object. All it costs you is a little screen space... Go for it 🙂
    – Benjamin
    2 days ago










  • The problem was that the queue length of the service block was already used in several decision processes within my model, so Felipe's solution helps me best. Next time I will untangle the service object and use seperate elements.
    – Marie
    2 days ago










  • Nevertheless, thanks a lot for your quick answers and your time and help!
    – Marie
    2 days ago










  • no worries, I get your point. I just thought that the mapping from a date to an int-priority might be non-trivial. In general, though, you should get comfortable with so-called "refactoring" as you build larger models: it is inevitable to having to shed some objects, replace it with others and "reattach" code that uses old objects to new ones. Otherwise, you will get stuck soon with messy make-dos :-)
    – Benjamin
    2 days ago













up vote
0
down vote










up vote
0
down vote









You can map due dates to priorities, as Felipe suggested.



Alternatively, a more direct approach would be to use the queue priorisation mode "Agent comparison". Lets say your agents have a parameter "myDueDate" of type Date.



Then you can simply arrange agents with the most urgent due date as below, essentially saying "prefer the incoming agent1 to an existing agent2 if it is more urgent". The incoming agent will jump ahead of each of the queue members until it finds one that is even more urgent.
enter image description here






share|improve this answer












You can map due dates to priorities, as Felipe suggested.



Alternatively, a more direct approach would be to use the queue priorisation mode "Agent comparison". Lets say your agents have a parameter "myDueDate" of type Date.



Then you can simply arrange agents with the most urgent due date as below, essentially saying "prefer the incoming agent1 to an existing agent2 if it is more urgent". The incoming agent will jump ahead of each of the queue members until it finds one that is even more urgent.
enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 9 at 20:10









Benjamin

8651512




8651512












  • I know that this would be the best way, but actually I wanted to solve the problem without adding a seperate queue. Is there a possibility to include this comparison in the service block so I can leave out the extra queue?
    – Marie
    2 days ago










  • No. But the service block is really just a seize-delay-release combination to save some space. However, some of the detailed properties cannot be found in the service object. So if you need one (like queue ordering) you must untangle your service object. All it costs you is a little screen space... Go for it 🙂
    – Benjamin
    2 days ago










  • The problem was that the queue length of the service block was already used in several decision processes within my model, so Felipe's solution helps me best. Next time I will untangle the service object and use seperate elements.
    – Marie
    2 days ago










  • Nevertheless, thanks a lot for your quick answers and your time and help!
    – Marie
    2 days ago










  • no worries, I get your point. I just thought that the mapping from a date to an int-priority might be non-trivial. In general, though, you should get comfortable with so-called "refactoring" as you build larger models: it is inevitable to having to shed some objects, replace it with others and "reattach" code that uses old objects to new ones. Otherwise, you will get stuck soon with messy make-dos :-)
    – Benjamin
    2 days ago


















  • I know that this would be the best way, but actually I wanted to solve the problem without adding a seperate queue. Is there a possibility to include this comparison in the service block so I can leave out the extra queue?
    – Marie
    2 days ago










  • No. But the service block is really just a seize-delay-release combination to save some space. However, some of the detailed properties cannot be found in the service object. So if you need one (like queue ordering) you must untangle your service object. All it costs you is a little screen space... Go for it 🙂
    – Benjamin
    2 days ago










  • The problem was that the queue length of the service block was already used in several decision processes within my model, so Felipe's solution helps me best. Next time I will untangle the service object and use seperate elements.
    – Marie
    2 days ago










  • Nevertheless, thanks a lot for your quick answers and your time and help!
    – Marie
    2 days ago










  • no worries, I get your point. I just thought that the mapping from a date to an int-priority might be non-trivial. In general, though, you should get comfortable with so-called "refactoring" as you build larger models: it is inevitable to having to shed some objects, replace it with others and "reattach" code that uses old objects to new ones. Otherwise, you will get stuck soon with messy make-dos :-)
    – Benjamin
    2 days ago
















I know that this would be the best way, but actually I wanted to solve the problem without adding a seperate queue. Is there a possibility to include this comparison in the service block so I can leave out the extra queue?
– Marie
2 days ago




I know that this would be the best way, but actually I wanted to solve the problem without adding a seperate queue. Is there a possibility to include this comparison in the service block so I can leave out the extra queue?
– Marie
2 days ago












No. But the service block is really just a seize-delay-release combination to save some space. However, some of the detailed properties cannot be found in the service object. So if you need one (like queue ordering) you must untangle your service object. All it costs you is a little screen space... Go for it 🙂
– Benjamin
2 days ago




No. But the service block is really just a seize-delay-release combination to save some space. However, some of the detailed properties cannot be found in the service object. So if you need one (like queue ordering) you must untangle your service object. All it costs you is a little screen space... Go for it 🙂
– Benjamin
2 days ago












The problem was that the queue length of the service block was already used in several decision processes within my model, so Felipe's solution helps me best. Next time I will untangle the service object and use seperate elements.
– Marie
2 days ago




The problem was that the queue length of the service block was already used in several decision processes within my model, so Felipe's solution helps me best. Next time I will untangle the service object and use seperate elements.
– Marie
2 days ago












Nevertheless, thanks a lot for your quick answers and your time and help!
– Marie
2 days ago




Nevertheless, thanks a lot for your quick answers and your time and help!
– Marie
2 days ago












no worries, I get your point. I just thought that the mapping from a date to an int-priority might be non-trivial. In general, though, you should get comfortable with so-called "refactoring" as you build larger models: it is inevitable to having to shed some objects, replace it with others and "reattach" code that uses old objects to new ones. Otherwise, you will get stuck soon with messy make-dos :-)
– Benjamin
2 days ago




no worries, I get your point. I just thought that the mapping from a date to an int-priority might be non-trivial. In general, though, you should get comfortable with so-called "refactoring" as you build larger models: it is inevitable to having to shed some objects, replace it with others and "reattach" code that uses old objects to new ones. Otherwise, you will get stuck soon with messy make-dos :-)
– Benjamin
2 days ago










Marie is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















Marie is a new contributor. Be nice, and check out our Code of Conduct.













Marie is a new contributor. Be nice, and check out our Code of Conduct.












Marie is a new contributor. Be nice, and check out our Code of Conduct.















 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53230472%2fanylogic-change-sequence-in-service-block%23new-answer', 'question_page');
}
);

Post as a guest




















































































Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python