cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

SOLVED
Visitor

## Maximize Function: MC 15

All --

Any ideas on why the attached sheet bombs? The error is (of course) "This variable is undefined", but I have been using MC long enough now to know that when you get that error in a solve block the absolute last thing that is likely wrong is that you have an undefined variable. I note that if I remove two of the conditions in the solve block, it works. Maybe this means there is no convergence?

Matt

1 ACCEPTED SOLUTION

Accepted Solutions

## Re: Maximize Function: MC 15

OK, I'm an idiot. Worksheet (below) now works correctly (I think). Putting it in to production mode to look for remaining issues. Thanks, all.

18 REPLIES 18

## Re: Maximize Function: MC 15

1. The vector p is a constant.

## Re: Maximize Function: MC 15

Valery -- thanks for the reply.However, I'm not sure that I follow you. I provide guess values for p that are constant, but the vector values are, themselves, the parameters being optimized in the solve block. As for plotting the function H(p), that doesn't make sense. H takes the vector p as input and provides a scalar output. I'm not exactly sure what you would like for me to plot.

Matt

## Re: Maximize Function: MC 15

Moe, if You would like to find a maximum of a function with one argument You can plot this function and see this maximum.

I think so.

## Re: Maximize Function: MC 15

But the one argument is actually a vector of (in this case) 28 values.

## Re: Maximize Function: MC 15

 Moe Szyslak wrote:But the one argument is actually a vector of (in this case) 28 values.

Ok,

Can you calculate the value of this function in one point?

## Re: Maximize Function: MC 15

Sure. What point? It can be calculated for any vector p.

## Re: Maximize Function: MC 15

The solve block given-find needs a guess value. Can you calculate the value of your function with this guess value?

## Re: Maximize Function: MC 15

May be so - see the attach.

## Re: Maximize Function: MC 15

Valery -- thanks, but that doesn't do it. I, too, found that if I remove one of the constraints the solve block executes. However, this changes the nature of the problem. The vector p is a vector of probabilities and, as such, needs to sum identically to 1. In your attached sheet, I note that it sums to 1.005. If you're tempted to say "close enough", just change the value of mu_p from 0.4 to 0.5 and you'll find that the sum of the vector p is much greater than 1.

I note that I solved this problem in Excel, so I know that there is an optimal solution that satisfies all constraints.

Announcements