How to use linprog to maximize

6 views (last 30 days)
ALI KARACA
ALI KARACA on 20 Nov 2019
Answered: Shaunak on 10 Jun 2025
I am trying to maximiza :
expected insurance profit: p - πX where p is premium, π is probability (0,1) and X (cover)amount of monet has been paid by insurance firm to consumer for loss
W1 = Wo - e - p (no loss) where e is effort of consumer to avoid from accident and Wo initial wealth of consumer
W2 = Wo - e - p - l + X (with loss) where l is loss of consumer and U(W)=ln(W)
subject to (expected utility of consumer) : (1-π)U(W1)+πU(W2)
(1-π)U(Wo - e - p) + (π)U( Wo - e - p - l + X) ≤ Uh where U means utility and Uh is the highest utility consumer can get.
How I can write this maximization problem in matlab?
Thank you

Answers (1)

Shaunak
Shaunak on 10 Jun 2025
It is my understanding that you want to solve an insurance profit maximization problem with consumer utility constraints in MATLAB.
You cannot use 'linprog' for this problem because the constraint contains logarithmic utility functions, making it nonlinear. The function 'linprog' only handles linear programming problems where all constraints must be of the form Ax ≤ b.
However, you can use MATLAB's 'fmincon' function for constrained nonlinear optimization. Since 'fmincon' minimizes functions, you need to negate your profit function for maximization as shown below:
% Objective: maximize p - π*X (negative for minimization)
objective = @(x) -(x(1) - pi * x(2));
You can now minimize the function using 'fmincon'. For further reference on maximizing with 'fmincon' to find the maximum profit, refer to this MATLAB Answers thread: https://www.mathworks.com/matlabcentral/answers/866545-maximize-objective-function-using-fmincon-with-a-limit
For more information on the 'fmincon' function, please refer to the MathWorks documentation of 'fmincon' function linked below: https://www.mathworks.com/help/optim/ug/fmincon.html
Hope this helps!

Categories

Find more on File Operations in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!