Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
I'd like to use maximize or minimize in combination with a Monte Carlo analysis. I made a simple model, and it works. Usually. However, sometimes it returns something right around my guess value. I'm thinking I'm at the mercy of the numerics of the solve block. It takes a small step in one direction, the unlucky monte carlo says it's the wrong direction and it never goes that way again. Anyone have any tricks that would help it converge to the proper solution more often?
Attached example is pretty simple. It's random points thrown in a square with a circle at the center. It changes the size of the circle to max/min the number of points inside. So, it should solve either R=1 for maximize or R=0.5 for minimize (per the constraints). I get the correct answer about 80% of the time, but I get the guess value the remainder. I understand that a monte carlo is never perfect, but I was not expected this many wrong answers. Doesn't seem to improve with a large number of random points either. 4.0 attached.
Might be the result of a really sucky runif function. Guess values closer to the minimum bound tend to fare better giving correct answers. . .
Attached 3.0 file
If you set the properties of the minimize/maximize function from nonlinear to linear, it finds the correct answer always, irrespective of the guess value:
Success!
Luc
In 11 or 15.
That option is not available in Prime. (Why would you ever want to control the algorithm?)
@Fred_Kohlhepp wrote:
In 11 or 15.
That option is not available in Prime. (Why would you ever want to control the algorithm?)
Because everything that goes automatically, can (also) go automatically wrong...
Luc
@LucMeekes wrote:
@Fred_Kohlhepp wrote:
In 11 or 15.
That option is not available in Prime. (Why would you ever want to control the algorithm?)
Because everything that goes automatically, can (also) go automatically wrong...
Luc
I guess Freds remark should be take as irony.
Otherwise I can only confirm Lucs observations - the effect is the same in MC15.
I am not sure, though, if its not only the nature of this simplified model which makes it work OK with linear approach and if this really would be a solution for more complex Monte Carlo simulations.
In the long run we get a percentage of approx. 70 % for max and for min as well and it seems that changing the values of TOL or CTOL don't has much effect (if any). Changing N from 500 to 2500 makes it a little better (up to 80%)