目录
1 主要内容
原文模型及部分结果:
2 部分代码
Number_day = Validate_day_end - Validate_day_1st + 1; First_day_intuition = Validate_day_1st; Final_day_intuition = Validate_day_end; Scaler_load = 0.22; Scaler_SPG = 0.39; Scaler_WPG = 0.39; R_for_load = 0.10; R_for_RES = 0.05; Method_flag = 'CPO'; Number_hour = 24; Number_RES = 5; %% -----------------------------SPO tunning----------------------------- %% lamda = 100000; Number_training_day = 2; Number_day_H_validity = 7; % The frequency of updating Predictor H. Number_historic_day = 7; Solver_flag = 'g'; Solver_gap = 3; Solver_time = 10; %% -----------------------Prepare box for recorder---------------------- %% % Rec for UC Rec_Decision_UC_I = cell(Number_day, 1); Rec_Decision_UC_P = cell(Number_day, 1); Rec_Decision_UC_R_h = cell(Number_day, 1); Rec_Decision_UC_R_c = cell(Number_day, 1); Rec_cost_UC_expected = cell(Number_day, 1); Rec_cost_UC_SUSD = cell(Number_day, 1); Rec_RES_prediction = cell(Number_day, 1); Rec_infea_UC_flag = cell(Number_day, 1); Rec_UC_time = cell(Number_day, 1); % Rec for ED Rec_cost_ACT = cell(Number_day, 1); Rec_cost_UC = cell(Number_day, 1); Rec_cost_SUSD_all = cell(Number_day, 1); Rec_cost_SUSD_UC = cell(Number_day, 1); Rec_cost_SUSD_ED = cell(Number_day, 1); Rec_cost_P = cell(Number_day, 1); Rec_cost_LS = cell(Number_day, 1); Rec_cost_loss_ACT = cell(Number_day, 1); Rec_cost_loss_UC = cell(Number_day, 1); Rec_infea_ED_flag = cell(Number_day, 1); %% --------------------------Prepare box for CPO------------------------ %% % Cost CPO_cost_ACT = zeros(Number_day, 1); CPO_cost_UC = zeros(Number_day, 1); CPO_cost_SUSD_all = zeros(Number_day, 1); CPO_cost_SUSD_UC = zeros(Number_day, 1); CPO_cost_SUSD_ED = zeros(Number_day, 1); CPO_cost_P = zeros(Number_day, 1); CPO_cost_LS = zeros(Number_day, 1); CPO_cost_loss_ACT = zeros(Number_day, 1); CPO_cost_loss_UC = zeros(Number_day, 1); % Flag CPO_infeasible_UC = zeros(Number_day, 1); CPO_infeasible_ED = zeros(Number_day, 1); %% -------------------------Set updating frequency---------------------- %% Number_period = ceil(Number_day/Number_day_H_validity); if Number_period == floor(Number_day/Number_day_H_validity) Number_day_in_period_full = Number_day_H_validity; Number_day_in_period_last = Number_day_H_validity; Period_size_list = ones(Number_period,1); Period_1st_list = zeros(Number_period,1); Period_end_list = zeros(Number_period,1); Period_size_list(1:Number_period-1) = Number_day_in_period_full; Period_size_list(Number_period) = Number_day_in_period_last; end if Number_period > floor(Number_day/Number_day_H_validity) Number_day_in_period_full = Number_day_H_validity; Number_day_in_period_last = Number_day - (Number_period - 1)*Number_day_H_validity; Period_size_list = ones(Number_period,1); Period_1st_list = zeros(Number_period,1); Period_end_list = zeros(Number_period,1); Period_size_list(1:Number_period-1) = Number_day_in_period_full; Period_size_list(Number_period) = Number_day_in_period_last; end for i_period = 1:Number_period Period_1st_list(i_period) = (Validate_day_end+1) - sum(Period_size_list(i_period:end)); Period_end_list(i_period) = (Validate_day_1st-1) + sum(Period_size_list(1:i_period)); end %% ------------------Prepare box for training details------------------- %% % Training detail CPO_TRA_Predictor_H = cell(Number_period, 1); CPO_TRA_Predictor_H_ele = cell(Number_period, 1); CPO_TRA_obj = zeros(Number_period, 1); CPO_TRA_cost_ERM = zeros(Number_period, 1); CPO_TRA_regulation = zeros(Number_period, 1); CPO_TRA_time = zeros(Number_period, 1); %% --------------------------Prepare box for pick----------------------- %% Picked_TRA_intuition = zeros(Number_training_day,Number_period); Picked_TRA_feature = cell(Number_period,1); Picked_TRA_load_city = cell(Number_period,1); Picked_TRA_reserve_load_req = cell(Number_period,1); Picked_TRA_reserve_RES_req = cell(Number_period,1); Picked_TRA_cost_perfect = cell(Number_period,1); %% ------------------------------Let's go------------------------------- %% for Current_period = 1:Number_period Number_dispatch_day = Period_size_list(Current_period); Dispatch_day_1st = Period_1st_list(Current_period); Dispatch_day_end = Period_end_list(Current_period); %% -----------------------Select training day----------------------- %% [Picked_TRA_intuition(:,Current_period),... Picked_TRA_feature{Current_period},... Picked_TRA_load_city{Current_period},... Picked_TRA_reserve_load_req{Current_period},... Picked_TRA_reserve_RES_req{Current_period},... Picked_TRA_cost_perfect{Current_period}]... = Step_00_Select_train_day(Dispatch_day_1st,... Dispatch_day_end,... Number_training_day,... Number_dispatch_day,... Scaler_load,... Scaler_SPG,... Scaler_WPG,... R_for_load,... R_for_RES,... Number_historic_day); %% -----------------------------Setp 01----------------------------- %% [CPO_TRA_Predictor_H{Current_period},... CPO_TRA_Predictor_H_ele{Current_period},... CPO_TRA_obj(Current_period),... CPO_TRA_cost_ERM(Current_period),... CPO_TRA_regulation(Current_period),... CPO_TRA_time(Current_period)]... = Step_01_CPO_train(lamda,... Scaler_load,... Scaler_SPG,... Scaler_WPG,... Solver_flag, Solver_gap, Solver_time,... Picked_TRA_feature{Current_period},... Picked_TRA_load_city{Current_period},... Picked_TRA_reserve_load_req{Current_period},... Picked_TRA_reserve_RES_req{Current_period},... Picked_TRA_cost_perfect{Current_period},... Number_training_day,... Method_flag);