


Constructs constraints checking ore is less than or equal to amount mined
--------------------------------------------------------------------------
Date May 27, 2009, Ver01
By: Hooman Askari
--------------------------------------------------------------------------
Inputs
--------------------------------------------------------------------------
miningCuts:
cell array containing the indices of blocks within each cut
iCuts. miningCuts(iCuts);
numBlocks:
a 1*1 vector containing the total number of blocks
numOfPeriods:
a 1*1 vector containing the number of periods
numCuts:
a 1*1 vector containing the number of cuts
--------------------------------------------------------------------------
outputs
b_ore_mining = sparse(counter, 1);
A_ore_mining = [sparse(counter, numCuts*numOfPeriods)...
A_ore_mining_x...
A_ore_mining_y];
--------------------------------------------------------------------------

0001 0002 % Constructs constraints checking ore is less than or equal to amount mined 0003 %-------------------------------------------------------------------------- 0004 % Date May 27, 2009, Ver01 0005 % By: Hooman Askari 0006 %-------------------------------------------------------------------------- 0007 %Inputs 0008 %-------------------------------------------------------------------------- 0009 % miningCuts: 0010 % cell array containing the indices of blocks within each cut 0011 % iCuts. miningCuts(iCuts); 0012 % numBlocks: 0013 % a 1*1 vector containing the total number of blocks 0014 % numOfPeriods: 0015 % a 1*1 vector containing the number of periods 0016 % numCuts: 0017 % a 1*1 vector containing the number of cuts 0018 % 0019 %-------------------------------------------------------------------------- 0020 % outputs 0021 % b_ore_mining = sparse(counter, 1); 0022 % 0023 % A_ore_mining = [sparse(counter, numCuts*numOfPeriods)... 0024 % A_ore_mining_x... 0025 % A_ore_mining_y]; 0026 % 0027 %-------------------------------------------------------------------------- 0028 0029 function [A_ore_mining b_ore_mining] =... 0030 ore_mining_constraints( miningCuts,... 0031 numBlocks,... 0032 numCuts,... 0033 numOfPeriods); 0034 0035 A_ore_mining_x = sparse(numBlocks * numOfPeriods, numBlocks * numOfPeriods); 0036 A_ore_mining_y = sparse(numBlocks * numOfPeriods, numCuts * numOfPeriods); 0037 0038 counter = 0; 0039 0040 length(cell2mat(miningCuts)) 0041 0042 for iCuts = 1: numCuts 0043 tempBlocks = miningCuts{iCuts}; 0044 for iBlocks = 1: length(tempBlocks) 0045 for iPeriods = 1:numOfPeriods 0046 % summation of xs should be equal to one 0047 counter = counter + 1; 0048 0049 A_ore_mining_x(counter, (iPeriods - 1)*... 0050 numBlocks + tempBlocks(iBlocks)) = 1; 0051 0052 A_ore_mining_y(counter, (iPeriods - 1)* numCuts + iCuts) = - 1; 0053 end % end for iPeriods 0054 end 0055 end % iCuts 0056 0057 b_ore_mining = sparse(counter, 1); 0058 0059 A_ore_mining = [sparse(counter, numCuts*numOfPeriods)... 0060 A_ore_mining_x... 0061 A_ore_mining_y]; 0062 0063 end