help me fix the error in the matlab code below:
%title PROGRAMMING TASK
%A company aims to produce a lead-zinc-tin of 30% lead, 30% zinc,
40%
tin alloy at minimal cost. The problem is to blend a new alloy from
nine
other purchased alloys with different unit costs
%G. Dantzig & M.
%Thapa, Linear Programming: 1. Introduction, Springer, 1997.
%Keywords: linear programming, blending problem
manufacturing, alloy blending
Set
alloy 'products on the market' / a*i /
elem 'required elements' /
lead zinc, tin /;
Table compdat(*,alloy) 'composition data (pct and price)'
1 2
3 4 5 6 7
8 9
lead 10 10 40 60
30 30 30 50 20
zinc 10 30 50 30
30 40 20 40 30
tin 80 60 10 10
40 30 50 10 50
price 4.1 4.3 5.8 6.0
7.6 7.5 7.3 6.9 7.3;
Parameter
rb(elem) 'required blend' / lead 30, zinc 30,
tin 40 /
ce(alloy) 'composition error (pct-100)';
ce(alloy) = sum(elem, compdat(elem,alloy)) - 100;
disp ce;
Variable
v(alloy) 'purchase of alloy (pounds)'
phi 'total cost';
Positive Variable v;
Equation
pc(elem) 'purchase constraint'
mb 'material balance'
ac 'accounting: total cost';
pc(elem)... sum(alloy, compdat(elem,alloy)*v(alloy)) =e=
rb(elem);
mb... sum(alloy, v(alloy)) =e= 1;
ac... phi =e= sum(alloy,
compdat("price",alloy)*v(alloy));
Model
b1 'problem without mb' / pc, ac /
b2 'problem with mb' / pc mb, ac
/;
Parameter report(alloy,*) 'comparison of model 1 and 2';
solve b1 minimizing phi using lp;
report(alloy,"blend-1") = v.l(alloy);
solve b2 minimizing phi using lp;
report(alloy,"blend-2") = v.l(alloy);
disp report;
help me fix the error in the matlab code below: %title PROGRAMMING TASK %A company aims to produce a lead-zinc-tin of 30
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
help me fix the error in the matlab code below: %title PROGRAMMING TASK %A company aims to produce a lead-zinc-tin of 30
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!