Different parameters value in .ini file for different runs - omnet++

How can I have different parameters value defined in .ini file for each repeat in omnet using cmdenv? I have repeat value as 4 and trying to have different value of accidentStart and accidentDuration.

You can't. And shouldn't. The whole point of repetition is that all parameters have the same value, just the RNGs are seeded differently. So you get a different sample of the same distribution for every result value.
What you're looking for are iteration variables.
Something like this:
**.accidentStart = ${100, 200, 350}s
This will generate 3 runs without repetition, and 12 runs with repeat=4.
and if you add
**.accidentDuration = ${duration=300, 450, 600..1800 step 600}s
this will multiply the number of runs by another factor of 5.
By default, iteration variables produce a Cartesian product of their respective assigned sets of values. But there are ways to change this, consult the manual for how.

Related

how to validate a random variable in jmeter, if it is unique or not for requests

Here I want to generate a random 9 digit number, I have achieved it using a config element->Random Variable.
Now I need to check if that number is unique or not, so for that, I have used If the controller and passed a condition checking the previous response message is true or false, if the output is false, then it will again generate a Random variable and this time a newly generated will be passed onto it.
But till how many times I will check this using If controller, so needs an alternative solution for the same.
Below is the hierarchy of my test plan:
Random variable
Sampler HTTP Request(Here random variable is passed)
If Controller(Condition: ${JMeterThread.last_sample_ok}==false)
Random Variable generated again
Sampler HTTP Request(Here random variable is passed)
If you need to generate a random number there is no need to "validate" it
If you need to generate an unique number the number has to be sequential
You can generate sequential numbers using Counter configuration element which should be set up like this:
once done you can refer the generated value as ${number} where required
More information:
What is mathematical difference between "random" and "unique"?
How to Use a Counter in a JMeter Test

Can I set a filter condition on Visual Studio 2013's Watch Window

My program has very large matrices but most of the elements tend to be zero. Is there a way to set in the watch window something like the following for a 50x10000x2 matrix variable called tau_bcst:
Name Value
tau_bcst.ge.0 {...}
Such that in watch, it will only show the elements greater than zero. Something like the following:
Name Value
tau_bcst(1,4,1) 3
tau_bcst(10,2000,1) 3
tau_bcst(11,2000,1) 3
tau_bcst(49,2910,2) 3
tau_bcst(21,8930,2) 3
I know it can take some mathematical equations and calculate a value with the variables, so I am wondering if it can do this as well. I tried several ways but it doesn't seem to work.
I would gladly use a simple filter code to check the variable (return 1 if the values are non-zero, for example), except that I have many variables that I want to check at potentially multiple points in the code against another run of the code in another Visual Studio window so that won't be very efficient.

Random values in tensorflow

I want to generate random numbers within an activation function such that every time the activation function is called a random number is generated. I tried with random.uniform and with tf.random_uniform but it only generates a single random value when it's compiled and it doesn't change anymore. How can I make it update every time?
Funny fact:
When I create a variable using tf.Variable(random.uniform(1,2)) every time the function it's called the value is slightly larger, for instance:
1.22069513798
1.22072458267
1.22075247765
1.22077202797
Edit:
The function is very simple
Function:
def activation(tensor):
alpha = tf.Variable(random.uniform(1,2))
return alpha*tensor,alpha
I will omit all the lines in the neural network, but I simply call it as:
act,alpha = activation(dense_layer+bias)
I later get the value by simply:
[ts,c,alph]=sess.run([train_step,cost,alpha], feed_dict={xi: x_raw, yi: y_raw})
Thanks
Hard to tell without source code, but maybe you are initializing your variable with that random value and reusing same value?
Another possibility:

SPSS- assigning mulitple numeric codes to one variable

I am trying to assign multiple codes to existing variables. I am using the syntax below, but it will only assign the first code entered for that hosp.id.number.
Syntax example:
Do if (hosp.id.number=9037) or (hosp.id.number=1058) or (hosp.id.number=11256).
Compute role_EM_communication=10.
Else if (hosp.id.number=9037.
Compute role_EM_communication=11.
End if.
Execute.
hosp.id.number needs to be coded 10 and 11, but it will only code it at 10. Anyway to rephrase so that SPSS will accept 2 or more codes for a variable such as hosp.id.number?
Your role_EM_communication variable is a single variable, but from what you are saying, I think you need it to be a set (for the same record, it could take on more than just one code). So you need to create n variables named role_EM_communication_1 to role_EM_communication_n, where n is the maximum number of codes you estimate will be possible for one record.
For your example, it would translate like this:
create the 2 variables:
vector role_EM_communication_ (2, f2.0).
do the first recode:
if any(hosp.id.number,9037,1058,11256) role_EM_communication_1=10.
very important - execute the recode
exe.
check if the first variable has data, and populate the second variable if true:
if miss(role_EM_communication_1) and any(hosp.id.number,9037) role_EM_communication_1=11.
if ~miss(role_EM_communication_1) and any(hosp.id.number,9037) role_EM_communication_2=11.
exe.

Stata rnormal()

I want to generate a fixed random variable ~N(0,10) for every observation for future computation.
gen X=rnormal (0,10)
list X
Blank
How can I see what value of X is being generated?
You were probably using an empty dataset when you issued these commands. In that case you would first need to tell Stata how many observations your dataset contains. For that you need to use the set obs command, so something like:
. set seed 12345
. set obs 10
obs was 0, now 10
. gen x = rnormal(0,10)
. list, clean
x
1. -9.580833
2. -2.907274
3. 8.45202
4. 8.617108
5. -12.19151
6. 9.457337
7. 1.722469
8. -13.29949
9. -11.5291
10. 25.1646
Think of what would happen when you did not use set obs. In that case Stata would see gen x = rnormal(0,10) and think "ok, I need to create random draws from a normal distribution, but how many?". If you had a dataset open, then it would answer "as many as there are observations in the dataset". If you had no dataset open, then the answer would still be "as many as there are observations in the dataset", but that happens to be 0.
Edit:
If you just want one number you are best of using scalars and not variables. In Stata a scalar refers to a single number and a variable refers to a single column in your dataset. For scalars it is best to use temporary names, as they share the same namespace as variables but variables take precedence when it comes to abreviations, which can lead to unexpected behaviour. So you could do something like:
. tempname a
. scalar `a' = rnormal(0,10)
. di `a'
10.737423

Resources