Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am using NMaximize as following code.

NMinimize[{x[1] + x[1]^RandomVariate[NormalDistribution[1, 30]] + 
x[2] + x[3] + x[4] + x[5] + 
RandomVariate[NormalDistribution[5, 3]] x[5], 
RandomVariate[NormalDistribution[5, 3]]*x[1] + x[2] > 3 && 
x[3] > 1 && x[4] > 0 && x[5] > 0 && x[1] <= 1 && x[2] <= 8 && 
x[3] <= 1 && x[4] <= 1 && x[5] <= 2}, {x[1], x[2], x[3], x[4], 
x[5]}]

I want to variate random variables for 100 times and capture the optimized data including the maximized function values and all variables for each time.What will be the best way to capture them? of course the situation there is no answer and also unboundedness have to be taken into the account.

share|improve this question
2  
In your problem, at a max., one always has x[1] == x[3] == x[4] == 1; and x[2] == 8 or there is no max (according as the RandomVariate is > -1 or not). The only really interesting behavior is for x[5], provided the RandomVariate is less than 0.255639, which happens for less than 6% of the variates. –  Michael E2 Jul 9 '13 at 23:15
    
@MichaelE2 That isn't fair. Thinking should be avoided in this kind of problems –  belisarius Jul 10 '13 at 0:00
    
@MichaelE2 I was joking ... :) –  belisarius Jul 10 '13 at 0:03
    
@belisarius I edited the code .Actually I didn't want a lot agitation in this cause now there are many cases of unboundedness and .......Can we also capture them and show? –  Alex Jul 10 '13 at 2:31
1  
Not really, no. A numerical minimizer can prove (in some sense) that there exists a minimum by finding it. It cannot prove that one does not exist. For that you need a different approach. By the way, please delete your obsolete comments yourself rather than making one of our moderators do it for you. –  Oleksandr R. Jul 10 '13 at 3:16

1 Answer 1

up vote 3 down vote accepted

Like this?

NMaximize[{x[1] + x[1]^2 + #[[1]] x[2] + 2 Sin[Sin[x[3]]] + x[4] + 
     Sin[Sin[x[5]]] + Sin[x[1]] + x[2] + Sin[x[3]] + 
     x[4] + #[[2]] x[5], 
    x[1] > 0 && x[2] > 3 && x[3] > 1 && x[4] > 0 && x[5] > 0 && 
     x[1] <= 1 && x[2] <= 8 && x[3] <= 1 && x[4] <= 1 && 
     x[5] <= 2}, {x[1], x[2], x[3], x[4], x[5]}] & /@ 
 Transpose@{RandomVariate[NormalDistribution[1, 30], 10], 
            RandomVariate[NormalDistribution[5, 3],  10]}

(*
{{81.9943, {x[1] -> 1., x[2] -> 8., x[3] -> 1., x[4] -> 1., x[5] -> 2.}},  
 {54.3253, {x[1] -> 1., x[2] -> 8., x[3] -> 1., x[4] -> 1., x[5] -> 1.41357}}, 
 {19.4185, {x[1] -> 1., x[2] -> 3., x[3] -> 1., x[4] -> 1., x[5] -> 2.}}, 
  .....
*)
share|improve this answer
    
thanks.yes thats what I want actually regardless of how the answers going to behave. –  Alex Jul 10 '13 at 2:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.