0001
0002
0003
0004
0005
0006
0007 function GPmain1
0008
0009
0010
0011
0012 clear
0013 load inputToGPBlocks;
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 Blocks =Blocks120;
0027 [c normVPQ] = objective_function(Blocks, numOfPeriods, interestRate,...
0028 C1, C2, C3, P1, P2, P3);
0029 normC = normVPQ;
0030 save C c normC;
0031 clear c normVPQ;
0032
0033
0034
0035
0036
0037
0038 load inputToGPBlocks;
0039 [A_miningG miningGoal miningGoal_LB]=mining_capacity_goal(Blocks, numOfPeriods,...
0040 miningTarget, miningSlack);
0041
0042
0043 [A_processingG processingGoal processingGoal_LB]=...
0044 processing_capacity_goal(Blocks, numOfPeriods, processingTarget,...
0045 processingSlack);
0046
0047
0048 [A_dykemG dykemGoal dykemGoal_LB]=...
0049 dykem_capacity_goal(Blocks, numOfPeriods, dykemTarget, dykemSlack);
0050
0051
0052 A_goals = [A_miningG; A_processingG; A_dykemG];
0053 b_goals = [miningGoal; processingGoal; dykemGoal];
0054 b_L_goals = [miningGoal_LB; processingGoal_LB; dykemGoal_LB];
0055 clear A_miningG A_processingG A_dykemG miningGoal processingGoal dykemGoal
0056
0057
0058
0059 [A_grade b_Ugrade] = grade_blending_constraint1(Blocks, numOfPeriods,...
0060 Maxgrade, Mingrade);
0061
0062
0063 [A_finesOregrade b_finesOreUgrade] = fines_ore_blending_constraint1...
0064 (Blocks, numOfPeriods,...
0065 MaxfinesOre, MinfinesOre);
0066
0067
0068 [A_finesDykegrade b_finesDykeUgrade] = fines_dyke_blending_constraint1...
0069 (Blocks, numOfPeriods,...
0070 MaxfinesDyke, MinfinesDyke);
0071
0072 [A_ore_mining b_ore_mining] = ore_mining_constraint(Blocks, numOfPeriods);
0073
0074 [A_mining_d b_mining_d] = deviation_positivity_constraint(Blocks, numOfPeriods);
0075
0076 [A_slope b_Uslope] = slope_constraints(blocksAbove,...
0077 numBlocks,...
0078 numOfPeriods);
0079
0080 [A_slope2 b_Uslope2] = slope2_constraints(numBlocks,...
0081 numOfPeriods);
0082
0083
0084 A_constraints = [A_grade; A_finesOregrade; A_finesDykegrade; A_ore_mining;...
0085 A_mining_d; A_slope; A_slope2];
0086 b_constraints = [b_Ugrade; b_finesOreUgrade; b_finesDykeUgrade;...
0087 b_ore_mining; b_mining_d; b_Uslope; b_Uslope2];
0088
0089 clear A_grade A_finesOregrade A_finesDykegrade A_ore_mining...
0090 A_mining_d A_slope A_slope2;
0091 clear b_Ugrade b_finesOreUgrade b_finesDykeUgrade...
0092 b_ore_mining b_mining_d b_Uslope b_Uslope2;
0093
0094
0095
0096 A = [A_goals; A_constraints];
0097 b_U = [b_goals; b_constraints];
0098 save A A
0099 save b_U b_U
0100 clear b_U
0101 clear A_goals A_constraints b_constraints
0102
0103
0104
0105
0106 [m,n] = size(A);
0107 [k1,k2] =size(b_goals);
0108
0109
0110
0111
0112
0113 b_L = -inf*ones(m-k1,1);
0114 b_L = [b_L_goals;b_L];
0115 save b_L b_L
0116 clear
0117
0118
0119 load inputToGPBlocks;
0120 [Result]= goal_program();
0121
0122
0123
0124
0125 miningGoal = ([miningTarget]')/1000000;
0126 processingGoal = ([processingTarget]')/1000000;
0127 dykemGoal = ([dykemTarget]')/1000000;
0128
0129
0130
0131 miningd1 = ([miningd1]')/1000000;
0132
0133 processingd2 = ([processingd2]')/1000000;
0134
0135 dykemd3 = ([dykemd3]')/1000000;
0136
0137 dykemd4 = ([dykemd4]')/1000000;
0138
0139 load Solution;
0140 load C normC;
0141 load Discounted_Values;
0142 output_plot_blocks1(Blocks120, Result, numOfPeriods, numBlocks,...
0143 normC, xdim, ydim, zdim, v, p, q,...
0144 miningGoal, processingGoal, dykemGoal,...
0145 miningd1, processingd2, dykemd3, dykemd4)
0146
0147
0148
0149
0150
0151 clear;
0152 load A; load b_U; load C; load Discounted_Values
0153 save problem;
0154
0155 clear;
0156 load Solution; load Period; load scheduledBlocks; load graphs;
0157 save Solution;
0158 clear;
0159
0160 delete A.mat; delete A_slope.mat; delete b_U.mat; delete Period.mat;
0161 delete C.mat; delete b_L.mat; delete xA.mat; delete xT.mat;
0162 delete yA.mat; delete scheduledBlocks.mat;
0163 delete graphs.mat; delete Discounted_Values.mat
0164
0165 end