Message Boards Message Boards

0
|
7306 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Differential Evolution Step Sequence

Posted 10 years ago
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.
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
Attachments
Remove
or Discard

Group Abstract Group Abstract