Group Abstract Group Abstract

Message Boards Message Boards

0
|
11 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Simple Optimization does not provide answer

Posted 5 hours ago

Hi, I am first time Mathematica user. I use Chatgpt to help me generate codes for a simple optimizaiton problem in investment. But Mathematica does not provide any solution nor does it show any error message. I am not sure what is going on. Here is the code:

ClearAll[miu1,miu2,sig11,sig,sig,sig22,miut,w1,w2]
miu = {miu1,miu2};
sigma = {{sig11,sig},{sig,sig22}};
w = {w1,w2};
constraints = {w1+w2==1,miu.w<=miut};
varianceExpr =w.sigma.w;
Minimize[{varianceExpr,constraints},{w1,w2}, Reals]

Thanks!

POSTED BY: Charles He

"Mathematica does not provide any solution" -- For me, it runs for a long, long time, and I get impatient and kill it. But it might have provided an answer, if I would be more patient. What happens to you?

The problem has six generic parameters. Personally, I would not characterize it as a simple problem.

If I plug in numeric values for the parameters, I get a range of different kinds of answers. This also makes the problem not seem simple to me. Probably Mathematica is just taking time to work out all the cases when the six parameters are generic.

On my machine, the following code shows that Mathematica memory usage is increasing at a rate greater than 10MB per second. It's working hard at it. Maybe it will solve it, but I think I'm going to run out of memory first. I also expect the answer to be gigabytes or larger. What would I do with such an answer.

Quit[]

MaxMemoryUsed[]
Dynamic@{MaxMemoryUsed[], Clock@Infinity}
ClearAll[miu1, miu2, sig11, sig, sig, sig22, miut, w1, w2];
miu = {miu1, miu2};
sigma = {{sig11, sig}, {sig, sig22}};
w = {w1, w2};
constraints = {w1 + w2 == 1, miu . w <= miut};
varianceExpr = w . sigma . w;
Minimize[{varianceExpr, constraints}, {w1, w2}]

It's now over 4GB. Time to kill it before it starts to thrash my swap space.

POSTED BY: Michael Rogers
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard