antonio6vieira Posted November 20, 2014 Share Posted November 20, 2014 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 More sharing options...
dsturrock Posted November 21, 2014 Share Posted November 21, 2014 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 More sharing options...
antonio6vieira Posted November 24, 2014 Author Share Posted November 24, 2014 Thanks! Worked like a charm Link to comment Share on other sites More sharing options...
antonio6vieira Posted December 5, 2014 Author Share Posted December 5, 2014 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 More sharing options...
dsturrock Posted December 11, 2014 Share Posted December 11, 2014 See SimBits: SelectEntityTypeFromTable and AppointmentArrivals. I think they will help. Link to comment Share on other sites More sharing options...
Recommended Posts