simulation

overlapping and fixing x-scales in facet (scale=“free”) in order to make a film

梦想与她 提交于 2020-01-23 13:26:25
问题 With the help of @Justin on another post, I plotted simulation result with the facet_grid option in ggplot2. The post with data and answer is here: Use facet_grid option to plot column of dataframe with ggplot2 Here a copy of original sample data with added information about scale_x min and max values for each parameter type : dat <- read.table(textConnection("P1 P2 P3 P4 R 1 2e-5 1.0 0.6 3 1 2 4e-6 1.5 0.7 1.5 2 3 6e-7 1.2 0.6 2.5 3 4 8e-8 1.45 0.65 3.2 4 ")) scalx <- read.table

Event-driven simulation class

折月煮酒 提交于 2020-01-22 12:56:09
问题 I am working through some of the exercises in The C++ Programming Language by Bjarne Stroustrup. I am confused by problem 11 at the end of Chapter 12: (*5) Design and implement a library for writing event-driven simulations. Hint: <task.h>. ... An object of class task should be able to save its state and to have that state restored so that it can operate as a coroutine. Specific tasks can be defined as objects of classes derived from task. The program to be executed by a task might be defined

Plotting columns from a matrix in R

安稳与你 提交于 2020-01-15 18:48:47
问题 I've created a matrix of values from a simulation that is stored in 20x7 matrix (20 observations across 7 columns of numbers; the matrix is called output). The columns are output from a simulation. After running the simulation, I included column names: colnames(output) <- c('level', 'value1','value2','value3', 'value4','value5','value6') And the matrix looks nice and clean. when observing: output Is there a way to plot these columns from the matrix? I've tried the code below (and other

Plotting columns from a matrix in R

こ雲淡風輕ζ 提交于 2020-01-15 18:48:44
问题 I've created a matrix of values from a simulation that is stored in 20x7 matrix (20 observations across 7 columns of numbers; the matrix is called output). The columns are output from a simulation. After running the simulation, I included column names: colnames(output) <- c('level', 'value1','value2','value3', 'value4','value5','value6') And the matrix looks nice and clean. when observing: output Is there a way to plot these columns from the matrix? I've tried the code below (and other

Algorithms for optimal student seating arrangements

吃可爱长大的小学妹 提交于 2020-01-15 06:28:08
问题 Say I need to place n=30 students into groups of between 2 and 6, and I collect the following preference data from each student: Student Name: Tom Likes to sit with: Jimi, Eric Doesn't like to sit with: John, Paul, Ringo, George It's implied that they're neutral about any other student in the overall class that they haven't mentioned. How might I best run a large number of simulations of many different/random grouping arrangements, to be able to determine a score for each arrangement, through

Simulating correlated Bernoulli data

删除回忆录丶 提交于 2020-01-15 06:27:28
问题 I want to simulate 100 data with 5 columns. I want to get a correlation of 0.5 between the columns. To complete it, I have done the following action F1 <- matrix( c(1, .5, .5, .5,.5, .5, 1, .5, .5,.5, .5, .5, 1, .5,.5, .5, .5, .5, 1,.5, .5, .5, .5, .5,1 ), 5,5) To simulate the intended data frame, I have done this, but it does not work properly. df2 <- as.data.frame (rbinom(100, 1,.5),ncol(5), F1) 回答1: I'm surprised this isn't a duplicate (this question refers specifically to non-binary

Selecting proper toolkit for a 2D simulation project in Java

十年热恋 提交于 2020-01-15 06:18:33
问题 I am looking for a toolkit that will allow me to design widgets containing 2D graphics for an elevator simulation in Java. Once created, those widgets will be integrated with SWT, Swing, or QtJambi framework. Background information: I am developing an Elevator Simulator for fun. My main goal is to increase my knowledge of Java, Eclipse IDE, and more importantly concurrency. It is certainly fun and I enjoyed implementing this State Machine Pattern. Anyway, I am at a point where I would like to

Deep class inheritance hierarchy — bad idea?

为君一笑 提交于 2020-01-14 09:33:08
问题 hoping a grandmaster can shed some light. Very high overview is that I am no beginner to coding, but still new to OOP. This set of message classes is at the heart of a large simulation application we're writing, and I don't want to do it stupidly--this interface cuts the application in half, from sequencer to executer and vice-versa. My question is whether or not it's a bad idea to have an inheritance hierarchy this deep (image is not yet fleshed out, might go 5 or 6 deep in the end). This is

How does Simulink simulation engine work?

▼魔方 西西 提交于 2020-01-14 07:39:09
问题 I would like to understand how Simulink simulation engine works. Does it use a discrete event simulation mecanism (then how continous time is handled ?) ? Does it rely on a static cycle-based code generation ? Or ? 回答1: Before the first cycle, it figures out the order of execution of the blocks (starting with the ones that don't require inputs from any other blocks) Each cycle, it calculates the output of each block based on the inputs and the block's code. Each block's code is static, it

Matlab Parallel Computing with Simulink Model

那年仲夏 提交于 2020-01-13 06:31:27
问题 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;