


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


0001 % Constructs the dyke material capacity goal 0002 %-------------------------------------------------------------------------- 0003 % Date: July 30, 2010, ver01 0004 % By: Eugene Ben-Awuah 0005 %-------------------------------------------------------------------------- 0006 0007 function [A_dykemG dykemGoal dykemGoal_LB]=... 0008 dykem_capacity_goal(Blocks120, numOfPeriods, dykemTarget, dykemSlack) 0009 0010 0011 [numBlocks n] = size([Blocks120.EBV]'); 0012 0013 %Goal2: ore mined should be equal to processing target 0014 DykemTonnage = [Blocks120.dykeTonnage]; 0015 0016 %Check calculated processing target against your set processing target 0017 dykemTarget1=(sum(DykemTonnage))/numOfPeriods 0018 0019 dykemG = zeros(numOfPeriods,numBlocks*numOfPeriods); 0020 for iPeriods = 1:numOfPeriods 0021 dykemG(iPeriods,((numBlocks*(iPeriods-1)+1):iPeriods*numBlocks))... 0022 = DykemTonnage(1,:); 0023 end 0024 0025 A_dykemG = sparse(dykemG); 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 dykemD3 = eye(numOfPeriods,numOfPeriods); 0032 dykemD3 = sparse(dykemD3); 0033 dykemD4 = eye(numOfPeriods,numOfPeriods)*-1; 0034 dykemD4 = sparse(dykemD4); 0035 0036 %Creating the processing Goal target matrix: size=(number of contraints x Periods),1 0037 %dykemGoal = repmat(dykemTarget, numOfPeriods,1); 0038 dykemGoal = [dykemTarget]'; 0039 dykemGoal = sparse(dykemGoal); 0040 0041 %Create a lower bound for the dykem target to introduce a slack during 0042 %optimization since the equality constraint in such large problems results 0043 %in infeasibility. You can first try with equality before using this lower 0044 %bound slack. For equality, set Slack to zero. 0045 dykemTarget_LB = dykemTarget-dykemSlack; 0046 dykemGoal_LB = [dykemTarget_LB]'; 0047 dykemGoal_LB = sparse(dykemGoal_LB); 0048 0049 % the mulitplier vector in the goal matrix have different sizes 0050 % and units. (some are tonnage some are grade....). It is necessary to 0051 % transform the constraints matrix in a way that it unit less to be 0052 % solved by the MIP code. 0053 % divide each row vector by its norm [A(i,:)* A(i,:)']^1/2 0054 % A_miningNormVector(m,1) is vertical vector holding the respective 0055 % norm of each row of the A_mining matrix 0056 [m,n] = size(A_dykemG); 0057 0058 for i = 1:m 0059 A_dykemNormVector(i,1) = norm(A_dykemG(i,:)); 0060 end 0061 0062 for i = 1:m 0063 normA = A_dykemNormVector(i,1); 0064 A_dykemG(i,:) = A_dykemG(i,:)/normA; 0065 0066 %normalizing the deviational variable 0067 dykemD3(i,:) = dykemD3(i,:)/normA; 0068 dykemD4(i,:) = dykemD4(i,:)/normA; 0069 0070 %normalizing the goal 0071 dykemGoal(i)= dykemGoal(i)/normA; 0072 0073 %normalizing dykem goal lower bound 0074 dykemGoal_LB(i)= dykemGoal_LB(i)/normA; 0075 end 0076 0077 A_dykemG = [zeros(m, numBlocks*numOfPeriods)... 0078 zeros(m, numBlocks*numOfPeriods),A_dykemG,... 0079 zeros(m, numBlocks*numOfPeriods)... 0080 zeros(m,m), zeros(m,m), dykemD3, dykemD4]; 0081 end 0082 0083