Differential Evolution Step Sequence

Hi!

I am try to run a portfolio optimization using the Differential Evolution method. The optimization runs, but there seems to be some problem in the output, when I store the steps used. My sample code is:

SeedRandom[1234]

numShares= 5; (*number of shares *)
allData = RandomReal[{-0.01,0.01},{10,numShares}];   (* create random share returns matrix *)

returnsVector =Mean[allData];   (* vector of average share returns *)
varianceMatrix = Covariance[allData ];  (*covariance matrix *)
variables=Table[Subscript[x, i],{i,1,numShares}]; (*list of variables *)

Opt = NMinimize[{variables . varianceMatrix . variables, Dot[variables, returnsVector] == Mean[returnsVector],  (Plus @@ variables) == 1,And @@ (LessEqual[0,#,1]& /@ variables)},variables] (* default optimization *)

Clear[deSteps];
deSteps= Reap[NMinimize[{variables . varianceMatrix . variables, Dot[variables, returnsVector] ==  Mean[returnsVector],  (Plus @@ variables) == 1,And @@ (LessEqual[0,#,1]& /@ variables)},variables, Method->"DifferentialEvolution", StepMonitor :>Sow[variables]]] 

When I examine deSteps, I see something like:


I am wondering why the values for x2, x3 are not displayed? (See second line and after, of the Output). I want to see these values, so I can examine the step sequence used in the Differential Evolution optimization process. Thanks for any help!

Priyan.

x2 and x3 were eliminated using the linear equality constraints, so they don’t show up in the StepMonitor.

That makes perfect sense! Thanks Brett!