How can I keep record (or see) of what value was given by the distribution each time the process took place? - anylogic

I have beeen constructing a model in Anylogic in the last weeks, and I am currently simulating the time a truck takes to deliver its products, so I used a delay for this in which different parameters are multiplied to several distributions. Is there any was I can keep track of the value of the distribution each time the process takes place. The following is in example:
normal(2, 8, 4.67, 1.96)*DropSize
The DropSize is my parameter, but I wish to know what value was generated for the normal distribution, and keep track of this.

Sure, several ways (as usual with AnyLogic :-) ). Here is one:
create a collection of type ArrayList:
Then, create a function that draws the random value, stores it in the collection and returns it as below:
Last, replace your code creating the random value with calling that function. Now, whenever you pull a value from the distribution, it is also stored in the collection.
cheers

Related

Best way to save a data structure with date-related varying attributes in Swift/CoreData

I am thinking about how to best represent a certain data structure efficiently in Swift using CoreData. What I need is work with accounts (like savings, earning etc.). So what would probably make sense is an account class, where each account instance might have multiple characteristics like e.g. ACCOUNT_TYPE_ID which do not change. The core however is the VALUE attribute, which would hold the value of the account at a certain point in time. The complex thing here is that this value obviously might change over time (lets say on a daily basis, abstracting for intra-day changes) and I would need to be able to get the value of each instance for any given date. E.g. I might have my savings_private for which I would want to get the value at each month-end. This value might have changed, but as well could stay the same for various days/months. How could this most efficiently (when it comes to used space but - and that is even more important - be able to access computationally efficient) be done with a CoreData Entity/Class? I was thinking about maybe always starting with zero and then only somehow save the changes plus the date of change and then have some method for the call which would add all changes up to a date parameter - but was curious about what a best-practice might be here, as I guess I am not the first one trying to solve this.

Dynamically Changing Distribution in AnyLogic

I am using AnyLogic to develop a model.
I used the 'distribution' element to initialize values for a parameter in my model. It is working fine, but I want to update these values as my simulation proceeds forward. e.g. if in week 1, the distribution can have values:
Distribution
But in week 2, I wan to update these values, then again in each coming week.
I have some equation based on which I want to make calculations and update these values.
I could not find any functionality in AnyLogic concerning this.
Any ideas how to achieve this?
You may create distribution from scratch, using various constructors. Pass into constructor array with existing and additional values to get the updated custom distribution. Your distribution is created with this constructor:
CustomDistribution(double[] intervalStarts, int[] numberOfObservations, Agent owner)
It may be convenient to store initial array in database, and each next array in model variable.

Is it possible to assign a number to a lists with the same name to be differentiated?

A part of my program relies on recording the lengths of roads within my user interface as they are drawn out. As this requires looping , and as I want to be able to keep the name of the list all the data is stored in the same, is it possible to create lists thusly :
set list road-length X
(where X is a counter that is incremented every time a condition is met). Essentially can I tag numbers on to the ends of lists so that I can tell them apart when they need to be read later on in my program?
You can, but it is almost surely the wrong approach. (For one thing, the names will not be global unless you declare them all ahead of time.) Instead, use the table extension, create a global to hold your table, and use the table to map your id numbers to your lists. This will prove much more useful.

Time mesauring of unique objects with Nesper

I would like to measure the time of cars with an unique Id with NEsper. My problem is, that there are several cars on a road. This road has predefined steps. I want to start to stop the time for every unique car that is in first step until this car receives the last step.
select ice.* from pattern[ice = IncomingCarEvent -> every timer:interval(1 sec) and not LastStepEvent]
The problem is, that I don't know how to separate the cars with a given Id. In this example, if one of the cars receives the last step the event does not fire anymore.
I'm not very clear on why you measure until the last step and the pattern says "not lastestep".
Partitioning can be done by correlating the events in the patterns such as "a=A => B(id=a.id)".
You can also partition using a context declaration which is in this link: http://esper.codehaus.org/esper-5.1.0/doc/reference/en-US/html_single/index.html#context_def_keyed
Or you may find the match-recognize to be easier to use as it has more of a step-wise approach to expressing a match much like regular expressions.

Using variables to save a repetition field in FileMaker

I got a part number field that have several repetitions. I want to use a variable to save this so that I can show all the descriptions of these parts in a different layout when user click a button.
But I do not know how to use variable to save several values like that. And I do not know exactly how many repetitions for each part number.
Although FileMaker allows for repetition fields and they have some valid behind-the-scenes uses for the database developer, they should NEVER be used for data. As pointed out by others, you should rethink you data structure.
That being said, you can capture the information in repeating fields by specifying which repetition you're interested in. If you have a repeating field named "partNumber" with 10 repetitions, then you can access each of the repetitions by:
partNumber[1]
partNumber[2]
.
.
.
partNumber[9]
partNumber[10]
RepFieldToVar [calculation] =Let($$varName = List(RepeatingFieldName), "")
This puts all repetitions into a return-delimited value list in $$varName.
Incidentally, there are _exceedingly rare_ instances where repeating fields are still useful. I've used them for grid-type schedule layouts that need stored values. But 99.98% of the time the other commenters are right, you can probably do it more efficiently with related records.