bath_log.mod 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # MODEL PARAMETERS
  2. param P ;
  3. param K ;
  4. param vf ;
  5. param M0 ;
  6. param Mbar ;
  7. param TMAX ;
  8. param L ;
  9. param T0 := M0 / vf ;
  10. param n ;
  11. param q ;
  12. # APPROXIMATION GRID
  13. param B {i in 1..n+q};
  14. param q0 ;
  15. # LOG UTILITY FUNCTION
  16. # --> LOG
  17. param R0 ;
  18. param R1 ;
  19. param S0 ;
  20. param S1 ;
  21. # A SMALL VALUE
  22. param eps ;
  23. # GENERATE INITIAL SOLUTION WITH UNIFORM ENTRIES
  24. #var e {i in 1..n} >= 0.0, :=
  25. # (B[i+1]-B[i])/(B[n+1]-B[1]) ;
  26. var e {1..n} >=0 ;
  27. var k { i in 1..n+q-1 } # traffic density
  28. = sum {j in max(1,i-q+1)..min(i,n)} e[j];
  29. var v { i in 1..n+q-1 } # traffic speed
  30. = vf * (1 - P * k[i] / K );
  31. var Dt { i in 1..n+q-1 } # travel time from B[i] to B[i+1]
  32. = ( B[i+1] - B[i] ) / v[i];
  33. var t { i in 1..n+q } = # clock time at B[i]
  34. if i = 1 then T0
  35. else t[i-1] + Dt[i-1] ;
  36. # LOGARITHMIC UTILITY FUNCTION
  37. var ue_log {i in 1..n}
  38. = R0 * log( R1 * t[i] ) ;
  39. var ux_log {i in 1..n}
  40. = S0 * log( S1 * ( TMAX - t[i+q] ) ) ;
  41. maximize util_log: sum{i in 1..n} P * ( ue_log[i] * e[i] + ux_log[i] * e[i] ) ;
  42. # MINIMIZE THE SHORTEST END TIME OF THE RUSH HOUR
  43. minimize last_arrival_time: t[n+q] ;
  44. # CONSTRAINTS OF THE PROBLEM
  45. # 1. All agents enter the bathtub
  46. subject to entry : sum{i in 1..n} e[i] == 1.0 ;
  47. # 2. Jam capacity should not be reached
  48. subject to capacity { i in q .. n } : k[i] <= K / P - eps ;