Message Boards Message Boards

Maximize function with constraints?

GROUPS:

Hello there,

I want to write a program, that maximizes a utility function where you have a starting capital and you can influence every period the amount of reinsurance. Now I want the Reinsurance to be optimized, but I just can reinsure a positive amount and also it needs to be less than my maximum loss. Which means I need to put in some constraints. When I do so, by telling the reinsurance should be >= 0 it only gives me positive Integer Values back. I want it to be possible for every real number in this range. Also it doesn't seem to work properly, because if I change some constants like the starting capital, the optimal reinsurance seems to stay the same. That shouldn't be the case.

Nutzenfkt[[LebendeInt + 1]]= Maximize[{Nutzenfkt[[LebendeInt+1]],RueckV>=0},{RueckV}];

So I got an entry that should just be maximized in terms of "RueckV". Also I thought about replacing "RueckV>=0" by

"Element[RueckV,Interval[0,LebendeInt]]"

, but then the code stops working, with the following Error message:

NMaximize::nnum: The function value {-100.} is not a number at {Subscript[RueckV$76554, 1]} = {0.}.

I plan to take this code to the master thesis, so that I think I can't make it public in full?

Thanks for your help Till

POSTED BY: Till Seifert
Answer
4 months ago

Group Abstract Group Abstract