bath_exp.run 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # CLEAR MEMORY
  2. reset ;
  3. # LOAD MODEL
  4. model 'bath_exp.mod' ;
  5. # LOAD DATA
  6. data 'bath_exp.dat' ;
  7. # Approximation grid
  8. let q := q0 + 1;
  9. param dL := L / q0 ;
  10. param nL := ( Mbar - M0 ) div L ;
  11. param q1 := 1+( ( Mbar - nL * L - M0 ) div dL );
  12. let n := q * nL + q1 + 1 ;
  13. param M1 := Mbar - nL * L ;
  14. for { i in 1..q1 } {
  15. for { j in 0 .. nL+1 } {
  16. let B[i+j*q] := M0 + (i-1) * dL + j * L;
  17. }
  18. }
  19. for {j in 0 .. nL+1 } {
  20. let B[q1+1+j*q] := M1 + j * L ;
  21. }
  22. for { i in q1+2..q } {
  23. for { j in 0 .. nL } {
  24. let B[i + j * q] := B[q1] + dL * (i - (q1+1)) + j * L;
  25. }
  26. }
  27. display t[n+q] , util_exp;
  28. # Provide correct path to solver
  29. option solver 'conopt' ;
  30. option conopt_options 'outlev=3';
  31. option display_width 100 ;
  32. objective last_arrival_time;
  33. solve;
  34. # The exponential utility
  35. objective util_exp ;
  36. solve ;
  37. var tt {i in 1..n} = t[i+q] ;
  38. option display_width 120 ;
  39. display t[1], t[n], t[n+q] , util_exp, util_exp / P,P;
  40. display B, e, k, v, ue_exp, ux_exp, t,tt > 'bath_exp.csv' ;
  41. end;