Search code examples
actionanylogicscheduleordersagent

Anylogic: How to create multiple orders at one moment?


I have created a schedule in Anylogic within the population of agents "customer", where customers have to create orders and send it to "terminals". Every day, the amount of orders that has to be send to terminals is different for every customer. I want to create multiple orders at once (every day, that is the start column within the schedule), and the amount I want to create is the value column within the schedule. How to do this?

As you can see below, now just one order is created every day (with the amount as parameter), but I want to create this amount of orders at that one day/moment. Thank you for the help!

Schedule

The schedule data looks like:

enter image description here


Solution

  • You could do something like this:

    example

    You will have to set the parameters of your agent in the source and on the exit block you do send(agent,main.terminals(0))

    If you have missing data instead of 0 in your value, use this in your agents per arrival:

    enter image description here

    selectFrom(db_table)
        .where(db_table.name.eq(name))
        .where(db_table.start.eq(getDayOfWeek()-1))
        .count()>0
    
    ?
    
    selectFrom(db_table)
        .where(db_table.name.eq(name))
        .where(db_table.start.eq(getDayOfWeek()-1))
        .uniqueResult(db_table.value, int.class)
     :
     0