simulation

Improving a numpy implementation of a simple spring network

岁酱吖の 提交于 2019-12-05 08:08:12
问题 I wanted a very simple spring system written in numpy. The system would be defined as a simple network of knots , linked by links . I'm not interested in evaluating the system over time, but instead I want to go from an initial state, change a variable (usually move a knot to a new position) and solve the system until it reaches a stable state (last applied force is below a given threshold). The knots have no mass, there's no gravity, the forces are all derived from each link's current

Sweep Line Algorithm - Implementation for 1D plane

老子叫甜甜 提交于 2019-12-05 06:03:50
问题 The problem is simple, There is some given 1D lines on a plane. We need to find the total size of space having at least one line. Let me discuss this with an example image- This may a case . Or This may be a case or anything like this. I know it is a basic problem of Sweep Line Algorithm. But there is no proper document in the internet for it to understand properly. The one best I have is a blog of Top Coder and that is here. But it is not clear how to implement it or how may be the

Is a functional language a good choice for a Flight Simulator? How about Lisp?

℡╲_俬逩灬. 提交于 2019-12-05 00:55:18
I have been doing object-oriented programming for a few years now, and I have not done much functional programming. I have an interest in flight simulators, and am curious about the functional programming aspect of Lisp. Flight simulators or any other real world simulator makes sense to me in an object-oriented paradigm. Here are my questions: Is object oriented the best way to represent a real world simulation domain? I know that Common Lisp has CLOS (OO for lisp), but my question is really about writing a flight simulator in a functional language. So if you were going to write it in Lisp,

Collision Detection between Accelerating Spheres

南笙酒味 提交于 2019-12-04 22:58:42
问题 I am writing a physics engine/simulator which incorporates 3D space flight, planetary/stellar gravitation, ship thrust and relativistic effects. So far, it is going very well, however, one thing that I need help with is the math of the collision detection algorithm. The iterative simulation of movement that I am using is basically as follows: (Note: 3D Vectors are ALL CAPS.) For each obj obj.ACC = Sum(all acceleration influences) obj.POS = obj.POS + (obj.VEL * dT) + (obj.ACC * dT^2)/2 (*EQ.2*

Visual Programming Language Control

房东的猫 提交于 2019-12-04 22:24:47
问题 Is there a .NET based (WinForm or WPF) control that allows simple visual programming (assignments, boolean expressions, and math expressions)? Something like Microsoft VPL, only embeddable and supported. 回答1: There is a new open source library out there: TUM.CMS.VPLControl. Get it here. 来源: https://stackoverflow.com/questions/4269439/visual-programming-language-control

Matlab Parallel Computing with Simulink Model

老子叫甜甜 提交于 2019-12-04 17:09:35
I'm working on a project in which parallel computing would be a huge advantage. The project simulates multiple Simulink models. I did the simulation with a normal for-Loop, but since it takes days to simulate I decided to try the "parfor"-Loop . But that's where the problem begins. First I'll give you pictures of my code, the workspace and the Simulink-part which is causing me problems: Here's my code: apool = gcp('nocreate'); if isempty(apool) apool = parpool('local'); end wpath = pwd; parfor k = 1:number_of_models load_system(strcat(wpath,'\Models_Folder\',House(k).model_name)); set_param

R - simulate data for probability density distribution obtained from kernel density estimate

馋奶兔 提交于 2019-12-04 14:53:31
First off, I'm not entirely sure if this is the correct place to be posting this, as perhaps it should go in a more statistics-focussed forum. However, as I'm planning to implement this with R, I figured it would be best to post it here. Please apologise if I'm wrong. So, what I'm trying to do is the following. I want to simulate data for a total of 250.000 observations, assigning a continuous (non-integer) value in line with a kernel density estimate derived from empirical data (discrete), with original values ranging from -5 to +5. Here's a plot of the distribution I want to use. It's quite

numpy positive semi-definite warning

浪尽此生 提交于 2019-12-04 13:44:27
In a Python script I'm writing I am simulating multivariate normal random vectors with the expression np.random.multivariate_normal(np.zeros(dim_obs), y_cov) My script runs, but generates the following warning: RuntimeWarning: covariance is not positive-semidefinite. Also the little debug print statements I throw in there print False most of the time print( np.all(np.linalg.eigvals(y_cov) > 0) ) Why is this throwing false positives? My y_cov is positive semi-definite because it is (sorry about the lack of TeX markup) B x x'B' + y y' where the B is a matrix, and the others are random vectors

Howto design a clock driven multi-agent simulation

筅森魡賤 提交于 2019-12-04 13:00:41
I want to create a multi-agent simulation model for a real word manufacturing process to evaluate some dispatching rules. The simulation needs to produce event logs to evaluate time effect of the dispatching rules compared to the real manufacturing event logs. How can I incorporate the 'current simulation time' into this kind of multi-agent, message passing intensive simulation? Background: The classical discrete event simulation (which handles the time-advancement nicely) cannot be applied here, as the agents in the system represent relatively complex behavior and routing requirements plus

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

陌路散爱 提交于 2019-12-04 11:28:48
问题 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? 回答1: 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