UU = 20;
W = randsrc(1,UU,20:150)

W =

   149    90   112   150    57    74    80   120   127    33    43    67    27    88    63    43    47   138   108    81

 SW = sum(W)

SW =

        1697

 lb = zeros(UU,1);ub = ones(UU,1);
[x, fvalx,exi,out] = bintprog(-W',W ,SW/2); 
Optimization terminated.
[y, fvaly,exi,out] = linprog(-W',W,SW/2,[],[],lb,ub,[]);
Optimization terminated.
compfunc = [ fvalx; fvaly]

compfunc =

 -848.0000
 -848.5000

compsol = [x'; y']

compsol =

  Columns 1 through 15

         0         0         0         0         0    1.0000    1.0000         0    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000         0
    0.5006    0.4997    0.5000    0.5006    0.4996    0.4996    0.4997    0.5001    0.5002    0.4997    0.4996    0.4996    0.4997    0.4997    0.4996

  Columns 16 through 20

    1.0000    1.0000    1.0000         0    1.0000
    0.4996    0.4996    0.5004    0.4999    0.4997

disp(['1-    = ', num2str(-fvalx)]);
1-    = 848
disp(['1-    = ', num2str(SW + fvalx)]);
1-    = 849
disp(['2-    = ', num2str(-fvaly)]);
2-    = 848.5
disp(['2-    = ', num2str(SW + fvaly)]);
2-    = 848.5
echo off
