-
Notifications
You must be signed in to change notification settings - Fork 0
/
createknapstack.m
26 lines (18 loc) · 958 Bytes
/
createknapstack.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function knapstack=createknapstack
v=[ 75 17 22 21 63 71 67 76 45 49 ...
83 32 88 44 12 70 12 66 40 46 ...
20 54 87 84 78 41 32 35 72 62 ...
83 87 49 74 85 63 13 86 74 67 ...
61 88 74 87 64 23 17 12 25 71]; % اشيا
w=[210 299 401 484 437 240 241 214 130 152 ...
372 484 202 319 201 178 433 403 121 328 ...
362 236 302 155 426 200 334 402 312 288 ...
165 334 380 159 197 347 320 252 412 104 ...
147 189 457 203 472 289 467 327 474 235]; % وزن ها
n=numel(v); % تعداد اشيا
W=10000; % وزن كل قابل تحمل
knapstack.v=v;
knapstack.w=w;
knapstack.n=n;
knapstack.W=W;
end