You should add the constraint S >= 0
, which you didn’t previously tell us about, although it is always satisfied anyhow using the W you have provided. If you make W large enough, you may need the constraint. I added the constraint S >= 0
to my above program for the runs below.
With your input data and W (no matter which random values are chosen), s = vector of ones is achieved; it is feasible, and must be optimal. This must look very unsatisfying to you. This situation will occur.
unless at least some elements of W exceed s_min.
If W is larger, such as W = 10*rand(jobs,1);
, the optimal s will not be all ones. Here are the optimal s and S values for 2 random instantiations of W
1st instantiation of W
Optimal s
1.8424
1.8424
3.7174
3.7174
3.7174
3.7174
4.4002
4.4002
4.4002
4.4002
4.4002
4.4002
4.4002
4.4002
4.4002
4.4002
cvx_optval = +255.68
Optimal S for above s
1.8424 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
1.8424 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 3.7174 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.8744 2.8430 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.8744 2.8430 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.7899 2.1163 0.8113 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 4.4002 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 4.4002 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 0.2538 4.1464 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 0.2397 2.0397 0.0000 0.0000 0.0000 0.0000 2.1207 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.7519 2.8950 0.0000 0.0000 0.0000 0.7533 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.4639 0.8478 1.6899 0.0000 0.0000 0.4595 0.9390
0.0000 0.0000 0.0000 0.0000 0.0000 0.3553 0.5462 0.8038 1.2593 0.5026 0.3520 0.5809
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.5789 0.8737 1.4347 0.5297 0.3654 0.6177
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.9912 1.7738 0.5728 0.3857 0.6767
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.4584 0.6484 2.2933
+++++++++++++++++++++++++++++++++++++
2nd instantiation of W
Optimal s
4.0881
4.0881
4.3822
4.3822
4.3822
4.3822
4.3822
4.3822
5.0201
5.0201
5.0201
5.9043
5.9043
5.9043
5.9043
5.9043
cvx_optval = +398.557
Optimal S for above s
4.0881 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
4.0881 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 4.3822 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 1.4881 2.8941 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 1.4881 2.8941 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.3943 0.4529 3.5351 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0978 0.1010 0.1255 4.0579 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0978 0.1010 0.1255 4.0579 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 5.0201 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.1593 0.0000 0.0000 0.0000 0.0000 4.8608 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.1489 3.5073 0.0000 0.0000 0.0000 1.3639 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 4.8373 0.0000 0.0000 0.0000 1.0670
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.5174 2.9194 0.7524 0.0000 0.7151
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.5176 2.9199 0.7520 0.0000 0.7148
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.5178 2.9202 0.7518 0.0000 0.7146
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.2453 0.0000 2.6590
Note that in these two runs, S has zeros in locations in accordance with the sentence after equation 1.8. However, with your original W = rand(jobs,1);,
I got optimal solutions which did not have zeros as indicated in that statement. In that case, the vector of ones was achieved for s, producing the smallest possible objective value, without those locations being forced to zero. So that statement after equation 1.8 is not necessarily true, although I believe it is true that there exists an optimal solution which does have zeros in locations so indicated (the optimal solution is not necessarily unique). So if you want to guarantee having zeros in those locations, you need to either explicitly add constraints, or perhaps do something else. TO explicitly add the constraints, add S(setdiff(1:T,A(i):D(i)),i) == 0
to the for loop in the constraints section.