getting the name of the variable with the maximum value in anylogic - variables

In anylogic, I have some variables(more than 2) and I want to know which of them has the maximum value? How can I do that?
where can I save the name of the maximum variable?

getting the maximum value of a number of values is not an AnyLogic problem but a general coding problem which stackoverflow probably has hundreds of answers for.
In AnyLogic, you could add all your variables to a statistics object. Then call myStatisticsObject.max() to get the maximum.
To save that in a new variables, call newVariable = mtStatistics.max()
cheers

Related

Anylogic: I've assigned a statistic value to a variable, but it only return 0

I have assigned a statistics value to the variable waiting_units using jeepneys.Waiting_Units_MDJ(). jeepneys is the population, and Waiting_Units() is the statistics. When simulated, it only returns 0 and not the statistics value.
It only shows the right statistic value if I add an event with an action waiting_units = jeepneys.Waiting_Units_MDJ(); to assign the value.
Is there a right way so I can assign the statistics value to a variable without using an event? I need the variable to continuously have the current value of the statistic.
I appreciate any help you can provide.
The Waiting_Units() statistic is a function (hence the brackets). By design, it is never actually calculated unless you call it. This is to avoid accidentally slowing your model.
It is your responsibility to call the function/statistic when you need it.
If you want to avoid using an event, you can also replace the statistic function with an Output object computing the same thing whenever you want:
Note that the code in the "Value" field depends on the setup of your current statistic.

Query does not display full data

I suppose I have a problem with query or... I dont know.
The query does not display all the text.
I dont have any error.
Please check my query. I can't fix it.
Maybe do you have idea?
Presumably, you have hit the maximum number of characters allowed by group_concat(), which is controlled by system variable group_concat_max_len. It defaults to 1 MB starting MariaDB 10.2.4, and 1K in earlier versions.
You can change the default setting for the current session with:
SET SESSION group_concat_max_len = 5000000; -- or whatever value you like
The maximum allowed value is 18446744073709551615.

mxnet: how to retrieve the number of example from the DataIter object?

After using the mx.io.ImageRecordIter() to load my training examples, is there a way to retrieve the total number of examples from the returned DataIter object ?
Many thanks,
Length of the iterator is unknown until you iterate through it.
You could iterate through and count the number of examples but depending on the data set size, this could be a time consuming operation.

How to modify data in a Text File in VB .NET

i have text file more than 2000 row like these:
10
21
13
...
and i want to find the avarge of the 1440 row ,start from down to up and find the max,then find the avarge for each 30 row and put them besid the data and find the max of these avarge like this
max(od data)=----
max(averge)=-----
While the question shows a lack of effort, I'll still give some basic guidelines to help your search.
Here are some things you are going to have to understand to tackle your problem:
1. How to handle text files in .NET
You can easily process files using the System.IO.File class. This class has several static methods that are very useful. (Static methods allow you to call the method without explicitly creating an object
System.IO.File Reference on MSDN
System.IO.File.ReadAllLines This method lets you read each line into an array
ReadAllLines is most useful when the file is short enough to read all at once. At 2000 rows this should not be a problem. If you had millions of rows you would have to look at how to work with something called streams (deal with data in small chunks)
2. How to convert a String to a number
The strings you read in with ReadAllLines aren't very useful as strings. You need to convert them to numbers to do math with them. And of course there is a class for that...
System.Int32.Parse Converts a string to a number, throws an exception for bad formats
System.Int32.TryParse Converts a string to a number, returns a default value on error
3. How to do a for loop in VB.NET
Any introductory tutorial should cover for loops, but here is one from MSDN
For Loops in VB.NET
4. How to do something every nth time through a loop
Use the modulus operator. This operator is like division, except that it returns the remainder. Every time the mod operation returns zero you have an exact multiple.
Example of using the Mod operator in VB.NET
5. How to find the max in a list of numbers
Have a variable to store the max value. Give it a value that is less than any value. Int32.MinValue is a safe value. Loop through every number. If it is larger than the max value, assign it to max value (it's the new max value). When you have processed every number max value contains the largest number you were able to find.
There are a few other details but if you can accomplish 1-5 you'll be able to ask a more specific question. This type of specific question will be better received by the stackoverflow community.
Happy coding.

How to distinguish in master data and calculated interpolated data?

I'm getting a bunch of vectors with datapoints for a fixed set of values, in the example below you see an example of a vector with a value per time point
1D:2
2D:
7D:5
1M:6
6M:6.5
But alas not for all the timepoints is a value available. All vectors are stored in a database and with a trigger we calcuate the missing values by interpolation, or possibly a more advanced algorithm. Somehow I want to be able to tell which data points have been calculated and which have been original delivered to us. Of course I can add a flag column to the table with values indicating whether the value was a master value or is calculated, but I'm wondering whether there is a more sophisticated way. We probably don't need to determine on a regular basis, so cpu cycles are not an issue for determining or insertion.
The example above shows some nice looking numbers but in reality it would look more somethin like 3.1415966533.
The database for storage is called oracle 10.
cheers.
Could you deactivate the trigger temporarily?