Skip to content

Instantly share code, notes, and snippets.

@trialsolution
Created November 2, 2012 12:19
Show Gist options
  • Save trialsolution/4001002 to your computer and use it in GitHub Desktop.
Save trialsolution/4001002 to your computer and use it in GitHub Desktop.
utility maximization on the EV frontier
$ontext
PROBLEM STATMENT
EV analysis from Hazell-Norton
ctnd. from ev.gms
Extension: find the optimal farm decision based on EUH; having the EV-frontier and assuming a utility function
3 sub-cases:
- risk averse
- risk neutral
- risk loving
$offtext
* --- data input
scalar intercept, slope;
execute_load "fit.gdx", intercept, slope;
display slope, intercept;
scalar r "absolute risk aversion [Arrow Pratt]";
scalar LP_solution "total returns at the LP solution point [upper bound]" /77216/;
positive variable totM "total returns [at the margin]";
variable totV "total variance";
variable utility "utility points of farmer";
equation
U_ "utility funciton of the farmer"
EV_ "we are at the ev frontier"
maxtotM_ "maximum returns [where the frontier ends]"
;
U_.. utility =e= totM/1000 + r * (totM/1000) * (totM/1000)
+ r * (totV/1000) ;
EV_.. totV/1000 =e= (slope*totM + intercept)/1000;
maxtotM_ .. totM =l= LP_solution;
model decision /U_, EV_, maxtotM_/;
* --- set to the solution of the LP
totM.L = LP_solution * 0.9;
totV.LO = 0.1;
* risk averse
r = -2;
solve decision using nlp maximizing utility;
display totM.L, utility.L;
* risk lover
r = 2;
solve decision using nlp maximizing utility;
display totM.L, utility.L;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment