A manufacturing plant is looking to minimize costs regarding chip production given the following parameters. It takes 1.6 hours to produce one chip at any given time and the cost for storing a chip from a previous week is $5
Constraints:
Month requirements: (binding)
x1(rt) + x1(ot) - x1(s) less than or equal to 1000
x1(s) + x2(rt) + x2(ot) - x2(s) less than or equal to 2500
x3(rt) + x3(ot) + x2(s) less than or equal to 2200
Time limit: (nonbinding)
1.6 hours per chip (rt) less than or equal to 2400
1.6 hours per chip (ot) less than or equal to 720
In this approach the constraints are not limited and could appear negative if not solved properly. Solving the problem this way could result in inaccurate results if the system is ill-conditioned. This can be measured by calculating the condition number of matrix B.
Set up parameters
-Matrix f, for defining coefficients
-Matrix A, for defining coefficients equations
-Matrix b, for defining equations
- define upper and lower bounds
Set up linprog for optimization
-plug in previous matrixes
Set up profit function
-plug in solved values along with coefficients from linprog into cost equation.
%problem 1
%set up parameters
% (binding)
f = [100,110,5,100,120,5,125,125]'; % coefficients for cost (binding)
% (non-binding)
A = [-1,-1,1,0,0,0,0,0;
0,0,-1,-1,-1,1,0,0;
0,0,0,0,0,-1,-1,-1;
1.6,0,0,0,0,0,0,0;
0,0,0,1.6,0,0,0,0;
0,0,0,0,0,0,1.6,0;
0,1.6,0,0,0,0,0,0;
0,0,0,0,1.6,0,0,0;
0,0,0,0,0,0,0,1.6];
b = [-1000,-2500,-2200,2400,2400,2400,720,720,720]'; % inequalities and total
LB = [0,0,0,0,0,0,0,0]'; % bounds for coefficients
UB = [Inf,Inf,Inf,Inf,Inf,Inf,Inf,Inf]' ; % bounds for coefficients
X = linprog(f,A,b,[],[],LB,UB); %for solving coefficients
Z = f'*X; % cost given amount and coefficients
There was a small difference among both calculations, I then tried changing f in the Linprog function to -f and saw a small difference as well.
The matrix problem solves for the coefficients and not for the max or min like an optimization problem. The coefficients could be negative so that the solution is still found, but in some system's the solution found is inapplicable. For example if one of the coefficients in this problem was negative it would not work out in the system because there can not be negative time.