#################################################################### #################################################################### # Sets ################################################################### ################################################################### set RAW; # raw materials set MINE{RAW}; #mines set ALLMINES := union{ r in RAW} MINE[r]; set IMILL; # steelmills set IMPORTS; #import set PRODUCER := IMILL union IMPORTS; # all producers set PRODUCT; # products set EXPORTS; # export harbours set CITY; # city (demand area) set CONSUMER := CITY union EXPORTS; set PROCESS; # production process set INT_PROD; # intermediate products in steel process set FACTOR := INT_PROD union PRODUCT union RAW; # all production factors ###################################################################### ###################################################################### # Parameters ###################################################################### ###################################################################### ################# mine parameters########################## param rawcap {ALLMINES}>=0; # mine capacity param rawqual {ALLMINES}>=0; # raw material quality (1 for coalmines) param rawprice {ALLMINES}>=0; # raw material price ################ process capacities ########################## param proc_cap {PROCESS,IMILL}; # mill process capacity ##################demand parameters############################ #( DUMMY) means that the variable is not used directly in the model. # it is used only to generate other parameters param tot_demand{PRODUCT}>=0; #total demand products (DUMMY) param rel_demand {CITY,PRODUCT} >=0; # relative city demand (DUMMY) param demand {c in CITY,p in PRODUCT} :=tot_demand[p]*rel_demand[c,p]; # city demand #################transport parameters########################### param raw_dist{ALLMINES,IMILL} >=0; #(DUMMY) distance mine mill param prod_dist{PRODUCER,CONSUMER}>=0; #(DUMMY) distance producer consumer param fixed_cost_raw>=0; #(DUMMY) param km_cost_raw>=0; #(DUMMY) param fixed_cost_steel>=0; #(DUMMY) param km_cost_steel{PRODUCT}>=0; #(DUMMY) # total cost for one Mton of raw material from mine c to mill m # including transportation and mining costs. param raw_tot_cost {c in ALLMINES, m in IMILL} := fixed_cost_raw + km_cost_raw * raw_dist[c,m] + rawprice[c]; # total transportation cost for 1 Mton of steel products from producer m # to consumer c param prod_trans_cost { m in PRODUCER, c in CONSUMER, p in PRODUCT} := fixed_cost_steel + km_cost_steel[p]*prod_dist[m,c]; ######################## process parameters ############################ # requirement of production factors in the process param factor_req{PROCESS,FACTOR}; # Energy cost of process. param energy_cost {PROCESS}>=0 ; # other cost of process param other_cost {PROCESS}>=0; # energy factor, 1 if normal energy prices, # 1.5 if energy prices go upp 50% e.t.c param energy_factor>=0; ##########################trade parameters################################ # The price we pay for imports param import_price >=0; #positive means cost # The price we get for exports param export_price >=0; # positive means income # how mych may we export and import. param max_import >=0; # limit on imports param max_export >=0; # limit on exports ########################################################################### ########################################################################### # variables ########################################################################### ########################################################################### # how much each process is running, in Mton output var processing {PROCESS,IMILL} >= 0; # How much raw material is transported from mine to mill. var raw_trans {ALLMINES,IMILL} >=0; # how much products are transported from consumer to producer. var prod_trans {PRODUCER,CONSUMER,PRODUCT} >=0; ############################################################################ ############################################################################ # Objective function ########################################################################### ########################################################################### # the total cost we are minimizing. minimize total_cost:sum{c in ALLMINES , m in IMILL} raw_trans[c,m]*raw_tot_cost[c,m] + sum{p in PRODUCT, m in PRODUCER, i in CONSUMER} prod_trans[m,i,p]*prod_trans_cost[m,i,p] + sum{ r in PROCESS, m in IMILL} (other_cost[r]+energy_factor*energy_cost[r]) *processing[r,m] + sum{ m in IMILL , p in PRODUCT ,c in EXPORTS} prod_trans[m,c,p]*(-export_price) + sum{ c in CITY, p in PRODUCT, m in IMPORTS} prod_trans[m,c,p]*import_price; ########################################################################## ########################################################################## # Constraints ########################################################################## ########################################################################## # We must not process above the capacity of our processes. subject to Proc_Cap {p in PROCESS, m in IMILL}: processing[p,m]<=proc_cap[p,m]; # We must not use to much raw materials from our mills. subject to Raw_Cap {c in ALLMINES}: sum{m in IMILL} raw_trans[c,m]<=rawcap[c]; #We must fulfill the demand in our cities subject to Demand {c in CITY,p in PRODUCT}: sum{m in PRODUCER} prod_trans[m,c,p]=demand[c,p]; #We must provide enough raw materials to our processes. subject to Raw_Req {m in IMILL,r in RAW}: sum{p in PROCESS} processing[p,m]*factor_req[p,r] + sum{c in MINE[r]} rawqual[c]*raw_trans[c,m]=0; # We must have mass balance with respect to our intermediate products. subject to Int_Prod_Req {m in IMILL,i in INT_PROD}: sum{p in PROCESS} processing[p,m]*factor_req[p,i]=0; # We must produce what we transport to the customers. subject to Prod_Req {m in IMILL, r in PRODUCT}: sum{p in PROCESS} processing[p,m]*factor_req[p,r]= sum{c in CONSUMER}prod_trans[m,c,r]; # Force variables to zero if we do not allow imports. subject to Max_Import : sum{i in IMPORTS, c in CONSUMER, p in PRODUCT} prod_trans[i,c,p]<=max_import; # Force variables to zero if we do not allow exports subject to Max_Export : sum{i in PRODUCER, c in EXPORTS, p in PRODUCT} prod_trans[i,c,p]<=max_export;