Stochastic Programming problem

Hi! So I was trying to put together my first stochastic model and so
far I have not been having fun. I’m working on a surgery scheduling
model within a single OR context. My model (for teh most part) is as
follows:

6 sets
7 i Position in sequence /15/
8 j Surgery /1
5/
9 ;
10
11 parameters
12 AvgTime(j) Average time for completing surgery type
13 d Length of work day in hours /10/
14 cw Waiting time penalty /8/
15 cs Idle time penalty /8/
16 cl Late completion penalty /4/
17 n Total number of surgeries to be scheduled /6/
18 U Random number
19 ;
20 scalar
21 pr
22 dens1 “Urology” /0.12/
23 dens2 “Orthopedic” /0.42/
24 dens3 “General” /0.57/
25 dens4 “Gynecology” /0.81/
26 dens5 “Pediatric” /0.90/
27 dens6 “Heart,chest,throat” /1/;
28
29 free variable total_penalty;
30
31 binary variables
32 x(i,j) if surgery j is assigned to position i;
33
34
35 $ontext
Model for the single scenario problem
37 offtext 38 39 parameter z1(i); 40 41 positive variable 42 t1(i) Scheduled start-time of surgery in position i 43 w1(i,j) Wait-time when surgery j is in position i 44 s1(i,j) Idle-time when surgery j is in position i 45 l1 Overtime 46 g1 Early-time; 47 48 equations 49 objective1, startTime1(i), endTime1(i), s_lim1(i,j), w_lim1(i,j), 50 w_def1(i,j), s_def1(i,j), assign_i1(i), assign_j1(j); 51 52 objective1.. 53 total_penalty =e= sum((i,j), cw*w1(i,j) + cs*s1(i,j) + cl*l1); 54 55 startTime1(i)(ord(i) dens1 and
prdens2 and prdens3 and
prdens4 and prdens5);
108
109 );
110 loop(i,
111 U = uniform(0,1);
112 z1(i) = (sqrt(8.3U) + 0.12)$(U 0.55);
113 );
114 solve SurgSeq1 using mip minimizing total_penalty;
115 display x.l;
116 sumObj = sumObj + total_penalty.l;
117 sumObjSq = sumObjSq + (total_penalty.l
total_penalty.l);
118 );

And the error I’m getting is : Row “w_def1(5.1)” infeasible, all
entries at implied bounds.

I’m not even suer what this means, but it seems like the program’s
having trouble scheduling the last surgery case (?). And I have no
clue how to fix this.
Any kind of help would be much appreciated!

\

Hi,

your problem is small enough that you should be able to come up with a
“feasible” solution by hand. Set the level values of the variables
according to your “solution”. Write 'option limrow=1e9;" in front of
your solve statement and inspect the “Row Listing” section in the LST
file for the infeasible constraint. This will point you to a problem
in the data or your model logic.

Hope this helps,
Michael Bussieck - GAMSWorld Coordinator

On May 2, 9:15 am, Mappi wrote:

Hi! So I was trying to put together my first stochastic model and so
far I have not been having fun. I’m working on a surgery scheduling
model within a single OR context. My model (for teh most part) is as
follows:

6 sets
7 i Position in sequence /15/
8 j Surgery /1
5/
9 ;
10
11 parameters
12 AvgTime(j) Average time for completing surgery type
13 d Length of work day in hours /10/
14 cw Waiting time penalty /8/
15 cs Idle time penalty /8/
16 cl Late completion penalty /4/
17 n Total number of surgeries to be scheduled /6/
18 U Random number
19 ;
20 scalar
21 pr
22 dens1 “Urology” /0.12/
23 dens2 “Orthopedic” /0.42/
24 dens3 “General” /0.57/
25 dens4 “Gynecology” /0.81/
26 dens5 “Pediatric” /0.90/
27 dens6 “Heart,chest,throat” /1/;
28
29 free variable total_penalty;
30
31 binary variables
32 x(i,j) if surgery j is assigned to position i;
33
34
35 $ontext
Model for the single scenario problem
37 offtext 38 39 parameter z1(i); 40 41 positive variable 42 t1(i) Scheduled start-time of surgery in position i 43 w1(i,j) Wait-time when surgery j is in position i 44 s1(i,j) Idle-time when surgery j is in position i 45 l1 Overtime 46 g1 Early-time; 47 48 equations 49 objective1, startTime1(i), endTime1(i), s_lim1(i,j), w_lim1(i,j), 50 w_def1(i,j), s_def1(i,j), assign_i1(i), assign_j1(j); 51 52 objective1.. 53 total_penalty =e= sum((i,j), cw*w1(i,j) + cs*s1(i,j) + cl*l1); 54 55 startTime1(i)(ord(i) > 56 t1(i+1) + sum(j, w1(i+1,j)) =e= t1(i) + sum(j, z1(i)x(i,j)) +
57 sum(j, s1(i,j)) + sum(j, w1(i,j));
58
59 endTime1(i)$(ord(i) = card(i))…
60 t1(i) + sum(j, z1(i)x(i,j)) + sum(j, w1(i,j)) - d =e= l1 - g1;
61
62 w_def1(i,j)…
63 w1(i,j) =g= t1(i-1)+w1(i-1,j)+z1(i-1)-t1(i);
64
65 s_def1(i,j)…
66 s1(i,j) =g= t1(i+1)-w1(i,j)-z1(i)-t1(i);
67
68 s_lim1(i,j)… s1(i,j) =l= 99
x(i,j);
69
70 w_lim1(i,j)… w1(i,j) =l= 99
x(i,j);
71
72 assign_i1(i)… sum(j, x(i,j)) =e= 1;
73
74 assign_j1(j)… sum(i, x(i,j)) =e= 1;
75
76
77 t1.fx(“1”) = 0;
78 w1.fx(“1”,j) = 0;
79
80 set iter /1/;
81
82 model SurgSeq1 /objective1, startTime1, endTime1, s_lim1,
w_lim1,
83 w_def1, s_def1, assign_i1, assign_j1/;
84
85 $ontext
Find the optimal sequence and then obtain an upper bound given
this sequen
ce
87 offtext 88 89 parameters 90 sumObj Sum of objective values 91 sumObjSq Sum of objective values squared 92 sumUB Sum of 'upper bound' values 93 sumUBSq Sum of 'upper bound' values squared 94 95 v_hat Estimate of lower bound 96 r_hat Estimate of feasible solution value 97 ; 98 99 sumObj = 0; 100 sumObjSq = 0; 101 102 loop(iter, 103 loop(j, 104 pr = uniform(0,1); 105 AvgTime(j) = 1.46(prdens1 and
pr > 106 2.4$(pr>dens2 and prdens3 and
pr > +
107 2.5$(pr>dens4 and prdens5);
108
109 );
110 loop(i,
111 U = uniform(0,1);
112 z1(i) = (sqrt(8.3U) + 0.12)(U > sqrt(6.75*(1-U )))(U > 0.55);
113 );
114 solve SurgSeq1 using mip minimizing total_penalty;
115 display x.l;
116 sumObj = sumObj + total_penalty.l;
117 sumObjSq = sumObjSq + (total_penalty.l
total_penalty.l);
118 );

And the error I’m getting is : Row “w_def1(5.1)” infeasible, all
entries at implied bounds.

I’m not even suer what this means, but it seems like the program’s
having trouble scheduling the last surgery case (?). And I have no
clue how to fix this.
Any kind of help would be much appreciated!


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/gamsworld?hl=en.

\

Thanks a lot! I think I found the problem. That was just the one scenario version, so now I have to work with the multiple scenario + multiple iterations version.

Thanks again!

Mappi

On Mon, May 3, 2010 at 4:42 AM, Gamsworld Admin wrote:

Hi,

your problem is small enough that you should be able to come up with a
“feasible” solution by hand. Set the level values of the variables
according to your “solution”. Write 'option limrow=1e9;" in front of
your solve statement and inspect the “Row Listing” section in the LST
file for the infeasible constraint. This will point you to a problem
in the data or your model logic.

Hope this helps,
Michael Bussieck - GAMSWorld Coordinator

On May 2, 9:15 am, Mappi wrote:

Hi! So I was trying to put together my first stochastic model and so
far I have not been having fun. I’m working on a surgery scheduling
model within a single OR context. My model (for teh most part) is as
follows:

6 sets
7 i Position in sequence /15/
8 j Surgery /1
5/
9 ;
10
11 parameters
12 AvgTime(j) Average time for completing surgery type
13 d Length of work day in hours /10/
14 cw Waiting time penalty /8/
15 cs Idle time penalty /8/
16 cl Late completion penalty /4/
17 n Total number of surgeries to be scheduled /6/
18 U Random number
19 ;
20 scalar
21 pr
22 dens1 “Urology” /0.12/
23 dens2 “Orthopedic” /0.42/
24 dens3 “General” /0.57/
25 dens4 “Gynecology” /0.81/
26 dens5 “Pediatric” /0.90/
27 dens6 “Heart,chest,throat” /1/;
28
29 free variable total_penalty;
30
31 binary variables
32 x(i,j) if surgery j is assigned to position i;
33
34
35 $ontext
Model for the single scenario problem
37 offtext 38 39 parameter z1(i); 40 41 positive variable 42 t1(i) Scheduled start-time of surgery in position i 43 w1(i,j) Wait-time when surgery j is in position i 44 s1(i,j) Idle-time when surgery j is in position i 45 l1 Overtime 46 g1 Early-time; 47 48 equations 49 objective1, startTime1(i), endTime1(i), s_lim1(i,j), w_lim1(i,j), 50 w_def1(i,j), s_def1(i,j), assign_i1(i), assign_j1(j); 51 52 objective1.. 53 total_penalty =e= sum((i,j), cw*w1(i,j) + cs*s1(i,j) + cl*l1); 54 55 startTime1(i)(ord(i) 56 t1(i+1) + sum(j, w1(i+1,j)) =e= t1(i) + sum(j, z1(i)x(i,j)) +
57 sum(j, s1(i,j)) + sum(j, w1(i,j));
58
59 endTime1(i)$(ord(i) = card(i))…
60 t1(i) + sum(j, z1(i)x(i,j)) + sum(j, w1(i,j)) - d =e= l1 - g1;
61
62 w_def1(i,j)…
63 w1(i,j) =g= t1(i-1)+w1(i-1,j)+z1(i-1)-t1(i);
64
65 s_def1(i,j)…
66 s1(i,j) =g= t1(i+1)-w1(i,j)-z1(i)-t1(i);
67
68 s_lim1(i,j)… s1(i,j) =l= 99
x(i,j);
69
70 w_lim1(i,j)… w1(i,j) =l= 99
x(i,j);
71
72 assign_i1(i)… sum(j, x(i,j)) =e= 1;
73
74 assign_j1(j)… sum(i, x(i,j)) =e= 1;
75
76
77 t1.fx(“1”) = 0;
78 w1.fx(“1”,j) = 0;
79
80 set iter /1/;
81
82 model SurgSeq1 /objective1, startTime1, endTime1, s_lim1,
w_lim1,
83 w_def1, s_def1, assign_i1, assign_j1/;
84
85 $ontext
Find the optimal sequence and then obtain an upper bound given
this sequen
ce
87 offtext 88 89 parameters 90 sumObj Sum of objective values 91 sumObjSq Sum of objective values squared 92 sumUB Sum of 'upper bound' values 93 sumUBSq Sum of 'upper bound' values squared 94 95 v_hat Estimate of lower bound 96 r_hat Estimate of feasible solution value 97 ; 98 99 sumObj = 0; 100 sumObjSq = 0; 101 102 loop(iter, 103 loop(j, 104 pr = uniform(0,1); 105 AvgTime(j) = 1.46(prdens1 and
pr 106 2.4$(pr>dens2 and prdens3 and
pr +
107 2.5$(pr>dens4 and prdens5);
108
109 );
110 loop(i,
111 U = uniform(0,1);
112 z1(i) = (sqrt(8.3U) + 0.12)(U sqrt(6.75*(1-U )))(U > 0.55);
113 );
114 solve SurgSeq1 using mip minimizing total_penalty;
115 display x.l;
116 sumObj = sumObj + total_penalty.l;
117 sumObjSq = sumObjSq + (total_penalty.l
total_penalty.l);
118 );

And the error I’m getting is : Row “w_def1(5.1)” infeasible, all
entries at implied bounds.

I’m not even suer what this means, but it seems like the program’s
having trouble scheduling the last surgery case (?). And I have no
clue how to fix this.
Any kind of help would be much appreciated!


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/gamsworld?hl=en.


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

\

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

I actually have another question already! I need to calculate the variance of my objective over multiple iterations and I don’t know if there is an easy way to do this in GAMS,w ithout having to keep track of every single obj value. I can have an array of course and fill it up as I go through iterations and then use that array to obtain the variance. But if there’s a better way to do it that’d be great!

Thanks

M


On Mon, May 3, 2010 at 4:42 AM, Gamsworld Admin wrote:

Hi,

your problem is small enough that you should be able to come up with a
“feasible” solution by hand. Set the level values of the variables
according to your “solution”. Write 'option limrow=1e9;" in front of
your solve statement and inspect the “Row Listing” section in the LST
file for the infeasible constraint. This will point you to a problem
in the data or your model logic.

Hope this helps,
Michael Bussieck - GAMSWorld Coordinator

On May 2, 9:15 am, Mappi wrote:

Hi! So I was trying to put together my first stochastic model and so
far I have not been having fun. I’m working on a surgery scheduling
model within a single OR context. My model (for teh most part) is as
follows:

6 sets
7 i Position in sequence /15/
8 j Surgery /1
5/
9 ;
10
11 parameters
12 AvgTime(j) Average time for completing surgery type
13 d Length of work day in hours /10/
14 cw Waiting time penalty /8/
15 cs Idle time penalty /8/
16 cl Late completion penalty /4/
17 n Total number of surgeries to be scheduled /6/
18 U Random number
19 ;
20 scalar
21 pr
22 dens1 “Urology” /0.12/
23 dens2 “Orthopedic” /0.42/
24 dens3 “General” /0.57/
25 dens4 “Gynecology” /0.81/
26 dens5 “Pediatric” /0.90/
27 dens6 “Heart,chest,throat” /1/;
28
29 free variable total_penalty;
30
31 binary variables
32 x(i,j) if surgery j is assigned to position i;
33
34
35 $ontext
Model for the single scenario problem
37 offtext 38 39 parameter z1(i); 40 41 positive variable 42 t1(i) Scheduled start-time of surgery in position i 43 w1(i,j) Wait-time when surgery j is in position i 44 s1(i,j) Idle-time when surgery j is in position i 45 l1 Overtime 46 g1 Early-time; 47 48 equations 49 objective1, startTime1(i), endTime1(i), s_lim1(i,j), w_lim1(i,j), 50 w_def1(i,j), s_def1(i,j), assign_i1(i), assign_j1(j); 51 52 objective1.. 53 total_penalty =e= sum((i,j), cw*w1(i,j) + cs*s1(i,j) + cl*l1); 54 55 startTime1(i)(ord(i) 56 t1(i+1) + sum(j, w1(i+1,j)) =e= t1(i) + sum(j, z1(i)x(i,j)) +
57 sum(j, s1(i,j)) + sum(j, w1(i,j));
58
59 endTime1(i)$(ord(i) = card(i))…
60 t1(i) + sum(j, z1(i)x(i,j)) + sum(j, w1(i,j)) - d =e= l1 - g1;
61
62 w_def1(i,j)…
63 w1(i,j) =g= t1(i-1)+w1(i-1,j)+z1(i-1)-t1(i);
64
65 s_def1(i,j)…
66 s1(i,j) =g= t1(i+1)-w1(i,j)-z1(i)-t1(i);
67
68 s_lim1(i,j)… s1(i,j) =l= 99
x(i,j);
69
70 w_lim1(i,j)… w1(i,j) =l= 99
x(i,j);
71
72 assign_i1(i)… sum(j, x(i,j)) =e= 1;
73
74 assign_j1(j)… sum(i, x(i,j)) =e= 1;
75
76
77 t1.fx(“1”) = 0;
78 w1.fx(“1”,j) = 0;
79
80 set iter /1/;
81
82 model SurgSeq1 /objective1, startTime1, endTime1, s_lim1,
w_lim1,
83 w_def1, s_def1, assign_i1, assign_j1/;
84
85 $ontext
Find the optimal sequence and then obtain an upper bound given
this sequen
ce
87 offtext 88 89 parameters 90 sumObj Sum of objective values 91 sumObjSq Sum of objective values squared 92 sumUB Sum of 'upper bound' values 93 sumUBSq Sum of 'upper bound' values squared 94 95 v_hat Estimate of lower bound 96 r_hat Estimate of feasible solution value 97 ; 98 99 sumObj = 0; 100 sumObjSq = 0; 101 102 loop(iter, 103 loop(j, 104 pr = uniform(0,1); 105 AvgTime(j) = 1.46(prdens1 and
pr 106 2.4$(pr>dens2 and prdens3 and
pr +
107 2.5$(pr>dens4 and prdens5);
108
109 );
110 loop(i,
111 U = uniform(0,1);
112 z1(i) = (sqrt(8.3U) + 0.12)(U sqrt(6.75*(1-U )))(U > 0.55);
113 );
114 solve SurgSeq1 using mip minimizing total_penalty;
115 display x.l;
116 sumObj = sumObj + total_penalty.l;
117 sumObjSq = sumObjSq + (total_penalty.l
total_penalty.l);
118 );

And the error I’m getting is : Row “w_def1(5.1)” infeasible, all
entries at implied bounds.

I’m not even suer what this means, but it seems like the program’s
having trouble scheduling the last surgery case (?). And I have no
clue how to fix this.
Any kind of help would be much appreciated!


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/gamsworld?hl=en.


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

\

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.