bath_exp.run 1.3 KB

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