simulation

How do I generate discrete random events with a Poisson distribution?

て烟熏妆下的殇ゞ 提交于 2019-12-03 13:03:15
I'm aware of Knuth's algorithm for generating random Poisson distributed numbers (below in Java) but how do I translate that into calling a method, generateEvent() , randomly over time? int poissonRandomNumber(int lambda) { double L = Math.exp(-lambda); int k = 0; double p = 1; do { k = k + 1; double u = Math.random(); p = p * u; } while (p > L); return k - 1; } Jay Elston If you are looking to simulate the inter-event arrival time, you want the exponential distribution. Take a look at Pseudorandom Number Generator - Exponential Distribution Your code would then look like this: // Note L == 1

agent-based simulation: performance issue: Python vs NetLogo & Repast

五迷三道 提交于 2019-12-03 09:21:26
问题 I'm replicating a small piece of Sugarscape agent simulation model in Python 3. I found the performance of my code is ~3 times slower than that of NetLogo. Is it likely the problem with my code, or can it be the inherent limitation of Python? Obviously, this is just a fragment of the code, but that's where Python spends two-thirds of the run-time. I hope if I wrote something really inefficient it might show up in this fragment: UP = (0, -1) RIGHT = (1, 0) DOWN = (0, 1) LEFT = (-1, 0) all

Jelly physics 3d

余生长醉 提交于 2019-12-03 09:14:06
I want to ask about jelly physics ( http://www.youtube.com/watch?v=I74rJFB_W1k ), where I can find some good place to start making things like that ? I want to make simulation of cars crash and I want use this jelly physics, but I can't find a lot about them. I don't want use existing physics engine, I want write my own :) Something like what you see in the video you linked to could be accomplished with a mass-spring system. However, as you vary the number of masses and springs, keeping your spring constants the same, you will get wildly varying results. In short, mass-spring systems are not

How to create a more efficient simulation loop for Monte Carlo in R

余生颓废 提交于 2019-12-03 08:37:51
The purpose of this exercise is to create a population distribution of nutrient intake values. There were repeated measures in the earlier data, these have been removed so each row is a unique person in the data frame. I have this code, which works quite well when tested with a small number of my data frame rows. For all 7135 rows, it is very slow. I tried to time it, but I crashed it out when the elapsed running time on my machine was 15 hours. The system.time results were Timing stopped at: 55625.08 2985.39 58673.87 . I would appreciate any comments on speeding up the simulation: Male.MC <-c

Using a subset of a SUMO scenario for OMNeT++ network simulation (with VEINS)

守給你的承諾、 提交于 2019-12-03 08:34:11
I'm trying to evaluate an application that runs on a vehicular network using OMNeT++, Veins and SUMO. Because the application relies on realistic traffic behavior, so I decided to use the LuST Scenario , which seems to be the state of the art for such data. However, I'd like to use specific parts of this scenario instead of the entire scenario (e.g., a high and a low traffic load fragment, perhaps others). It'd be nice to keep the bidirectional functionality that VEINS offers, although I'm mostly interested in getting traffic data from SUMO into my simulation. One obvious way to implement this

time-based simulation with actors model

筅森魡賤 提交于 2019-12-03 08:05:58
we have a single threaded application that simulates the interaction of a hundred of thousands of objects over time with the shared memory model. obviously, it suffers from its inability to scale over multi CPU hardware. after reading a little about agent based modeling and functional programming/actor model I was considering a rewrite with the message-passing paradigm. the idea is very simple - each object will be an actor and their interactions will be messages so that the simulation could happen in parallel. given a configuration of objects at a certain time - its future consequences can be

What are good libraries for creating a python program for (visually appealing) 3D physics simulations/visualizations?

做~自己de王妃 提交于 2019-12-03 07:57:37
What are good libraries for creating a python program for (visually appealing) 3D physics simulations/visualizations? I've looked at Vpython but the simulations I have seen look ugly, I want them to be visually appealing. It also looks like an old library. For 3D programming I've seen suggestions of using Panda3D and python-ogre but I'm not sure if it is really suited for exact simulations. Also, I would prefer a library that combines well with other libraries (E.g. pygame does not combine so well with other libraries). 3D support for python is fairly weak compared to other languages, but with

3D Engine for Driving Simulation [closed]

二次信任 提交于 2019-12-03 07:45:26
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. Is there any open-source 3D graphics and physics engine specialized in driving simulation? Something like a configurable game engine targeted at games that involve driving, or something more specialized to urban traffic conditions and that would implement scriptable traffic rules. Also, car motor parts and dashboard presentation would be a plus. Something with pre-made 3D car models that I can use for scenes. Try TORCS ,

Is Hadoop right for running my simulations?

旧街凉风 提交于 2019-12-03 07:12:19
问题 have written a stochastic simulation in Java, which loads data from a few CSV files on disk (totaling about 100MB) and writes results to another output file (not much data, just a boolean and a few numbers). There is also a parameters file, and for different parameters the distribution of simulation outputs would be expected to change. To determine the correct/best input parameters I need to run multiple simulations, across multiple input parameter configurations, and look at the

Is there any simulator/tool to generate messages for streaming?

感情迁移 提交于 2019-12-03 07:11:12
For testing purpose, I need to simulate client for generating 100,000 messages per second and send them to kafka topic. Is there any tool or way that can help me generate these random messages? There's a built-in tool for generating dummy load, located in bin/kafka-producer-perf-test.sh ( https://github.com/apache/kafka/blob/trunk/bin/kafka-producer-perf-test.sh ). You may refer to https://github.com/apache/kafka/blob/trunk/tools/src/main/java/org/apache/kafka/tools/ProducerPerformance.java#L106 to figure out how to use it. One usage example would be like that: bin/kafka-producer-perf-test.sh