Hello community team,

I have tried to write a scheduling problem which has been described by Sousa and Wolsey in machine scheduling. I’m going to use two different approaches to write my code. First, using the special syntax into the constraint and second, create dynamic sets. The following code describes the first approach.

```
Set jobs "ordered jobs" / 1*3 /;
Set time "time horizon" / 1*150 /;
Alias(jobs,i,j), (time,t,ss);
Set map_1(i,j); map_1(i,j)$(not sameas(i,j))= yes;
Parameter p(j) "processing tim"; p(j)= uniformint(10,20);
Parameter r(j) "release time"; r(j)= uniformint(05,08);
Parameter w(j) "weight of jobs"; w(j)= uniformint(08,10);
Parameter s(i,j) "setup time"; s(i,j)= uniformint(00,00);
Parameter h(j) "constant"; h(j)= p(j)+r(j);
Free variable object;
Positive variable c(j) "completion time of job j";
Binary variable x(j,t) "(job j starts at time t)?1:0";
Equations e1, e2, e3, e4;
e1..
object =e= sum((j), w(j)*c(j));
e2(j)..
sum((t)$(t.val ge r(j) and t.val le {h(j)-p(j)+1}),
x(j,t)) =e= 1;
e3(i,j,t)$(map_1(i,j) and t.val ge r(j) and t.val le {h(j)-p(j)+1})..
x(j,t)+sum((ss)$(ss.val ge max(r(j), ss.val-p(i)-s(i,j)+1) and ss.val le min(ss.val+p(j)+s(i,j)-1, {h(i)-p(i)+1})),
x(i,ss)) =l= 1;
e4(j)..
c(j) =g= sum((t)$(t.val ge r(j) and t.val le {h(j)-p(j)+1}),
(t.val+p(j))*x(j,t));
Model smsws / e1, e2, e3, e4 /;
```

In the second approach, I’m using dynamic sets to define special lower and upper bounds into the constraints. The second approach is:

```
Set jobs "ordered jobs" / 1*3 /;
Set time "time horizon" / 1*150 /;
Alias(jobs,i,j), (time,t,ss);
Set map_1(i,j); map_1(i,j)$(not sameas(i,j))= yes;
Parameter p(j) "processing tim"; p(j)= uniformint(10,20);
Parameter r(j) "release time"; r(j)= uniformint(05,08);
Parameter w(j) "weight of jobs"; w(j)= uniformint(08,10);
Parameter s(i,j) "setup time"; s(i,j)= uniformint(00,00);
Parameter h(j) "constant"; h(j)= p(j)+r(j);
Set tt(t);
Set sss(ss);
loop((i,j,time),
tt(t)$(time.val gt r(j) and time.val lt {h(j)-p(j)+1})= yes;
sss(ss)$(time.val gt max(r(j), time.val-p(i)-s(i,j)+1) and
time.val lt min(time.val+p(j)+s(i,j)-1, {h(i)-p(i)+1}))= yes;
);
Display p, r, w, h, tt, sss;
```

In both cases, when I try to solve the model, it has infeasible results. I was wondering if,

- What exactly does “planning horizon” mean in attached file? (it is shown using the blue rectangle)
- Is there any problem to define dynamic sets?
- Is there any problem to define special syntax into the constraint?

Regards

Abbas