• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest May 6th, 2019 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. clc
2. clear
4. c=[4.5 4.5 4.5 5.9 5.9 5.9 2.3 2.3 2.3 5.9 5.9 5.9]';
5. A=[1 0 1 1 0 1 0 0 0 0 0 0;
6.    0 0 0 0 0 0 1 0 1 1 0 1;
7.    0 1 0 0 1 0 0 0 0 0 0 0;
8.    0 0 0 0 0 0 0 1 0 0 1 0;
9.    1 0 0 0 0 0 1 0 0 0 0 0;
10.    0 0 0 1 0 0 0 0 0 1 0 0;
11.    0 1 0.7 0 0 0 0 1 0.7 0 0 0;
12.    0 0 0 0 1 0.7 0 0 0 0 1 0.7;
13.    1 1 0.7 0 0 0 1 1 0.7 0 0 0;
14.    0 0 0 1 1 0.7 0 0 0 1 1 0.7];
15. b=[3800 2700 4600 6000 3000 1100 3200 5500 6500 8200]';
16. [x_min,z_min,ec,extra]=glpk(c,A,b,zeros(12,1),[],"UUUULLLLSS","CCCCCCCCCCCC",1)
17.
19. db=[5 5 -5 -5 0 0 0 0 0 0]';
20. i=1;
21. while(1)
22.   i=i+1;
23.   B=b+i*db;
24.   [x_min,z_min]=glpk(c,A,B,zeros(12,1),[],"UUUULLLLSS","CCCCCCCCCCCC",1);
25.   if((x_min(3)>=100) || (x_min(6)>=100) || (x_min(9)>=100) || (x_min(12)>=100))
26.     printf("%d %d %d %d Optimal solution\n",B(1),B(2),B(3),B(4))
27.     [x_min,z_min,ec,extra]=glpk(c,A,B,zeros(12,1),[],"UUUULLLLSS","CCCCCCCCCCCC",1)
28.     break
29.   else
30.     printf("%d %d %d %d No changes\n",B(1),B(2),B(3),B(4))
31.   endif
32. endwhile
33.
35. b_task_3=[20000 20000 20000 20000 3000 1100 3200 5500 6500 8200]';
37.
38. dc=[0 0.1 0 0 0.1 0 0 0.1 0 0 0.1 0]';
39. j=1;
40. while(1)
41.   j=j+1;
42.   C=c+j*dc;