objective_function

PURPOSE ^

Constructs the objective function for the optimization problem

SYNOPSIS ^

function [c normVPQ] = objective_function(Blocks120, numOfPeriods,interestRate, C1, C2, C3, P1, P2, P3)

DESCRIPTION ^

 Constructs the objective function for the optimization problem 
--------------------------------------------------------------------------
 Date: July 30, 2010, ver01
 By: Eugene Ben-Awuah
--------------------------------------------------------------------------

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % Constructs the objective function for the optimization problem
0002 %--------------------------------------------------------------------------
0003 % Date: July 30, 2010, ver01
0004 % By: Eugene Ben-Awuah
0005 %--------------------------------------------------------------------------
0006 
0007 function [c normVPQ] = objective_function(Blocks120, numOfPeriods,...
0008                        interestRate, C1, C2, C3, P1, P2, P3)
0009 
0010 
0011 [numBlocks n] = size([Blocks120.EBV]');
0012 oreValueCutoff = repmat([Blocks120.oreValueCutoff]', 1, numOfPeriods);
0013 dykeCostCutoff = repmat([Blocks120.dykeCostCutoff]', 1, numOfPeriods);
0014 miningCost = repmat([Blocks120.miningCost]', 1, numOfPeriods);
0015 
0016 %Preallocate memory for efficiency
0017 v=zeros(numBlocks,numOfPeriods); p=zeros(numBlocks,numOfPeriods); q=zeros(numBlocks,numOfPeriods);
0018 for iPeriods = 1:numOfPeriods
0019     % v is a matrix holding the discounted oreValueCutoff of blocks for all
0020     % periods
0021     v(1:numBlocks, iPeriods)= oreValueCutoff(1:numBlocks,iPeriods)/...
0022     ((1+interestRate)^iPeriods);
0023 
0024     % p is a matrix holding the discounted dykeCostCutoff of blocks for all
0025     % periods
0026     p(1:numBlocks, iPeriods)= dykeCostCutoff(1:numBlocks,iPeriods)/...
0027     ((1+interestRate)^iPeriods);
0028 
0029     % q is a matrix holding the discounted miningCost of blocks for all
0030     % periods
0031     q(1:numBlocks, iPeriods)= miningCost(1:numBlocks,iPeriods)/...
0032     ((1+interestRate)^iPeriods);
0033 end
0034 
0035 % the MIGP function minimizes the function f(x); we multiply by -1 to
0036 % maximize the first part of the function passed to TOMLAB
0037 save Discounted_Values v p q
0038 v = v * (-1);
0039 p = p * (-1);
0040 q = q * (-1);
0041 
0042 %create row vector for deviational variables; 1x5 vector for each
0043 %deviational variable (dv). d1=mining target negative dv; d2=processing
0044 %target negative dv; d3=dyke material negative dv; d4=dyke material
0045 %positive dv.
0046 d1 = repmat(1, 1, numOfPeriods);
0047 d2 = repmat(1, 1, numOfPeriods);
0048 d3 = repmat(1, 1, numOfPeriods);
0049 d4 = repmat(1, 1, numOfPeriods);
0050 
0051 %the model assumes that there exists a pre-emptive penalty cost for deviating from
0052 %the goals. the most costly goal deviation is mining capacity, C1; then processing
0053 %capacity, C2; and then dyke material requirement, C3. This penalty cost in
0054 %deviating from the target is to convert the deviational tonnes to dollar
0055 %values. NB: cost should be negative; refer your notes.
0056 %C1=-4; C2=-3; C3=-2; %Order of deviational cost using abitrary values.
0057 d1 = C1*d1;
0058 d2 = C2*d2;
0059 d3 = C3*d3;
0060 d4 = C3*d4;
0061 
0062 for iPeriods = 1:numOfPeriods
0063     %d1 is a matrix holding the discounted penalty cost from deviating
0064     %negatively from the mining target for all periods
0065     d1(1, iPeriods)= d1(1,iPeriods)/...
0066     ((1+interestRate)^iPeriods);
0067 
0068     %d2 is a matrix holding the discounted penalty cost from deviating
0069     %negatively from the processing target for all periods
0070     d2(1, iPeriods)= d2(1,iPeriods)/...
0071     ((1+interestRate)^iPeriods);
0072 
0073    %d3 is a matrix holding the discounted penalty cost from deviating
0074     %negatively from the dyke material target for all periods
0075     d3(1, iPeriods)= d3(1,iPeriods)/...
0076     ((1+interestRate)^iPeriods);
0077 
0078     %d4 is a matrix holding the discounted penalty cost from deviating
0079     %positively from the dyke material target for all periods
0080     d4(1, iPeriods)= d4(1,iPeriods)/...
0081     ((1+interestRate)^iPeriods);
0082 end
0083 
0084 %the model assumes that there exists a pre-emptive priority structure among
0085 %the goals. the most important goal is mining capacity, P1; then processing
0086 %capacity, P2; and then dyke material requirement, P3; refer your notes.
0087 %P1=50; P2=40; P3=30; %Order of goal importance using abitrary values.
0088 d1 = P1*d1;
0089 d2 = P2*d2;
0090 d3 = P3*d3;
0091 d4 = P3*d4;
0092 
0093 % We need to calcualte a single norm for v, p, q, d1, d2, d3, d4 matrices.
0094 % See the documentation of the code for the format of the objective
0095 % function. After optimization the value of the objective function must
0096 % be multiplied with the norm to get the real disounted cash flow values
0097 % of the production schedule.
0098 combinedVPQ = [v; p; q; d1; d2; d3; d4];
0099 normVPQ = norm(combinedVPQ);
0100 
0101 %Normalizing the v matrix (ore value vector norm)
0102 v = v/normVPQ;
0103 
0104 %Normalizing the p matrix (dyke construction cost vector norm)
0105 p = p/normVPQ;
0106 
0107 %Normalizing the q matrix (mining cost vector norm)
0108 q = q/normVPQ;
0109 
0110 %Normalizing the deviational variables matrix (d1, d2, d3, d4)
0111 d1 = d1/normVPQ;
0112 d2 = d2/normVPQ;
0113 d3 = d3/normVPQ;
0114 d4 = d4/normVPQ;
0115 
0116 %Reshape v matrix into a vector
0117 v = reshape(v,numBlocks*numOfPeriods, 1);
0118 
0119 %Reshape p matrix into a vector
0120 p = reshape(p,numBlocks*numOfPeriods, 1);
0121 
0122 %Reshape q matrix into a vector
0123 q = reshape(q,numBlocks*numOfPeriods, 1);
0124 
0125 %Reshape deviational variables matrix into a vector
0126 d1 = reshape(d1,numOfPeriods, 1);
0127 d2 = reshape(d2,numOfPeriods, 1);
0128 d3 = reshape(d3,numOfPeriods, 1);
0129 d4 = reshape(d4,numOfPeriods, 1);
0130 
0131 % this is the coefficient of the objective function. The zeros are for the
0132 % mining precedence relationship decision variable, b, in the formulation.
0133 % This enables mining and processing at high resolution (continuous
0134 % variables) and mining precedence at lower resolution (integer variables)
0135 c=[zeros(numBlocks*numOfPeriods,1); v; p; q; d1; d2; d3; d4];
0136 
0137 %You need to formulate the entire goal function for all the variables and
0138 %then find the norm of this matrix and use it to scale down the values.
0139 %This case, the priority relationship of all the goals will be preserved.
0140 
0141 end

Generated on Fri 30-Jul-2010 16:56:05 by m2html © 2003