2016-04-26 40 views
1

我有一個具體的問題,我會深表謝謝任何幫助。AMPL相關係數

我正在研究AMPL(一種數學編程語言)的具體項目: 我需要實現一個目標函數,該函數可以將變量的成本風險降到最低,其成本作爲參數,相關係數爲好。

使用成本差異來估計風險,我有我的相關矩陣數據。 我的相關矩陣如下所示: 相關係數(%)
煤汽輪機燃氣燃氣輪機風中環光伏水電非抽核GenIII核GenIV煤炭汽輪機CCS
1 0.47 0 0 0 0.12 0.12 1煤汽輪機
0.47 1 0 0 0 0.06 0.06 0.47氣體燃燒渦輪
0 0 1 0 0 0 0 0風
0 0 0 1 0 0 0 0環光伏
0 0 0 0 1 0 0 0水電非泵送
0.12 0.06 0 0 0 1 1 0.12核GenIII
0.12 0.06 0 0 0 1 1 0.12核GenIV
1 0.47 0 0 0 0.12 0.12 1煤汽輪機CCS

就我而言,我希望儘量減少成本的風險是燃油價格(燃料類型相關係數和相關係數每年都會變化,燃料價格取決於技術類型,省份和年份)。

我需要找到一種方法來找到一個有效的方法來在表(psgAdmin(psql)上的數據庫)中輸入相關矩陣,然後使用適當的參數來讀取它們,並在我的目標函數上實現它們。

是我到目前爲止的表看起來像這樣:

table fuel_prices "inputs/fuel_prices.tab" IN: 
[province, fuel, year], fuel_price, cv_fuel_price; 
read table fuel_prices; 

我需要修改它添加的相關係數。

# Table for the correlation coefficients 
# table fuel_prices_corr "inputs/fuel_prices_corr.tab" and IN: 
# [province, year], fuel, correl_coeff1, correl_coeff2; 
# read table fuel_prices_corr; 

我使用的技術從表提取爲執行以下操作: 表generator_info 「輸入/ generator_info.tab」 IN:
TECHNOLOGIES < - [技術],technology_id,燃料; 閱讀表generator_info;

table gen_cap_cost "inputs/gen_cap_cost.tab" IN: 
[technology, year], overnight_cost_yearly ~ overnight_cost, fixed_o_m_yearly ~ fixed_o_m, variable_o_m_yearly ~ variable_o_m; 
read table gen_cap_cost; 

table existing_plants "inputs/existing_plants.tab" IN: 
EXISTING_PLANTS <- [project_id, province, technology], 
ep_plant_name ~ plant_name, ep_carma_plant_id ~ carma_plant_id, 
ep_capacity_mw ~ capacity_mw, ep_heat_rate ~ heat_rate, ep_cogen_thermal_demand ~ cogen_thermal_demand_mmbtus_per_mwh, 
ep_vintage ~ start_year, 
ep_overnight_cost ~ overnight_cost, ep_connect_cost_per_mw ~ connect_cost_per_mw, ep_fixed_o_m ~ fixed_o_m, ep_variable_o_m ~ variable_o_m, 
ep_location_id; 
read table existing_plants; 


table new_projects "inputs/new_projects.tab" IN: 
PROJECTS <- [project_id, province, technology], location_id, ep_project_replacement_id, 
capacity_limit, capacity_limit_conversion, heat_rate, cogen_thermal_demand, connect_cost_per_mw; 
read table new_projects; 

我的目標函數是這樣的:PID =項目的具體編號,一個=省,T =技術,P =期,投資週期的開始,以及當發電廠開始運行之日起, h =學習時間 - 考慮獨特的時間點,p =投資期。

總和{(PID,A,T,P)中PROJECT}根[PID,A,T,P,H] * fuel_cost [PID,A,T,P))

沒有人有請提供一個提示,或使用MPT和相關變量的項目?

回答

0

這裏有一個表聲明的例子用於讀取here拍攝二維參數amt

table dietAmts IN "ODBC" (ConnectionStr) "Amounts": 
    [NUTR, FOOD], amt; 

在你的情況,你就會有相同的一組兩次在關鍵部分,像[ENERGY_SOURCE, ENERGY_SOURCE] ,其中ENERGY_SOURCE是一組能源,例如煤汽輪機等。由於矩陣是對稱的,所以只需要存儲它的一半。