


Constructs the processing capacity goal -------------------------------------------------------------------------- Date: July 30, 2010, ver01 By: Eugene Ben-Awuah --------------------------------------------------------------------------


0001 % Constructs the processing capacity goal 0002 %-------------------------------------------------------------------------- 0003 % Date: July 30, 2010, ver01 0004 % By: Eugene Ben-Awuah 0005 %-------------------------------------------------------------------------- 0006 0007 function [A_processingG processingGoal processingGoal_LB]=... 0008 processing_capacity_goal(Blocks120, numOfPeriods, processingTarget, processingSlack) 0009 0010 0011 [numBlocks n] = size([Blocks120.EBV]'); 0012 0013 %Goal2: ore mined should be equal to processing target 0014 OreTonnage = [Blocks120.oreTonnage]; 0015 0016 %Check calculated processing target against your set processing target 0017 processingTarget1=(sum(OreTonnage))/numOfPeriods 0018 0019 processingG = zeros(numOfPeriods,numBlocks*numOfPeriods); 0020 for iPeriods = 1:numOfPeriods 0021 processingG(iPeriods,((numBlocks*(iPeriods-1)+1):iPeriods*numBlocks))... 0022 = OreTonnage(1,:); 0023 end 0024 0025 A_processingG = sparse(processingG); 0026 0027 %Create matrix for processing goal deviational variable, d2. It occurs once in 0028 %every period; resulting in a 5x5 identity matrix. the other deviational 0029 %variables do not occur in this goal, hence we use a 5x5 zero matrix to 0030 %represent each of them. 0031 processingD2 = eye(numOfPeriods,numOfPeriods); 0032 processingD2 = sparse(processingD2); 0033 0034 %Creating the processing Goal target matrix: size=(number of contraints x Periods),1 0035 %processingGoal = repmat(processingTarget, numOfPeriods,1); 0036 processingGoal = [processingTarget]'; 0037 processingGoal = sparse(processingGoal); 0038 0039 %Create a lower bound for the processing target to introduce a slack during 0040 %optimization since the equality constraint in such large problems results 0041 %in infeasibility. You can first try with equality before using this lower 0042 %bound slack. For equality, set Slack to zero. 0043 processingTarget_LB = processingTarget-processingSlack; 0044 processingGoal_LB = [processingTarget_LB]'; 0045 processingGoal_LB = sparse(processingGoal_LB); 0046 0047 % the mulitplier vector in the goal matrix have different sizes 0048 % and units. (some are tonnage some are grade....). It is necessary to 0049 % transform the constraints matrix in a way that it unit less to be 0050 % solved by the MIP code. 0051 % divide each row vector by its norm [A(i,:)* A(i,:)']^1/2 0052 % A_miningNormVector(m,1) is vertical vector holding the respective 0053 % norm of each row of the A_mining matrix 0054 [m,n] = size(A_processingG); 0055 0056 for i = 1:m 0057 A_processingNormVector(i,1) = norm(A_processingG(i,:)); 0058 end 0059 0060 for i = 1:m 0061 normA = A_processingNormVector(i,1); 0062 A_processingG(i,:) = A_processingG(i,:)/normA; 0063 0064 %normalizing the deviational variable 0065 processingD2(i,:) = processingD2(i,:)/normA; 0066 0067 %normalizing the goal 0068 processingGoal(i)= processingGoal(i)/normA; 0069 0070 %normalizing processing goal lower bound 0071 processingGoal_LB(i)= processingGoal_LB(i)/normA; 0072 end 0073 0074 A_processingG = [zeros(m, numBlocks*numOfPeriods)... 0075 A_processingG,zeros(m, numBlocks*numOfPeriods)... 0076 zeros(m, numBlocks*numOfPeriods)... 0077 zeros(m,m), processingD2, zeros(m,m), zeros(m,m)]; 0078 0079 end 0080 0081 0082