Skip to main content
16-Pearl
June 18, 2018
Question

Minimize/Maximize a Monte Carlo

  • June 18, 2018
  • 2 replies
  • 3116 views

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.

 

2018-06-18_12-23-08.jpg

2 replies

23-Emerald I
June 18, 2018

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

23-Emerald IV
June 18, 2018

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:

LM_20180618_MonteCarlo.png

 

Success!
Luc

23-Emerald I
June 18, 2018

In 11 or 15.

 

That option is not available in Prime.  (Why would you ever want to control the algorithm?)

23-Emerald IV
June 18, 2018

@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