Code: Select all

`[u][b](ie,high.low, high.high )[/b][/u]`

Code: Select all

```
ic(v,y).. ((sum(x,p(x,v)*sqrt(w(x)))-d(v))
-(sum(x,p(x,y)*sqrt(w(x)))-d(y)))*dummy(v) =g= 0;
```

[/img] [/img]

Complete Code snippet is below;

Code: Select all

```
*MORAL HAZARD 2 Activities
*Indiviua More Active SB
*C, B, N eplicitly shown
*Itoh,"A Course in Contract"4.2.2 p.161 IP'
Option limcol=0, limrow=0;
* Definition of Set
Set x project outcome /failure, success/
y effort level /low, high/
t loop index /1,2/;
Alias (y,v);
* Definition of Parameters
Table p(x,y) probability of outcome by effort level
low high
failure 0.9 0.2
success 0.1 0.8
;
Parameter d(y) disutility by efforts
/low 1
high 2/
;
Parameter r(x) project's interest
/failure 13
success 45/
;
Parameter dummy(y) dummy to enable and disable equations;
dummy(y)=0;
* Definition of Primal Variables
Positive Variable
w(x) entrep's income
;
Variable U investor's expected utility
;
Equation
obj utility function
pc(y) participation constraint
ic(v,y) incentive compatibility constraint
;
* Defining and Solving the Model
*more active efforts
obj.. U =e= sum((x,y), dummy(y)*p(x,y)*(r(x) - w(x)));
pc(y).. (sum(x,p(x,y)*sqrt(w(x)))-d(y))*dummy(y) =g= 0;
ic(v,y).. ((sum(x,p(x,v)*sqrt(w(x)))-d(v))
-(sum(x,p(x,y)*sqrt(w(x)))-d(y)))*dummy(v) =g= 0;
* Setting Lower Bounds on Variables to Avoid Division by Zero
w.lo(x)=0.0001;
Model MH001FB First Best Model /obj,pc /;
Model MH001SB Second Best Model /obj,pc,ic/;
Parameter
w_FB(y,x) payments
u_e_FB(y,x) entrep's FB utility
C_FB(y) investor's FB expected payment
B_FB(y) investor's FB expected revenue
Net_FB(y) investor's FB expected utility
w_SB(y,x) payments
u_e_SB(y,x) entrep's utility
C_SB(y) investor's expected payment
B_SB(y) investor's expected revenue
Net_SB(y) investor's expected utility
;
Loop(t,
dummy(y)=1$(ord(t) eq ord(y));
Solve MH001FB maximizing U using NLP;
Solve MH001SB maximizing U using NLP;
);
```