12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- # CLEAR MEMORY
- reset ;
- # set search path
- #option ampl_include '/home/moez/Downloads/amplide.linux64/amplide/';
- # LOAD MODEL
- model '/home/moez/docs/progs/ampl/bathtub/cont/log/bath_log.mod' ;
- #model bath.mod ;
- # LOAD DATA
- data '/home/moez/docs/progs/ampl/bathtub/cont/log/bath_log-4.dat' ;
- #data bath.dat ;
- # Approximation grid
-
- let q := q0 + 1;
- param dL := L / q0 ;
- param nL := ( Mbar - M0 ) div L ;
- param q1 := 1+( ( Mbar - nL * L - M0 ) div dL );
- # param n := q1 * ( nL + 1 ) + (q0-q1+2)*nL ;
- let n := q * nL + q1 + 1 ;
- param M1 := Mbar - nL * L ;
- for { i in 1..q1 } {
- for { j in 0 .. nL+1 } {
- let B[i+j*q] := M0 + (i-1) * dL + j * L;
- }
- }
- for {j in 0 .. nL+1 } {
- let B[q1+1+j*q] := M1 + j * L ;
- }
- for { i in q1+2..q } {
- for { j in 0 .. nL } {
- let B[i + j * q] := B[q1] + dL * (i - (q1+1)) + j * L;
- }
- }
- #display t[n+q] , util_log;
- #display B, e, k, v, ue_exp, ux_exp, t,tt > '/home/moez/docs/progs/ampl/bathtub/cont/log_ini.out' ;
- #option ipopt_options "halt_on_ampl_error yes";
- option solver "/home/moez/ulco/ampl/conopt" ;
- #option solver ipopt ;
- #option solver "/home/moez/ulco/ampl/minos" ;
- objective last_arrival_time;
- solve ;
- #display t[n+q] , util_log;
- option conopt_options 'outlev=3';
- option display_width 100 ;
- # The logarithlic utility
- objective util_log ;
- solve ;
- var tt {i in 1..n} = t[i+q] ;
- var v0 {i in 1..n} = (R0 * log(R1 * t[i]) + S0 * log(S1*(TMAX-t[i])) );
- var uc {i in 1..n} = v0[i] - ue_log[i] - ux_log[i] ;
- var UC = sum {i in 1..n} ( e[i] * uc[i] );
- display P, util_log / P, UC;
- #display B, e, k, v, ue_log, ux_log, t, tt ;
- #display B, e, k, v, ue_log, ux_log, t,tt > '/home/moez/docs/progs/ampl/bathtub/cont/log/log4.out' ;
- end;
|