Questions tagged [montecarlo]

Monte Carlo methods are stochastic (probabilistic) systems that use many random samples to derive properties of a complex system.

Monte Carlo methods are stochastic methods that use large sample sizes to gather information about a complex system. The outcomes of these trials can then be used to draw generalizations about the system as a whole, without first needing a proper solution.

Monte Carlo methods are especially useful when a numeric solution is available, but which is too complex to solve for directly. They are general enough that their use is widespread; Wikipedia provides a list too exhaustive to reproduce here.

1260 questions
43
votes
6 answers

Fixing set.seed for an entire session

I am using R to construct an agent based model with a monte carlo process. This means I got many functions that use a random engine of some kind. In order to get reproducible results, I must fix the seed. But, as far as I understand, I must set the…
Elad663
  • 783
  • 1
  • 5
  • 13
39
votes
7 answers

Random Number from Histogram

Suppose I create a histogram using scipy/numpy, so I have two arrays: one for the bin counts, and one for the bin edges. If I use the histogram to represent a probability distribution function, how can I efficiently generate random numbers from that…
xvtk
  • 1,030
  • 2
  • 10
  • 18
22
votes
3 answers

Monte Carlo Tree Searching UCT implementation

Can you explain me how to build the tree? I quite understood how the nodes are chosen, but a nicer explanation would really help me implementing this algorithm. I already have a board representing the game state, but I don't know (understand) how to…
Makers_F
  • 3,033
  • 4
  • 36
  • 51
18
votes
4 answers

Monte Carlo Tree Search: Implementation for Tic-Tac-Toe

Edit: Uploded the full source code if you want to see if you can get the AI to perform better: https://www.dropbox.com/s/ous72hidygbnqv6/MCTS_TTT.rar Edit: The search space is searched and moves resulting in losses are found. But moves resulting in…
MortenGR
  • 803
  • 1
  • 8
  • 22
16
votes
5 answers

Is Excel VBA's Rnd() really this bad?

I need a pseudo random number generator for 2D Monte Carlo simulation that doesn't have the characteristic hyperplanes that you get with simple LCGs. I tested the random number generator Rnd() in Excel 2013 using the following code (takes about 5…
XYZ
  • 163
  • 1
  • 6
16
votes
5 answers

Why use Monte-Carlo method?

When should the Monte-Carlo method be used? For example, why did Joel decide to use the Monte-Carlo method for Evidence Based Scheduling instead of methodically processing all user data for the past year?
Gili
  • 86,244
  • 97
  • 390
  • 689
15
votes
2 answers

Compare and Contrast Monte-Carlo Method and Evolutionary Algorithms

What's the relationship between the Monte-Carlo Method and Evolutionary Algorithms? On the face of it they seem to be unrelated simulation methods used to solve complex problems. Which kinds of problems is each best suited for? Can they solve the…
Gili
  • 86,244
  • 97
  • 390
  • 689
14
votes
2 answers

Implementation of sequential monte carlo method (particle filters)

I'm interested in the simple algorithm for particles filter given here: http://www.aiqus.com/upfiles/PFAlgo.png It seems very simple but I have no idea on how to do it practically. Any idea on how to implement it (just to better understand how it…
shn
  • 5,116
  • 9
  • 34
  • 62
13
votes
7 answers

Is there a C# library that will perform the Excel NORMINV function?

I'm running some Monte Carlo simulations and making extensive use of the Excel function NORM.INV using Office Interrop. This functions takes three arguments (probability, average, standard deviation) and returns the inverse of the cumulative…
Portman
  • 31,785
  • 25
  • 82
  • 101
13
votes
8 answers

Choosing random numbers efficiently

I have a method, which uses random samples to approximate a calculation. This method is called millions of times, so its very important that the process of choosing the random numbers is efficient. I'm not sure how fast javas Random().nextInt…
Frederik Wordenskjold
  • 10,031
  • 6
  • 38
  • 57
13
votes
1 answer

Python large iterations number fail

I wrote simple monte-carlo π calculation program in Python, using multiprocessing module. It works just fine, but when I pass 1E+10 iterations for each worker, some problem occur, and the result is wrong. I cant understand what is the problem,…
sashab
  • 1,534
  • 2
  • 19
  • 36
12
votes
2 answers

Why does Monte Carlo Tree Search reset Tree

I had a small but potentially stupid question about Monte Carlo Tree Search. I understand most of it but have been looking at some implementations and noticed that after the MCTS is run for a given state and a best move returned, the tree is thrown…
gowrath
  • 3,136
  • 2
  • 17
  • 32
12
votes
1 answer

Error in rep: invalide 'times' argument

When I try to run the following code for 10000 iterations I get the following error.Error in rep(G1[, 2], G1[, 3]) : invalid 'times' argument. So don't know how to change the code to fix that error. Basically just want to create time series for the…
kelamahim
  • 577
  • 1
  • 4
  • 21
12
votes
7 answers

Good book for Monte Carlo methods in c++?

Can anybody recommend a good introduction book on Monte Carlo algorithms in c++? Preferably with applications to physics, and even more preferably, the kind of physics being quantum mechanics. Thanks!
trolle3000
  • 1,067
  • 2
  • 14
  • 27
12
votes
3 answers

monte carlo simulation of protein structure and grid

I am working Monte Carlo simulation script over protein structure. I have never done before Monte Carlo scripting. I will extent this program at large scale. According to protein xyz coordinates I have to define the box size. This box will be…
awanit
  • 263
  • 1
  • 2
  • 11
1
2 3
83 84