Search code examples
anylogic

Anylogic: Change distribution weights values over the time


I need some advice in order to work with customDistrbution. I have a CustomDistribution ( let's call it A). Options of A are fixed during time, while the weights values must change over the years. Weights and options are stored in a database, loaded from excell: the first column cointains the options, while weights are stored from column 2 to column n ( each weight column is associated to one year). What i want to do is to progressively pass to the distribution the value of weights of the corresponding year. Is it possible to do it? Screenshot of database and distribution in link.
THX! [database and custom distribution][1] [1]: https://i.sstatic.net/ce5Nc.png


Solution

  • Best create a function f_getDistribution that returns a CustomDistribution and takes as an argument the time (year?) you want to check for.

    Create a separate distribution for each time-frame you have in your data and store them all in a collection, ideally using a LinkedHashMap keyed by the year (?) it covers.

    In the function, you find the distribution you want for the given time/year and return it from the collection.

    Alternatively, you can create an event that creates a new distribution each time you want to switch over.

    Both not trivial but absolutely possible :)