|
@@ -0,0 +1,70 @@
|
|
|
+# 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/exp/bath_exp.mod' ;
|
|
|
+#model bath.mod ;
|
|
|
+
|
|
|
+# LOAD DATA
|
|
|
+data '/home/moez/docs/progs/ampl/bathtub/cont/exp/bath_exp.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_exp;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+option solver '/home/moez/ulco/ampl/conopt' ;
|
|
|
+
|
|
|
+option conopt_options 'outlev=3';
|
|
|
+option display_width 100 ;
|
|
|
+
|
|
|
+
|
|
|
+objective last_arrival_time;
|
|
|
+
|
|
|
+solve;
|
|
|
+
|
|
|
+# The exponential utility
|
|
|
+objective util_exp ;
|
|
|
+
|
|
|
+solve ;
|
|
|
+
|
|
|
+var tt {i in 1..n} = t[i+q] ;
|
|
|
+
|
|
|
+option display_width 120 ;
|
|
|
+display t[1], t[n], t[n+q] , util_exp, util_exp / P,P;
|
|
|
+#display B, e, k, v, ue_exp, ux_exp, t, tt ;
|
|
|
+
|
|
|
+display B, e, k, v, ue_exp, ux_exp, t,tt > '/home/moez/docs/progs/ampl/bathtub/cont/exp/exp2.out' ;
|
|
|
+
|
|
|
+end;
|