bath_log_it.run 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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/log/bath_log.mod' ;
  7. #model bath.mod ;
  8. # LOAD DATA
  9. data '/home/moez/docs/progs/ampl/bathtub/cont/log/bath_log-4.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_log;
  33. #display B, e, k, v, ue_exp, ux_exp, t,tt > '/home/moez/docs/progs/ampl/bathtub/cont/log_ini.out' ;
  34. #option ipopt_options "halt_on_ampl_error yes";
  35. option solver "/home/moez/ulco/ampl/conopt" ;
  36. #option solver ipopt ;
  37. #option solver "/home/moez/ulco/ampl/minos" ;
  38. objective last_arrival_time;
  39. solve ;
  40. #display t[n+q] , util_log;
  41. option conopt_options 'outlev=3';
  42. option display_width 100 ;
  43. # The logarithlic utility
  44. objective util_log ;
  45. solve ;
  46. var tt {i in 1..n} = t[i+q] ;
  47. var v0 {i in 1..n} = (R0 * log(R1 * t[i]) + S0 * log(S1*(TMAX-t[i])) );
  48. var uc {i in 1..n} = v0[i] - ue_log[i] - ux_log[i] ;
  49. var UC = sum {i in 1..n} ( e[i] * uc[i] );
  50. display P, util_log / P, UC;
  51. #display B, e, k, v, ue_log, ux_log, t, tt ;
  52. #display B, e, k, v, ue_log, ux_log, t,tt > '/home/moez/docs/progs/ampl/bathtub/cont/log/log4.out' ;
  53. end;