Jump to content

create entities based on probability


antonio6vieira

Recommended Posts

Hi guys.


So, in my model, I have a table (binded to an excel file) with 2 columns - 1 indicates the real number that I want to assign to the state of an entity and the other indicates the probability of that assignment being made.


So, I want to assign the values specified on the table, based on the probability also specified...


Can anyone give me some hints on how to do this? Thanks.

Link to comment
Share on other sites

What your subject line asked is covered exactly in a SimBit. What your message asked for is slightly different, so I'll answer that here.


One way, if you have a fixed number of rows is to explicitly reference the table data in a distribution. For example

Random.Discrete(Table1[1].CumProb, Table1[1].Value, Table1[2].CumProb, ...)


Probably the easiest and most flexible way is to use the built-in RandomRow function in an expression like this:

Table1[Table1.Weight.RandomRow].Value

This uses a column named Weight to select a row, then goes to that row to return the value from another column named Value.


Here is an example (done in 7.114):AssignmentFromTableBasedOnRandomRow.spfx

Link to comment
Share on other sites

  • 2 weeks later...

Due to some late demands now instead of creating entities based on a probability, I also have to allow the model to create entities based on a schedule. So, I am importing an excel table that has a column, with the time to create, and another column, with the value to assign to the entity.


I am already able to create entities based on the datas imported from excel, but I don't know how to assign the value of the remaining row of the table to the created entity... Can somebody help me on how to do this?


Thanks!

Link to comment
Share on other sites

×
×
  • Create New...