Message Boards Message Boards

2 Replies
2 Total Likes
View groups...
Share this post:

Differential Evolution Step Sequence

Posted 10 years ago

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:
 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 *)

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!

POSTED BY: Priyan Fernando
2 Replies
x2 and x3 were eliminated using the linear equality constraints, so they don't show up in the StepMonitor.
POSTED BY: Brett Champion
Posted 10 years ago
That makes perfect sense! Thanks Brett!
POSTED BY: Priyan Fernando
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract