Tell me more ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm running a NMaximize problem using NelderMead. For a reason I don't understand when I try to set different initial points using RandomSeed and I check this with the step monitor the initial vector is always the same. I don't know if this is a problem with the number of parameters I'm looking for because I tried fixing n-1 parameters finding that the RandomSeed was working properly. Does anyone now if RamdonSeed has some constraints (like dimensionality)?

This is the last part of my code:

seed = RandomInteger[{0, 1000}];
resultMax = 
  NMaximize[
   objFunctionUnique[0.582667, 0.000026, 0.000084, b0, b1, b2, b3, b4,
     b5, b6, b7, b8, b9, b10, b11, 0, yT2002, yT2003, yT2004, yT2005, 
    yT2006, yT2007, yT2008, 0, 1, a1, a2, a3, a4, a5, 0, a7, a8, a9, 
    a10, a11, 0, a13, yP2002, yP2003, yP2004, yP2005, yP2006, yP2007, 
    yP2008, yP2009],
   {b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, yT2002, yT2003, 
    yT2004, yT2005, yT2006, yT2007, yT2008, a1, a2, a3, a4, a5, a7, 
    a8, a9, a10, a11, a13, yP2002, yP2003, yP2004, yP2005, yP2006, 
    yP2007, yP2008, yP2009}, 
   Method -> {"NelderMead", "RandomSeed" -> seed}, 
   MaxIterations -> 10000, WorkingPrecision -> 5, 
   StepMonitor :> 
    Print[{seed, 
      objFunctionUnique[0.582667, 0.000026, 0.000084, b0, b1, b2, b3, 
       b4, b5, b6, b7, b8, b9, b10, b11, 0, yT2002, yT2003, yT2004, 
       yT2005, yT2006, yT2007, yT2008, 0, 1, a1, a2, a3, a4, a5, 0, 
       a7, a8, a9, a10, a11, 0, a13, yP2002, yP2003, yP2004, yP2005, 
       yP2006, yP2007, yP2008, yP2009], {b0, b1, b2, b3, b4, b5, b6, 
       b7, b8, b9, b10, b11, yT2002, yT2003, yT2004, yT2005, yT2006, 
       yT2007, yT2008, a1, a2, a3, a4, a5, a7, a8, a9, a10, a11, a13, 
       yP2002, yP2003, yP2004, yP2005, yP2006, yP2007, yP2008, 
       yP2009}}]
];
share|improve this question
3  
please try to post "minimal and self-contained" pieces of code – belisarius Feb 6 at 18:53
belisarius is correct; as it stands this is "not a real question" and will be closed as such unless it is improved. – Mr.Wizard Feb 6 at 19:16
Can't reproduce this. Tried with this modified version of your code that has the advantage that it actually runs, contrary to your example: seed = RandomInteger[{0, 1000}]; f = Sin[Sum[Random[] a[i], {i, 10}]]; resultMax = NMaximize[f, Array[a, 100], Method -> {"NelderMead", "RandomSeed" -> seed}, MaxIterations -> 10000, WorkingPrecision -> 5, StepMonitor :> Print[{seed, f, Array[a, 100]}]] – Sjoerd C. de Vries Feb 6 at 20:45
Question: is seed = RandomInteger[{0, 1000}]; in a separate cell from resultMax = ...? – rcollyer Feb 7 at 3:14

closed as too localized by belisarius, Ajasja, Sjoerd C. de Vries, Szabolcs, 0x4A4D Feb 7 at 4:00

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.